HackerBoxes Robotics Workshop
by HackerBoxes in Circuits > Robots
8056 Views, 17 Favorites, 0 Comments
HackerBoxes Robotics Workshop
The HackerBoxes Robotics Workshop was designed to provide a very challenging but enjoyable introduction to DIY robotic systems and also hobbyist electronics in general. The Robotics Workshop is designed to expose the participant to these important Topics and Learning Objectives:
- Walking robots
- Geared assemblies for coordinating motion
- Soldering electronic projects
- Schematic circuit diagrams
- Optical sensors for autonomous steering and navigation
- Analog closed-loop control circuits
- Arduino programming
- NodeMCU embedded RISC processors
- Wi-Fi in embedded processor systems
- IoT control using the Blyk platform
- Wiring and calibrating servo motors
- Complex robotic assembly and control integration
HackerBoxes is the monthly subscription box service for DIY electronics and computer technology. We are makers, hobbyists, and experimenters. If you would like to purchase a HackerBoxes Workshop or receive the HackerBoxes surprise subscription box of great electronics projects in the mail each month, please visit us at HackerBoxes.com and join the revolution.
Projects in the HackerBox Workshops as well as those in the monthly subscription HackerBoxes are not exactly for beginners. They generally require some prior DIY electronics exposure, basic soldering skills, and comfort working with microcontrollers, computer platforms, operating system features, function libraries, and simple program coding. We also use all the typical hobbyists tools for building, debugging, and testing DIY electronics projects.
Hack the Planet!
Workshop Contents
- RoboSpider Kit
- Autonomous Line Following Robot Kit
- Arduino Robotic Arm Wi-Fi Controller
- MeArm Robotic Arm Kit
- Robotics Achievement Patch
Additional items that may be helpful:
- Seven AA Batteries
- Basic Soldering Tools
- Computer for running the Arduino IDE
A very important additional item we will need is a real sense of adventure, DIY spirit, and hacker curiosity. Starting any adventure as a maker and creator can be an exciting challenge. In particular, this type of hobby electronics isn't always easy, but when you persist and enjoy the adventure, a great deal of satisfaction may be derived from persevering and figuring everything out!
RoboSpider
Build your own RoboSpider with this robot kit. It features eight multi-jointed legs that duplicate the walking movement of real spiders. Examine the parts of the kit to verify 71 pieces shown here. Can you guess what each piece is used for within the RoboSpider design?
RoboSpider - Wiring
First wire up the motor and battery housing for the RoboSpider. The wires can simply be twisted onto the battery terminals as shown in the instructions. However, the wires may also be CAREFULLY soldered into place if you wish.
RoboSpider - Mechanical Assembly
A very interesting gear assembly is formed for each pair of legs. Each RoboSpider has four such assemblies of two legs each to coordinate the motion of eight separate spider legs. Note how a fixture is provided to aid in alignment of the gears.
The remainder of the RoboSpider can be assembled as shown in the instructions. What type of walking dynamics are exhibited by this RoboSpider?
Let's Get Ready to Solder
Soldering is a process in which two or more metal items (often wires or leads) are joined together by melting a filler metal called solder into the joint between the metal items. Various types of soldering tools are readily available. The HackerBoxes Starter Workship includes a nice set of the basic tools for soldering small electronics:
- Soldering Iron
- Replacement Tips
- Soldering Iron Stand
- Soldering Iron Tip Cleaner
- Solder
- Desoldering Wick
If you are new to soldering, there are a lot of great guides and videos online about soldering. Here is one example. If you feel that you need additional assistance, try to find a local makers group or hacker space in your area. Also, amateur radio clubs are always excellent sources of electronics experience.
Wear safety glasses while soldering.
You will also want to have some Isopropyl alcohol and swabs for cleaning the brownish flux residue left behind on your solder joints. If left in place, this residue will eventually corrode the metal within the connection.
Finally, you might want to check out the "Soldering is Easy" comic book from Mitch Altman.
Line Following Robot
The Line Following (aka Line Tracing) Robot can follow a thick black line drawn on a white surface. The line should be about 15mm thick.
Line Following Robot - Schematic and Components
Parts for the line following robot as well as the schematic circuit diagram are shown here. Try to identify all of the parts. While reviewing the theory of operations below, see if you can figure out the purpose of each of the parts and perhaps even why their values have been so specified. Trying to "reverse engineer" existing circuits is a great way to learn how to design your own.
Theory of Operation:
On each side of the line, an LED (D4 and D5) is used to project a light spot onto the surface below. These bottom LEDs have clear lenses to form a directed light beam as opposed to a diffused beam. Depending upon the surface below the LED being white or black, a different amount of light will reflect back up into the corresponding photoresistor (D13 and D14). The black tubing around the photoresistor helps to focus the reflected might directly into the sensor. The photoresistor signals are compared in the LM393 chip to determine if the robot should continue straight ahead or should be turned. Note that the two comparators in the LM393 have the same input signals, but the signals are oppositely oriented.
Turning the robot is accomplished by powering on the DC motor (M1 or M2) on the outside of the turn while leaving the motor towards the inside of the turn in the off state. The motors are turned on and off using the drive drive transistors (Q1 and Q2). The top-mounted red LEDs (D1 and D2) show us which motor is powered on at any given time. This steering mechanism is an example of closed-loop control and provides rapidly adaptive guidance to update the robot's trajectory in a very simple but effective fashion.
Line Following Robot - Resistors
A resistor is a passive, two-terminal, electrical component that implements electrical resistance as a circuit element. In electronic circuits, resistors are used to reduce current flow, adjust signal levels, divide voltages, bias active elements, and terminate transmission lines, among other uses. Resistors are common elements of electrical networks and electronic circuits and are ubiquitous in electronic equipment.
The line following robot kit includes four different values of axial-lead, through-hole resistors having the color coded bands as shown:
- 10 ohm: brown, black, black, gold
- 51 ohm: green, brown, black, gold
- 1K ohm: brown, black, black, brown
- 3.3K ohm: orange, orange, black, brown
The resistors should be inserted from the top of printed circuit board (PCB) as illustrated and then soldered from the bottom. Of course, the correct value of resistor must be inserted were indicated, they are not interchangeable. However, resistors are not polarized and they may be inserted in either direction.
Line Following Robot - Remaining Components
Other circuit elements, as shown here, can be inserted from the top of the PCB and soldered below, just like the resistors.
Note that the four light sensor components are actually inserted from the bottom of the PCB. The long bolt is inserted between the light sensor components and fastened snug with the open nut. Then the rounded-cap nut can be placed on the end of the bolt as a smooth glider.
Unlike the resistors, several other components are polarized:
The transistors have a flat side and a semi-circular side. When they are inserted into the PCB, be sure that these match the white silk-screen markings on the PCB.
The LEDs have a long lead and a shorter lead. The long lead should be matched up with the + terminal as indicated on the silk-screen.
The can-shaped electrolytic capacitors have a negative terminal indicator (usually a white stripe) going down one side of the can. The lead on that side is the negative lead and the other is the positive. These must be inserted into the PCB according to the pin indicators in the silk-screen.
The 8-pin chip, its socket, and the PCB silk-screen for inserting them, all have a semi-circular indicator on one end. These must be lined up for all three. The socket should be soldered into the PCB and the chip should not be inserted into the socket until the soldering is complete and cooled. While the chip may be directly soldered into the PCB, one must be very quick and careful when doing so. We recommend using a socket whenever possible.
Line Following Robot - Battery Pack
The thin, top-layer of the double-sided tape can be peeled off to affix the battery pack. The leads can be fed through the PCB and soldered below. The excess wire may be useful for soldering the motors.
Line Following Robot - Motors
Leads for the motors can be soldered to the pads on the underside of the PCB as shown. Once the leads have been soldered, the thin, top layer of the double-sided tape may be removed to affix the motors to the PCB.
Line Following Robot - Watch It Go!
The line following robot is a joy to watch. Pop in a couple of AA battery cells and let it rip.
If necessary, the trimmer potentiometers may be tuned to refine the edge detection of the robot.
If there are any other "behavior" problems with the robot, it is also helpful to check the alignment of the four underside sensor components and especially the black tubing around the photoresistors.
Lastly, be sure to use fresh batteries. We have noticed erratic performance once the battery runs down.
Robotic Arm From MeArm
The MeArm Robot Arm was developed to be the world's most accessible learning tool and smallest, coolest robot arm. The MeArm comes as a flat-pack robot arm kit comprising laser-cut acrylic sheets and micro servos. You can build it with nothing more than a screwdriver and enthusiasm. It has been described as the "Perfect Arduino Project for Beginners" by the Lifehacker website. The MeArm is a great design and a lot of fun, but can definitely be a little tricky to assemble. Take your time and be patient. Try not to ever force the servo motors. Doing so can possibly damage the tiny plastic gears inside the servo.
The MeArm in this workshop is controlled from a smartphone or tablet app using a NodeMCU Wi-Fi module adapted to the Arduino development platform. This new control mechanism is quite different from the original "brains" board discussed in the MeArm documentation, so be sure to follow the instructions for the controller that are presented here and not those in original documentation from MeArm. The mechanical details regarding assembling the MeArm acrylic components and the servo motors remain the same.
Robotic Arm Wi-Fi Controller - Prepare Arduino for the NodeMCU
NodeMCU is an open source platform based on the ESP8266 chip. This chip includes a 32-bit RISC processor running at 80 MHz, Wi-Fi (IEEE 802.11 b/g/n), RAM Memory, Flash Memory, and 16 I/O pins.
Our controller hardware is based on the ESP-12 module shown here which includes an ESP8266 chip along with its included Wi-Fi network support.
Arduino is an open-source electronics platform based on easy-to-use hardware and software. It's intended for anyone making interactive projects. While the Arduino platform generally uses the Atmel AVR microcontroller, it can be adapter to work with other microcontrollers, including our ESP8266.
To start, you will need to make sure you have the Arduino IDE installed on your computer. If you do not have the IDE installed, you can download it for free (www.arduino.cc).
You will also need drivers for your computer's Operating System (OS) to access the appropriate Serial-USB chip on the NodeMCU module you are using. Currently most NodeMCU modules include the CH340 Serial-USB chip. The manufacturer of the CH340 chips (WCH.cn) has drivers available for all popular operating systems. It is best to use the Google translated page for their site.
Once we have the Arduino IDE installed and the OS drivers installed for the USB interface chip, we need to extend the Ardino IDE to use operate with the ESP8266 chip. Run the IDE, go into preferences,and locate the field for entering "Additional Board Manager URLs"
To install the Board Manager for ESP8266, paste in this URL:
http://arduino.esp8266.com/stable/package_esp8266com_index.json
After install, close the IDE and then start it back up.
Now connect the NodeMCU module to your computer using the microUSB cable.
Select the board type within the Arduino IDE as NodeMCU 1.0
Here is an instructable that goes over the setup process for Arduino NodeMCU using some different application examples. It is a bit astray from the objective here, but it may be helpful to look at for another point of view if you get stuck.
Robotic Arm Wi-Fi Controller - Hack Your First NodeMCU Program
Whenever we connect a new piece of hardware or install a new software tool, we like to make sure that it works by trying something very simple. Programmers often call this the "hello world" program. For embedded hardware (what we are doing here) the "hello world" is usually blinking an LED (light emitting diode).
Luckily, the NodeMCU has a built-in LED that we can blink. Also, the Arduino IDE has an example program for blinking LEDs.
Within the Arduino IDE, open the example called blink. If you closely examine this code you can see that it alternates turning pin 13 high and low. On the original Arduino boards, the user LED is on pin 13. However, the NodeMCU LED is on pin 16. So we can edit the blink.ino program to change each reference to pin 13 to pin 16. Then we can compile the program and upload it to the NodeMCU module. This may take a few tries and may require verifying the USB driver and double checking the setting of the board and port on in the IDE. Take your time and be patient.
Once the program properly uploads the IDE will say "upload complete" and the LED will start blinking. See what happens if you change the length of the delay() function inside the program and then upload it again. Is it what you expected. If so, you have hacked your first embedded code. Congratulations!
Robotic Arm Wi-Fi Controller - Example Software Code
Blynk (www.blynk.cc) is a Platform including iOS and Android apps to control Arduino, Raspberry Pi, and other hardware over the Internet. It's a digital dashboard where you can build a graphic interface for your project by simply dragging and dropping widgets. It's really simple to set everything up and you'll start tinkering right away. Blynk will get you online and ready for the Internet Of Your Things.
Have a look at the Blynk site and follow the instructions for setting up the Arduino Blynk Library.
Grab the ArmBlynkMCU.ino Arduino program attached here. You will notice that it has three strings that need to be initialized. You can ignore those for now and just make sure that you can compile and upload the code as it is to the NodeMCU. You will need this program loaded to the NodeMCU for the next step of calibrating the servo motors.
Downloads
Robotic Arm Wi-Fi Controller - Calibrating Servo Motors
The ESP-12E motor shield board supports directly plugging the NodeMCU module. Carefully line-up and insert the NodeMCU module to the motor shield board. Also hook up the four servos to the shield as shown. Note that the connectors are polarized and must be oriented as shown.
The NodeMCU code that was loaded in last step initializes the servos to their calibration position as shown here and discussed in the MeArm documentation. Affixing the servo arms in the correct orientation while the servos are set to their calibration position ensures that the proper start point, end point, and range of motion is configured for each of the four servos.
About using battery power with the NodeMCU and MeArm servo motors:
The battery leads should be wired to the battery input screw terminals. There is a plastic power button on the motor shield to activate the battery input supply. The tiny plastic jumper block is used to route power to the NodeMCU from the motor shield. Without the jumper block installed, the NodeMCU can power itself from the USB cable. With the jumper block installed (as shown), the battery power is routed to the NodeMCU module.
Robotic Arm User Interface - Integrate With Blynk
We can now configure the Blynk app to control the servo motors.
Install the Blyk app on your iOS or Android mobile device (smartphone or tablet computer). Once installed, set up a new Blynk project having four sliders as shown for controlling the four servo motors. Note the Blynk authorization token generated for you new Blynk project. You can have it emailed to you for ease of pasting.
Edit the ArmBlynkMCU.ino Arduino program to fill in the three strings:
- Wi-Fi SSID (for your Wi-Fi access point)
- Wi-Fi Password (for your Wi-Fi access point)
- Blynk Authorization Token (from your Blynk project)
Now compile and upload the updated code containing the three strings.
Verify that you can move the four servo motors over Wi-Fi using the sliders on your mobile device.
Robotic Arm - Mechanical Assembly
We can now proceed with the mechanical assembly of the MeArm. As previously noted, this can be a
little tricky. Take your time and be patient. Try not to force the servo motors.
Remember that this MeArm is controlled by the NodeMCU Wi-Fi module which is quite different from the original "brains" board discussed in the MeArm documentation. Be sure to follow the instructions for the controller that are presented here and not those in original documentation from MeArm.
The complete mechanical assembly details can be found at this site. They are labeled as the Build Guide for MeArm v1.0.
Online Resources for Studying Robotics
There are a growing number of online robotics courses, books, and other resources...
- Stanford Course: Introduction to Robotics
- Columbia Course: Robotics
- MIT Course: Underactuated Robotics
- Robotics WikiBook
- Robotics CourseWare
- Learning Computing with Robots
- Robotics Demystified
- Robot Mechanisms
- Mathematical Robotic Manipulation
- Educational Robots with Lego NXT
- LEGO Education
- Cutting Edge Robotics
- Embedded Robotics
- Autonomous Mobile Robots
- Climbing and Walking Robots
- Climbing and Walking Robots New Applications
- Humanoid Robots
- Robot Arms
- Robot Manipulators
- Advances in Robot Manipulators
- AI Robotics
Exploring these, and other, resources will continuously expand your knowledge of the world of robotics.
Robotics Acheivement Patch
Congratulations! If you have put your best effort into these robotics projects and advanced your knowledge, you should wear the included achievement patch with pride. Let the world know that you are a master of servos and sensors.
Hack the Planet
We hope you are enjoying the HackerBoxes Robotics Workshop. This and other workshops can be purchased from the online shop at HackerBoxes.com where you can also subscribe to the monthly HackerBoxes subscription box and have great projects delivered right to your mailbox each month.
Please share your success in the comments below and/or on the HackerBoxes Facebook Group. Certainly let us know if you have any questions or need some help with anything. Thank you for being part of the HackerBoxes adventure. Let's make something great!