Remote Control Vehicle Transmitter With Arduino Blockly
by paulware in Circuits > Arduino
1396 Views, 14 Favorites, 0 Comments
Remote Control Vehicle Transmitter With Arduino Blockly
In this project you will create your own remote control vehicle transmitter.
The components (obtained from https://sites.google.com/site/arduinoblockly/components):
- 433 transmit/receive module pair
- arduino nano
- Wii-Nunchuk
- Setup
- Download Arduino ide from Arduino.cc
- Download the ch340 usb driver from http://www.arduined.eu/ch340-windows-8-driver-download/
- Download the RoboticsLibrary from https://www.github.com/Paulware/RoboticsLibrary
- Download Blockly from https://www.github.com/Paulware/ArduinoBlockly
- Place the RoboticsLibrary directory in your Arduino libraries directory
- Place the Blockly directory on your C drive.
Create the Blockly Diagram
From the toolbox/ArduinoSetup , drag the setup/loop block to the main canvas
From the toolbox/Logic, drag the if do to the main canvas, create 4 else if conditions.
Drag 2 Nunchuck X position detection to the If/Else.
Drag 2 Nunchuck Y position detection to the Else ifs
Drag 1 Nunchuk Released to an Else if.
From the toolbox/RF drag the Send Message box to main canvas.
Assemble the pieces to perform this logic in the loop area:
Send "a" when nunchuk left is detected, "w" when up is detected, "s" when down is detected, "d" when right is detected and z when nunchuk is released.
The diagram should look similar to the above picture.
Press Arduino "Copy to Clipboard". This will copy the arduino sketch into the clipboard
Paste the Arduino Code to the IDE
Open the Arduino IDE and select File New to create a new sketch.
Press Cntl-A to select all the current text and then Cntl-V to paste the clipboard contents into the sketch
. You should see something like the image above.
Select Sketch compile to see if the sketch compiles correctly. If it does not compile, this is usually because the RoboticsLibrary has not been placed in the Arduino libraries directory. To find out the location of your Arduino libraries directory, select File, Preferences in the Arduino IDE and note the sketch location. This directory should contain your sketches as well as the libraries directory .The Robotics Library from https://www.github.com/Paulware/RoboticsLibrary should be located there.
Once the sketch compiles, connect the Nano which you can obtain on line or from me ($8 paulware@hotmail.com) and in Tools select the port for the nano. Then from Tools select Board=>Nano. Then press upload. This will load the sketch on the nano.
To wire the transmitter, connect the data pin on the receiver to D12 on the nano, and connect + on the transmitter to 5V on the Nano and - on the transmitter to GND on the nano. Then connect Nunchuk + to 5V and Nunchuk - to gnd. Also connect Nunchuk A4 (SDA) to Nano A4, and Nunchuk A5 (SCL) to nano A5.
Now select tools, Serial Monitor and the sketch should show "Ready". When the rc receiver(which is covered in another instructable) receives the command strings, you should see the rc motor move.