I was dreaming about making this kind of project for quite some time. But the complexity of phone integration was frightening me. And it would be hard to reuse the work for my future ideas.
Now this became super-easy with Blynk :)
So I spent 1 evening and got it working. I hope this will be interesting for you.
To start working on this you will need:
- Hubsan X4 quadcopter (no modifications will be needed)
- ESP8266 breakout (ESP-07, ESP-12 or similar)
- USB <-> TTL Serial converter (3.3V)
- Breadboard + jumper wires
- Amic A7105 transceiver breakout
- Some easy soldering might be needed (depends on the hardware you have)
- Uploading firmware to ESP8266
[good example here]
References and thanks :)
- Blynk official documentation.
- Hubsan X4 protocol hacking: http://www.rcgroups.com/forums/showthread.php?t=1...
- ESP8266 pin mapping: http://esp8266.ru/esp8266-pin-register-strapping/
- Original Arduino library + A7105 pinout diagram: https://github.com/napsternxg/coptermanager-arduin...
- This great Instructable: https://www.instructables.com/id/Easy-Android-contr...
So... let's go!
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Setup Blynk App
Every time I use the Blynk app, it reminds me of the tricoder.
Tricoder: multifunction hand-held device used for sensor scanning, data analysis, and recording data.
The app has different widgets (buttons, sliders, displays).
You can perform actions you like. It's a universal remote, that can also display and plot data.
Here are some easy steps to get started:
- Install Blynk App:
Just push the "create account" button on the login screen.
You can install the local Blynk server to get the best control and responsiveness.
Read more about it here: https://github.com/blynkkk/blynk-server/blob/mast...
BTW, we're now working on adding direct connections through BT 4.0 BLE and
later WiFi, to eliminate the server link (specially for cases like this).
Step 2: Wire A7105 to ESP8266
As ESP8266 and A7105 operate with the same 3.3 volts, we don't need to use any converters, just connect them directly.
BTW, that's one of the reasons why I selected to use ESP8266.
Another one is obvious: it provides WiFi connectivity :)
You might have to solder few wires or use a breadboard to achieve a firm connection.
Step 3: Configure Blynk Project
- Create a new project and select that it is an ESP8266
- Push the button to send the Auth Token to your email
- Add a Button widget
Name it "Bind" and attach to Virtual pin 1.
Set mode to "Switch"
Add another Button widget
Name it "Lights" and attach to Virtual pin 6.
Set mode to "Switch"
- Add 2 Joystick widgets and configure as shown on the pictures
Hint: You can control sensitivity/shifting by changing those value ranges...
Step 4: Write Code & Upload Firmware
I will save you some time: here is the sketch you can program to your device :)
Actually I spent a few hours porting and fixing the original coptermanager to ESP8266 and scratching my head every time it failed to work or crashed ^_^
But once I had my ESP8266 working with Hubsan X4, it was really easy to interface it with the Blynk App.
Less than 15 minutes!
Everything I needed was to map commands of the coptermanager to the Blynk Virtual Pins:
V1 - COPTER_BIND Binds and returns the copter ID V2 - COPTER_THROTTLE (range 0x00 - 0xFF) throttle (top/down) V3 - COPTER_RUDDER (range 0x34 - 0xCC) rudder (rotate left/right) V4 - COPTER_AILERON (range 0x45 - 0xC3) aileron (drift left/right) V5 - COPTER_ELEVATOR (range 0x3E - 0xBC) elevator (forward/backward) v6 - COPTER_LED (1 or 0) enable/disable LEDs
- Open the provided sketch in the Arduino IDE
- Update Blynk Auth Token (the one from email) and WiFI credentials in the coptermanager.ino file
- Upload it to your ESP8266!
Step 5: Fly!
Believe me or not... that's it :)
- Power-up your ESP8266 and see it connects to the Blynk server.
- Power-up your Hubsan X4.
- Tap "Run" button in the App
[triangle in upper right corner]
- Tap on the "BIND" button widget.
Quadcopter should stop blinking. Great!
- Try to switch lights on and off with the second button. Wow!
- Now... carefully... put your fingers on those two joysticks...