Have you ever wanted to prove your superiority by embarrassing a friend in a race? Well, now you can with my racing robots project! Using the chipKIT WF32, a Leap Motion Controller, and LabVIEW, I was able to use the Leap Motion Controller to control the speed of a robot.
To begin the game, each player places their hand over the Leap Motion Controller. The rules are simple. Wave your hand up and down the fastest and your robot will explode with an acceleration strong enough to throw the earth out of orbit and leave even the fastest neon pink Honda Civic with green rims a sick spoiler in the dust. To find out more about the racing robots, take a look at my Instructable!
The racing robots communicate with LabVIEW using the chipKIT WF32’s built in WiFi and LabVIEW MakerHub LINX and are powered by the on-board battery pack located on the ventral region of the robot. The LabVIEW MakerHub LINX library for the Leap is also used to read the values from the Leap into LabVIEW.
With one of the built-in VIs (visual interfaces) in LabVIEW, I was able to find peaks and valleys in the y-axis position values for both player’s hands. These peaks and valleys are turned to 1 indicating that a peak or a valley is detected or a 0 indicating neither are found. Then, a running 100 sample average is updated with the 1s or 0s and the average is then normalized. The max sample average we received as 0.4, and thus your average as a percent of 0.4 is the PWM value sent to both of the motors using a PmodHB5. Therefore, the faster you wave your hand, the greater the PWM value sent to the motors and the faster your robot will drive. Check out the LabVIEW block diagram code below to see what the code looks like!
You may have noticed that I am writing some digital channels high or low. The PmodHB5 has a channel that determines the direction of the motor. Since the motors are facing opposite each other, you need to write one motor high and the other low to have them travel in the same direction. Also, because the robots did not drive perfectly straight, I altered the PWM values depending on which motor was traveling faster.
If you have any questions, feel free to ask! If you’d like to learn how to make your own robots using LabVIEW, try using the Instructable for this project as a guide to help you create yours. You may also want to check out the jousting robots if you need more inspiration.