Make your own DDNS Server to access your home internet devices, no paid service needed!
Control Foscam Cameras from your phone, with on-screen controls. Vote for it if you like!
This setup comes under $10, and does this job for free!
The Foscam Camera interface included, works on Any Browser and Any Device, even on 3G Connection on your phone, no external app needed. Password protected.
Shows online Foscam cameras in separate windows, fast and flawless with full control.
I am not responsible for any misuse or damage caused by this project, by any means. Use it at your own risk!
Share it for free!
- A Web server running
- One Esp8266 ESP-01
- Two instant push buttons
- Two 2k2
- USB-TTL breakout adapter for programming the ESP with some female wire jumpers
- One Ams1117 3.3v Voltage Regulator - To reduce 5v to 3.3 for the ESP module.
- 5v 1A or Preferably 2A old Power Supply
Option 1: A power supply fastened with screws and room enough, so you can fit the ESP module inside it.
Option 2: A power supply with female usb connector, in this case you will have to use a male usb conector attached to the board to plug outside the power supply.
-One broken Pendrive stick
- Updated Arduino IDE Installed
- Optional: Foscam Cameras to operate from the web interface
To be implemented:
-Blinking led, to show update success and waiting to update states.
-Internal server resolving Wan IP. The present version connects to
To be able to activate the programming mode of the esp-01 module you have to:
-Solder two resistors, one to CH-PD pin and the other to RST-Pin, pulling them both up by soldering them to 3.3v pin.
-Solder two instant push buttons: one goes between GPIO0 and Ground and the other button between RST and Ground Pin.
It is better to solder the on the top of the esp board to leave the botton pins free for plugging the jumper cables.
If you prefer you wire it on the breadboard, see image, but solder is a better long term approach if you like.
In the next step you will see how to prepare the power supply, beware the usb port on your pc will not be able to power up the Esp module!
The 5v power supply must be solid 1A or even better 2A, because the module drains some juice when transmitting the Wifi radio.
Use the Ams1117 3.3v voltage regulator, because a voltage divider made with resistors will probably render the amperes too low even if you get 3.3v to power the module, and you will be frustrated. It costs only few cents, and is the best solution.
I did not add a capacitor and resistor indicated to go with this regulator, because it is running on a regulated power supply, and it is working solid for some years now.
pin 3 - 5v Orange
pin 2 - 3.3v Yellow
pin 1 - GND Blue - two jumper cables
You can solder some male jumper wires to this setup, so you can have always ready a 5v and 3.3v on the same power supply, very usefull if you are prototyping with a breadboard. Remember to add two ground wires for +3 and +5. Add a thin plastic brace to thightly secure it.
You will need some female/female wire jumpers to plug this pins to the male pins on the esp module.
ESP USB 3.3v
GND - - - - GND- - - - GND
TX - - - - - RX
RX - - - - - TX
3.3 - - - - - - - - - - - - - 3.3
Ground together: Voltage Regulator, the usb-ttl module and the ESP module.
The 3.3 goes only from the voltage regulator to the ESP module.
Do not wire the ESP-01 to 3.3 on the usb ttl adapter, even if it has it, you can damage your pc usb port, it does not provide enough amps! Always use a proper power supply to power ESP8266.
Beware that some TTL-USB are 5v logic, which cannot be used, only those with 3.3 logic or it will damage the module. You can check with a volt meter on TX and ground pins, in this case you can add a level shifter, or voltage divider to reduce the voltage.
-Create a"/ip"(case sensitive) on the root of your public_html folder, and extract /ip files inside with 644 permission.
.htaccess restriction does not allow users to list files on this folder because it cannot be password protected or else esp8266 could not access and execute the files inside it.
input.php and input2.php generate by browser url ip.txt and ip2.txt with the updated ip of the esp8266 module, the current code support 2 different locations, but you just have to edit this files to easily add more.
If you have FOSCAM cameras to control:
-Create a"/cam"(case sensitive) on the root of your public_html folder, and extract /cam files inside with 644 permission. Password protecte this folder, if your host is cpanel enabled, you can look for
password protected folder icon, and create a password that will be requested when you point your browser to www.yourhost/cam any browser will pop-up a dialog asking for this login, it will protect the access for the cams.
-foscam.php contains the interface for the cameras as well as the date/time stamp of the ip files on the bottom and the current ip for the locations. you can see if the module is working by the date/time stamp. It may display wrong GMT because it shows the timestamp on the host.
Also you can change the ip manually, it will write ip.txt and ip2.txt with the ip you type on the box and click update ip.
-Interface.png and interface2.png are transparent images mapped that serve as onscreen display for the interface, you have to edit foscam.php to match the foscam models you have static or ptz. The default is 320x240, but by clicking on the center of the control , opens only this camera with better refresh rate at 640x480.
If you want to modify foscam.php you can use a code editor or html editor that handles wyswyg.
When the board is working it will write automatically ip.txt and
ip2.txt containing the updated ip of two locations where 2 different boards may be running. Every 1 hour (or when you reset it), it will connect to the router via wifi, obtain the ip and write to the txt file on server. Even when the internet connection is lost or power blackout it will update your ip periodically when it is normalized.
On Tp-link Router Config Page:
It helps to avoid conflicts binding Mac-Address and Lan ip, the router will only provide fixed lan ips for that mac-address. See image.
Virtual servers - add your cameras Lan Ips and corresponding ports.
Leave DHCP server enabled on the router.
Check enable Upnp on the router
You can also config Remote Management of your router, in Tp-Link router it is under Firewall item.
You will be able to open router configuration page remotely. Beware to change default login, because it will be available openly. Fill in 255.255.255.255 and a port tipically 8080.
On the foscam cameras config, set-up page:
Username and pass: Set new username and password, don´t forget to"search and replace"them on foscam.php for admin and password.
Basic Network settings:, check"Obtain IP from DHCP Server"
Http Port: set 8081, 8082 8083 seuquentially on your cameras
UPnP Settings: check Using UPnP to Map Port. It helps to recover connection when a blackout occurs.
After configuring router and cameras, restart them together to validate settings, The router first.
When your cameras and router are set-up correctly for remote access, you can access them with your Wan IP addess like this: http://184.108.40.206:8081 You can check what your Wan Ip is on https://www.whatismyip.com/
Open the attached arduino sketch on Arduino IDE
You have to provide your wi-fi router´s ssid"//your wifi ssid"and password"//your wifi pwd"in the code where it is required, also your host name,"//your host without /IP"and the path to the /ip folder containing the server side files. You don´t have to change this.
You Have also may have to change the line url +="input.php?ip="; that appears two times on the code, whether just if you have a second module on another location, replace with input2.php
Before uploading it you must set the correct board, under the menu tools, choose Generic ESP8266 module, if it is not there, you have to add in the Additional boards manager inside preferences.
To upload hold GPIO0 push button and press RST button rapidly, then release the former, then hitting upload on the ide to compile and upload.
If everything goes smooth you will open serial monitor at 9600 baud and see this:
Connected To: <SSID>
IP address: 192.168.0.103 (LAN IP)
Connected - Acquiring WAN IP:
connecting to <yourhost>
Requesting IP Update: /ip/input.php?ip=xxx.xxx.xxx.xxx
After the it is fully tested and proven working it is time to make it stand alone.
You can remove the resistors and pushbuttons wiring as shown above, if you have enough room in your casing you don´t have to, as it is possible you want to re-program it in the future.
Option 1: Screwed Case Power supply with cord or Female USB
Pry open a screw fastened old power supply. You can remove the black cord with connector, and fit the esp module inside it wraped in insulation tape with the voltage regulator, connected to where the cord was soldered, taking care not to touch any component.
You can use proper foam tape for insulation or glue the module with hot glue inside the casing cover.
The final result is a power supply without cable It can be 5v 1A.
A variation of this, is to open a USB Female power supply fitting the module inside, but soldering the regulator to the inside part of the USB Female Connector, You will save the External connector to charge your phone, but in this case phe power supply must be 5v 2A.
Option 2:Using a broken USB Stick to fit the esp module inside.
If you have a broken pendrive stick you can disassemble it and use it´s connector and casing to fit it inside!
In this case you will need to remove the memory circuit and solder the esp module with voltage regulator to the solder side of male usb connector. You will have to remove or clip off the excess of the esp header pins to fit, bat it is really tiny and fits perfectly. Never plug this to your pc USB PORT!!!
You have to plug this to an outlet with enough wifi signal strength, check your phone for that.
To see if it´s working check in your browser the /cam/foscam.php file on the web server.
It should update with your current IP and the date/time stamp.
This tutorial is originally created by CelsoF2.