Introduction: ESP8266+Smartphone Wireless Remote for DSLR With (possible) GPS for Under $10
A while back I came across this awesome project by CosmicMac. Basically you can trigger your DSLR wirelessly using your smartphone via the ESP8266 connected to the DSLR. Given that not all cameras have support for built in shutter terminal, and that different brands have different pinouts for their camera, you need to modify the peripherals accordingly.
My camera is a Nikon DSLR D3200 with remote terminal using proprietary MC-DC2 port. You can buy a cheap wired shutter remote online for around $1.
What's interesting is that the MC-DC2 also has a pin for GPS data. After doing some research I found these projects:
1. Nikon D90 Homemade GPS
I was about to make my version of CosmicMac's project using ESP-12 development board and programming using the Arduino IDE when I got the idea of trying to send GPS data from phone to ESP mcu and communicate it to DSLR. While in theory this sounds promising,I came into a lot of trouble mostly because:
1. I am a beginner
2. The camera uses NMEA 0183 protocol to read GPS data while getting this form of data is tricky. It might be possible by writing a native android app using NMEA listener but I didn't try it.
3. I wanted to use the Blynk app to implement the project, however direct communication with ESP and smartphone is not yet possible and GPS widget is not yet available. Maybe I will make it in the future :)
So, my project is mostly a spinoff of CosmicMac's project with possible integration of Ido Nassimi and Grinkevich projects. I am also submitting this project for the REMIX 2.0 contest, so if you like it please vote.
Here are some of the major changes I made from original projects:
1. Using arduino to program ESP mcu instead of nodemcu firmware.
2. Using ESP-12 instead of ESP-1
3. Using HTML 5 geolocation API to get user's data location
4. Setting up wifi web server on esp mcu to communicate with smartphone
5. I also implemented a FOCUS option since not everybody uses manual focus.
Also, about the GPS part, it's still a work in progress so bare with me.
Step 1: Overview
Firstly, I'm going to introduce the materials needed for this project. Then dive into how to write the sketch to the board. I'm also going to explain key methods in the .ino sketch. Afterwards we look at the hardware setup. Then finally see it in action.
Step 2: Materials
1. ESP8266 microcontroller, I bought mine, ESP-12 development board, from TaoBao for around 3 dollars.
2. USB-TTL converter for writing sketch to ESP8266. I bought one with adjustable 3.3V and 5V logic. Be careful!! the esp uses 3.3V
3. 2* 4N25 optocouplers
4. 2 resistors
5. Jumper wires
7. Smartphone and DSLR, not accounted in bill of course
8. Corresponding shutter remote
Step 3: Setting Up the Board
There are a lot of tutorials out there on how to setup the esp for arduino programming.
I made my first instructable mentioning that. Look at step one here.
We are using esp standalone, that is without AT firmware.
Set up hardware as shown in step 3 here
make sure you have separate power supply for esp, 3.3V!!!!!!
You might want to upload a simple sketch to make sure everything works fine.
Then download this sketch and upload to board.
Step 4: The Sketch
Initially, we define libraries used and pins.
Change the FOCUS and FIRE pin numbers as desired.
Then change your preferred "ssid" and "password" for the Access Point setup. Note, this is not the ssid or password of you home network. It is used on smartphone to connect to ESP.
The /* Set page handler functions */
This part is based on Ashish Derhgawen's sketch.
Here we setup the page links name and assign method names to handle them.
/* Root page for the webserver */
Where we setup how to handle the root. Basically the address you first go to to load the root page is the IP address provided in serial monitor. 192.168.4.1
The page contains links 3 options:
- Remote with self timer
- Gps compatibility
- Shooting with GPS
The remote with timer page
It contains code to display "/remote" page. On this page you can select timer, then press the submit button.
The values are sent to ESP where the delay is processed and then the FOCUS is triggered (also allows 5s for focus to complete) the FIRE is triggered to actually take the picture. you can modify the code according to your requirements.
The compatibility page
This page just checks if your smartphone browser supports geolocation. On prompt on smartphone, please allow access. Also, you may need to enable location services for browser in device settings.
The Remote+ GPS page
Here we first convert geotag values to NMEA and send a string to esp.
This part requires a lot of coding. The $GPRMC and $ GPGGA( please make sure you read NMEA protocol first) need to be sent to camera. This part is a bit experimental as the values need to be computed, a checksum calculated and sent as TTL logic, possibly 5V for some cameras.
Step 5: Wiring
After writing the sketch to the mcu, we can finally run our code independently.
The wiring is similar to the one used in CosmicMac's project. I modified it a little bit.
1. There are two output pins, thus 2 optocouplers, one for focus, one for shooting.
2. The MC-DC2 port I used for my project needs to be modified as only wires for ground, focus and shoot are wired inside . For those wanting to try the GPS, this modification is required, otherwise for the remote, the 3 wires are good.
I am not going to dwell too much on how to do this as these two places provide ample info
Step 6: The Web UI
After wiring and writing code to esp, it's time to actually use the setup.
- Connect your smartphone's wifi to the name you set up as SSID for the access point.
Open your browser, and to go IP provided in serial monitor.
Choose your options for shooting
Step 7: The END
That's it folks.
thank you for your attention.
I welcome any feedback and help especially if someone wants to refine the codes or help with the GPS part.
Participated in the
Remix 2.0 Contest