80% of the 150 attendees at Silicon Chef 2013 were WOMEN – and for many of the attendees, it was their first time coding, hardware hacking, or both. The hackathon goals were to break down the mental and physical barriers to entry for hardware-curious beginners. Simply put, we provided the silicon; they provided the enthusiasm and laptops.By Melanie Warrick (Hackbright Academy – spring 2013 class)
Last weekend at Silicon Chef, the women-centric hardware hackathon, there were over 100 participants and 20 projects demoed. My team built an Arduino on Parallax wheels controlled by a Leap Motion (3D programmable motion sensor).
Check out the video to see our robot car:
Leaprobo Project Idea
I bought the Parallax kit several months ago with the intent of attaching it to my Arduino because I think everything is better with wheels (almost everything). However, I was too busy with so many other projects and things to study that I didn’t get around to assembling it until now. When the hackathon came up, it seemed like the perfect motivator to break out the wheel kit. Plus, my team had heard about Leap Motion and controlling things with a sensor seemed like a fun. Thus, the idea for the Leaprobo project came together.
It seemed simple enough and yet not so much considering how new most of us were to hardware. Lucky for us, one of our team members had several years experience with robotics, and we had some great mentorship on system design and building.
Leaprobo Hardware Parts:
• Leap Motion
• Parallax Robitics Shield Kit (for Arduino)
• USB cord
• HC-05 Bluetooth Chip (not finished)
• Accelerometer (not finished)
• Mac / Unix Terminal
Leap Motion Script
We created a Python script using the Leap’s library to read hand motions and then print out letters to the command line.
• Backward = 5 fingers spread open = print “B”
• Stop = Closed fist = print “S”
• Left = hand tilted left = print “L”
• Right = hand tilted right = print “R”
You can see the full script for the project at the following link:
Leap script = car.py
One tricky bit to note is the Leap Motion script required using the standard Python language that comes with Mac (which can sometimes be an older version). It threw errors if we tried to run it off the Homebrew installed version. So we created a virtual environment that explicitly pointed to the Mac Python version. Below is the command that made it work on our computers but other computers may be different:
$ virtualenv -p /usr/bin/python [envname]
We built a script in the standard Arduino version of C to loop/continually read the serial port for input. A switch statement defined each case that corresponded to the outputted letters from the Python code. So if “F” is printed to the serial port, the corresponding case would call a forward function that told the servos to rotate (left counterclockwise at 1400 microseconds and right clockwise at 1600 microseconds). We had a case and corresponding function that gave servo direction based on each movement defined in the Leap code.
Note, we had to program opposite rotation for the servos for forward and backward because they are mounted in the Arduino in opposite directions. To see more about the script for the Arduino, checkout the link below.
Arduino script = car_test.ino
Parallax Wheel Kit
Parallax provides comprehensive online directions regarding how to put the wheel kit together. The first chapter gives a great overview of Arduino’s script language and the chapters covering how to build the shield is really good for someone new to hardware.
We actually assembled the wheel kit the weekend before so we had practice with it. We were ready to disassemble and reassemble if necessary, but the hackathon was pretty low-key and focused on us having fun and learning. Thankfully that was the case because we had enough roadblocks to keep us busy the whole weekend.
Serial Port – Pulling it Together
To pull the pieces together, we connected the Leap and the Arduino to one computer with USB cables. We ran the Leap program and redirected the output to store on the USB serial port file connected to the Arduino. The command that we used in the Mac terminal to make this happen is the following:
$ python car.py > /dev/tty.usbmodem1411
Note, your serial port name is probably different.
How it worked is that we ran the car.py program. While Leap Motion read the hand gestures, the program printed letters that were then written to the USB serial port file that was connected to the Arduino. The Arduino’s code continually read the serial port file for new information. When a letter showed up, the Arduino script would match it to a case and based on the called function, send directions to the servos on the Parallax shield; thus, making the car move.
Biggest Challenge – HC-05 Bluetooth
We tried to set up a Bluetooth connection with the Arduino vs. the USB cable that kept the car tethered to the Mac. Unfortunately the HC-05 chip we were using refused to read inputted data. It would pair with the computer and send output, but would not take input. We checked and rechecked many times the way the wires were setup. We tried a couple different HC-05 chips and different computers, but it just was not working for us. We fell back on the USB connection and thankfully we had one that was long enough. If anyone out there has heard of this issue and has ideas on how to fix it, please share.
Our team did such an amazing job figuring things out and making the product come together. Several of us were new to programming and some had never met before. There was a lot of collaboration as well as capability to work independently that helped get the project done.
Meggie worked hard on figuring out how to implement the accelerometer, and it was ready to add to the car. Unfortunately we ran out of time because we were down to the wire making the main Leap to Arduino connection work.
Kara and Chris dived deep into understanding Arduino C and with Rita’s help Kara was able to build out the code that ran the car. Kara did such a fantastic coding job with only a month of programming, and she rocked the demo, driving the car like a pro after only 30 minutes practice.
Kelley pulled together the Python code for the Leap and had that ready for us to run once we started working on the serial port connection. I had already put together the wheel kit, was helping to give team direction and spent a good deal of time working on Bluetooth as well as troubleshooting pulling the pieces together.
Still we wouldn’t have been successful without Rita. She helped us to really defined and led our system design, coached different members on how to build the code in C and figured out the serial port connection to finally make the car work. We also had some great mentorship help from Mark, Magee and Jeremy.
It was a great team. We had a lot of fun and learned a ton. The best part was having it actually work by demo time.
Next up, I need to figure out how to make it fly, talk and do facial recognition. Simple, right?
This post was originally posted at Melanie Warrick’s blog.
- Admissions Office (25)
- Alum (97)
- Blog (155)
- Career Services (26)
- Diversity (17)
- Engineering Advice (59)
- Hackbright Field Trips (24)
- Hackbright Mentors (21)
- Hackbright News (105)
- Podcast (2)
- Profiles of Woman Engineers (104)
- Recruiting & Hiring (15)
- Resources (44)
- Student Blogs (24)
- Tech (50)
- Thought Piece (20)
- Uncategorized (2)
- Video (20)