Planet Rockalypse Rotating Header Image

Two Motors, One Shield

The Adafruit Motor Shield arrived in the mail last week and this week I built it. The shield allows one to control more than one motor at a time using h-bridges. This shield can allow up to 4 DC motors or 2 stepper motors, and two servos. I had already helped build an Adafruit Wave Shield with my brother last year, so I was aware of how Adafruit electronics operated. After a few tests, I was soldering quite well and didn’t burn anything!

Adafruit Motor Shield on Arduino Mega 2560

My favorite thing about this shield once I started testing with it is the small, green LED which lights up when the shield is getting power. Therefore, I know when it’s not getting electricity and when my code is just messed up. To test the shield, I hooked up my old RC car, just in case I did something incorrectly. I didn’t want to burn my new motors this quickly. Below is a quick video showing all the wheels of the car turning back and forth, rather than one at a time in only one direction as it did before.

lofi hardware, delivered

A few weeks back, I wrote about my attempt to translate a low-fidelity circuit board design into something that could be run through a laser cutter. Today, Ponoko delivered the results:

You can click through to a large, high resolution image. In a word, it came out beautifully.

I do work surrounding the use of parallel languages in embedded applications. This summer, along with two students, we began work on a novel control system for an unmanned aircraft (a UAV), and managed to achieve autonomous level flight. Last term, Rich Bowden (Environmental Science) asked me if we could do a sensing project in Environmental Research Methods. During the break, I developed a board, built some prototypes, and wrote the control control code. I’m now developing the documentation (video coming soon!) for students, so they can assemble circuits and deploy their sensors to collect data. It’s exactly the kind of cross-disciplinary opportunity that we want to create. (Next time, we’ll get CS students involved early, and they can help develop the control code, and possibly even the board design.)

Sadly, we won’t be using these laser cut boards for this project; instead, the students will be poking holes in manila folders, and it should go well enough. Why not? First, the lead time was several weeks – it takes too long to send out for the boards to use in any “impromptu” manner in a classroom or research setting. Second, Ponoko charged me $21 for that board.

How is this a $21 piece of cardboard? The laser time cost $2/minute, and this design took just over 5 minutes to engrave and cut. The shipping was a flat rate of around $8. And, the cardboard… $0.41. It was worth it for a prototype, because I know that a laser cutter will meet real needs, and have high utility in multiple educational and outreach contexts.

I have students prototyping sensors as part of their senior projects, building robots as independent studies, core research that involves prototyping and construction, and I’d love to be doing more tangible, computational work across disciplines (eg. with colleagues in Art, Environmental Science, and so on). I’d go broke trying to do this via a service like Ponoko, and the turn-around (for prototyping and exploration) would kill me. Waiting three weeks for a design to come back means that, if you’re lucky, you can do two design iterations (maybe three) in a semester.

Hence, we’re going to try and get a laser cutter. $20,000 is my round-numbers target for a laser with a 2′ by 4′ bed. At the rates Ponoko is charging, it will pay for itself after 10,000 minutes of usage. We have excellent connections into the community (schools, etc.), and I think it will be easy to run this printer for all kinds of awesome projects that let teachers and students at the College and from area schools come together to explore the intersection of computer science and manufacturing.

Styrofoam Environment

This week I completed my arena that I will use to test our robot. First, I was going to set up the arena in the hall of our CS department, but have it be collapsable so I could put it away and take it out only when I needed it.

This was ultimately not used.

Professor Jadud and I decided that that was a pain in the rear.  It would be so much easier to be able to keep the arena set up throughout the testing.  So, we rearranged a room in the department and were barely able to fit the arena in that room and still have space to walk around it.  It really was the best choice.  So, I set up the arena in the room and it is ready to rock.  Now we’re waiting on the parts to our main robot.  They have been ordered and should be on their way.

The black on the floor signifies what parts of the arena on competition day that will not be carpeted.

In Which I Show I’m Not An Artist

RC car robots are fine and all but we finally put together our idea for the final product. We decided to keep it pretty simple. Such as, rather than try to build our own h-bridges, we realized that an Arduino motor shield would allow us to run several motors from the Arduino. We decided we needed one which would be able to run 4 things: the two motors for the wheels, the servo which will oscillate our fan, and the fan itself. We went with a two wheel/caster design because 4 wheels would create unnecessary problems.

To the left is my wonderful concept drawing of our robot. You cannot tell very well from the picture, but the base plates are round. This is to prevent our robot from accidentally getting stuck in a corner. The bottom plate houses the Arduino and the motor shield. All motors/servo is connected to the shield through wire. Batteries to power both the shield and Arduino will also be on this level.

Attached to small risers, another plate creates a second deck which the fan and sensors are attached to. Right now we have 5 flame and 5 distance sensors which will be placed around the edges of the top plate. In the center, a servo oscillates a small fan which is used to put the candle out. We know that we could get more points for using water, other gases, etc to extinguish the flame, but for now our priorities are in getting it to run.

I’ve received the shipping notifications for all of the parts, so those should be here soon. Both of us are excited about getting started with these new pieces.

semester two begins

Design in Theory and Practice
And so we begin. Again.

Last semester, we didn’t know each-other, and were unsure as to where we would go. Our explorations took us through some basic electronics, with the goal of controlling motors and managing sensors. We did well, and now it is time to start bringing the pieces together.

Our last blocker was the H-bridge: controlling a motor so that it will spin either forward or backward. This challenge needs to be knocked down quickly so that we can move on to the tasks that remain. In no particular order:

  • Design a platform. We know that the hacked $7 R/C cars won’t cut it. They don’t steer well enough to navigate the competition space, so we’re going to have to come up with something else.
  • Choose sensors. What do we use? A temperature probe on a stick would work, but it has to be in the flame to detect the candle. So, we need something more effective.
  • Develop code. This is the tricky part, and will likely be more challenging than we expect. We have to navigate around the space without getting stuck and not constantly backtracking where we’ve already been while simultaneously spotting and ultimately putting out the fire.

This is all tricky stuff, and often the most challenging part of any engineering endeavor is bringing all of the pieces together. In this case, we have a platform design, sensor integration, and control code to unify in three months. There’s enough time there to do well with the competition, but we’ll need to focus and, most likely, up the level of communication.

That, at least, is how I see it. This is the exciting part of the project—we’ve been working on low-level details that all clearly contribute to the whole, and those details mattered a great deal. Now, though, we get to think a bit bigger, and bring all the pieces together.

Very, very exciting.

Pink Everywhere!

Before school let out for the winter break, Molly and I tried to make our robots move in more than one direction using an H-bridge. It appears that the H-bridges we have do not work very well for the Arduino and thus, our poor robots are still only allowed to move one way. However, I was able to attach a range finer I had from a previous project which allowed for me to program my robot to stop when it encountered an obstacle. I took this device off while running tests with the H-bridge, so I will need to wire it back in before I can take video.

My building materials shopping trip went much easier than Molly’s (What’s snow?), and with a little help from my brother who offered to cut the pieces after I measured them, I was able to construct an obstacle course for my robot.

Rescue Obstacle Course1

Rescue Obstacle Coruse2
It’s not pretty, not done yet, and I need to shorten a few pieces, but it’s progress. It is put together using velcro so it can easily be taken apart and put away. Now I just need my robot to maneuver through it!

Materials bought.

I went to the Valu Home Center and bought many sheets of styrofoam board in order to build the environment. I also bought a dowel rod to make furniture. I got white tape to mark where the doorways are in the environment. I had a heck of a time getting the styrofoam board back to school with me. The nice checkout man helped me carry the board to my car. I mentioned that I thought I had ratchet straps in the back of my truck. He said he thought that using them was a good idea, then quickly ran inside. It was the coldest night of the year thus far. I tried to get the ratchet straps on, but I couldn’t figure out how they worked. I didn’t have gloves either, so my hands were freezing. Tears were shed out of frustration. With a few phonecalls, I got the ratchet straps undone and on my boards. I slowly crept back to school.
After all this, I have the materials I need to begin building the environment.

Yay for Robots Moving!

I finally got all the bugs worked out of my R/C car chassis setup and it moves!
I played around a little bit with the Plumbing code, but it’s still not working when the button is pressed.
I received a Sharp GP2D120X infrared distance sensor. I rigged it up to my Freeduino and it can tell me how far away my hand is from it. This particular sensor has a range of 4 cm to 30 cm, so when my hand is really close or farther than 30 cm away, it gives outrageously wrong distances. But, for the distances that it is meant for, it seams really accurate. I found this really great website that has a lot of information about this family of sensors. You can find that site here.  It tells that a downside to these sensors is that they can interfere with each other’s readings if their reading paths cross.  The site also shows how you can organize your sensors on your robot to avoid interference.  These sensors seem to be just what we’re looking for for our competition robot.  I’m really excited to continue to explore with them and to keep the R/C chassis from smashing into walls using them.

Arduino Uno Support!!!

After having had an Arduino Uno sitting on my desk happily accepting programs from my development build of the Transterpreter, I thought it was finally time to get the binaries with Arduino Uno released into the wild.

Knight Rider on the Arduino Uno - concurrency.cc from clj on Vimeo.

Quick demo showing a concurrent program running on the Arduino Uno doin' Knight Rider like awesomeness...

The reason that getting the binaries out took so long is that various other bits have gotten in the way. Changes were required to be able to build 32 bit versions of the tools on Snow Leopard; the website has moved to a new host; the Sparkle feed infrastructure (for the Mac) has been updated to include a changelog; and building software on Windows is just never fun.

But now the Arduino Uno support is finally here. Mac OS X and Windows versions should update themselves, otherwise you can download the packages from the download page. The Ubuntu packages have not yet been updated, but this should happen at some point in the future (pester Matt about this). Any problems with the packages should be reported on one of the mailing lists.


Arduino Uno support is available starting with these versions of the Transterpreter:

  • Mac OS X 20101103.1423 (dev)
  • Windows 20101104.0001 (dev)

Plumbing Lessons

Earlier this week I was able to get a lesson in the Plumbing language from Dr. Jadud. I had been having difficulties in translating my C program for my light sensitive RC car into a Plumbing program. I learned much about signals; I had the light level function reading a signal that came from nowhere. I learned about creating new procedures, sending and listening to channels, and about the differences between VCC(internal) and AREF(external) voltage references. (VCC is the voltage for the Arduino – 5 volts and AREF can be a voltage you supply when some component needs a special voltage).

At the end of the lesson my car was still acting a little weird, but afterward I was able to edit the coding in order to work. Before I fixed it, it was basically working backwards – moving fast in the dark and slow in the light. The photo resistor senses light: in high light it outputs a low resistance value and in low lights outputs a high resistance value. The Arduino doesn’t sense resistance, but voltage, so when we set up a voltage divider to change resistance to voltage to supply the motor, we must ‘swap’ the values. The low resistance reading for high light gets mapped to a low voltage, and vice versa for the low light. Thus, to change the values to do what we wish, I just added a line that reassigned my voltage to be 255 minus my current voltage.

Next I set about adding in a line of code to include a start button. I’m not sure what is wrong, but it is not working, and I only changed one line of code, so I’m a little frustrated. To solve my problem earlier of not having a signal to send to the function reading the light level, we created a new function to send a signal. So, instead of using this simple function to send a signal, I changed the line to use the button.press function. This function is suppose to detect whether a button on a certain pin is pressed, and when it is, send a signal. Therefore, I thought I could just have the button signal tell the light level function to take a reading. I will have to keep working on this so I can become faster at coding in Plumbing.