The Laser Range Finder – Beta Testing

I was fortunate enough to be selected as a beta tester for Joe Grand’s latest invention for Parallax, the Laser Range Finder Module.
Below you will find a link to the Arduino code I used.

The module consist of a red laser and a very small camera. It emits a pulse, grabs a frame and calculates the distance to the reflected laser dot. It has four interface pins. Power, ground and two serial communication lines. Sending the command ‘R’ will tell the module to take a reading and send the data back.

I decided to test mine on an Arduino and build a setup that could be mounted to the back of my vehicle as a backup proximity warning device. Something that would readout the distance on a dash mounted LCD and sound an audible warning below a given threshold. I had a 16 x 4 reflective LCD on hand from Element 14 that I needed to review anyway so I used that as my readout display. I got some help with the Arduino code from my friend Roy Eltham. He was a great help in this project so here’s a shout out to Roy! “Thank You!”

Breadboarding the project took a couple hours and after uploading and tweaking some code, it worked! I could get readings as close as 150 mm and as far as 2.4 meters! It was time to put it all in some enclosures. I found two plastic projects boxes at Radio Shack that suited my needs and set to work. After about 8 hours of build time over two evenings it was complete. The Laser Range Finder (LRF) was in one box and the Arduino and LCD were in another, The two were linked via a length of twisted pair CAT5 cable. I hardwired to the LRF and put an RJ-45 connector on the main display box. With the help of some 3m two sided mounting tape I attached everything to the vehicle and I was ready to test!

The first thing I tried was backing up to my white garage door. It was mid day so it was very bright outside. This would be a good test of blob detection. The bright light would make it more difficult to find the bright spot from the laser. This was a beta test after all. Why not test the boundaries. I started out about one meter from the door, turned the unit on and got a reading of 0000 which meant that it couldn’t find the blob. So, I slowly backed up and at 547mm it showed a reading. It was evident that the bright light was hindering blob detection.

So, what to do? I remembered from my photo experience that a filter might help. Since the laser is emitting red light, how about a red filter? The camera would see everything in shades of red and the laser dot just might stand out as the brightest. I had covered the LRF box with a piece of clear acrylic. I removed it and with a red Sharpie marker, colored both sides red on the half that covered the camera and left the laser side clear. I installed the acrylic and went back to testing. I started out at about one meter again, turned the unit on and YES! I had a reading! The red filter worked. I slowly moved the car forward and I was able to get distance readings all the way out to 2.3 meters. Success!! The LRF also has a command to adjust the exposure to current lighting conditions. This is done by sending ‘E’ to the LRF. I implemented this in the code and it also helped with blob detection outdoors.

This is a great piece of hardware. Joe really did his homework on this one, and it will only get better before final release in the next month or two on the Parallax website. I can see this being used on robots as a distance sensor, which a few beta testers have indeed done. I plan on using it on another robot project in the near future as a forward looking edge sensor.

Great job Joe Grand! Thanks for letting me beta test!

Keep On Hackin…

Click here for the Arduino code

The All Terrain Robot from Roomba parts

Roombas! What a cool robot! They work quite well right up until the wheel encoder sensors get dirty, then they drive around in circles. Poor robot… then they get cast aside as being “glitched”.

Well, they’re usually ok and just need a good cleaning. I’ve posted a couple of videos on that subject on my other youtube channel.
Roomba teardown part one
Roomba Teardown part two

You can find Roombas on ebay pretty cheap. They’re a great source of parts to build your own robots from. The motors have a lot of torque thanks to a well engineered planetary gear transmission and as mentioned, they even have wheel rotation encoders. The main board has two H-bridges that can be used by simply tapping into the switching transistors with a PWM signal from your favorite micro controller.

I first built a four wheeled rocker bogie suspension equipped rover robot last year and posted a video of it on This week, I’ve revisited that robot and made a few mods. It now has an all aluminum chassis and two heim joints on the cross link of the suspension. I took this to Maker Faire North Carolina this weekend and it performed quite well.

So here’s this week’s hack video. Get on ebay and find yourself a Roomba to hack!

Keep On Hackin!

The WALL-E Robot

A few weeks ago I found a WALL-E toy robot at a yard sale for $1. I bought it thinking it would be cool to put a couple motors and a micro controller in it to create a cute little autonomous robot.

The first challenge was finding a couple of motors that I could hack into it. I had some motors, with gear reduction built in, left over from some Rumble Robots. After a couple hours of hardware hacking, I managed to get them installed driving the two separate tracks. Next I need some sensors and what better place to put them than in those cute little binocular eyes WALL-E has! I figured that a Parallax PING ultrasonic sensor would work so I removed the sensor drivers from the PCB and installed them in the eyes. I used the existing wires that were there for the LEDs to get the signal down to the body where I connected them to the PBC. Unfortunately, in the process of removing the drivers I damaged the PCB. My solution was to solder the wires to another PING sensor and then block the signal from their on board drivers by mounting it against a wall inside the body. It worked! Problem solved. It now had motors and a sensor.

Next came the H-bridge that was required to drive the motors. I decided to build one myself with some transistors I had salvaged from a Roomba Robot main board. I bread boarded the circuit up and it worked first try! Great! Then I transferred the whole circuit to a perfboard and it also worked! Now I had a way to drive the motors. Next came the installation of the micro controller. I connected the Arduino and the H-bridge to the motors and wired everything up. After uploading some code I gave it a test on the bench and it worked fine. Now all I had to do was finish putting the battery and everything inside the body and I would be finished.

Enter the Gremlins…..
For reasons I could not figure out, the H-bridge failed. It had one set of transistors that simply refused to work. This meant that one of my motors would not run in reverse. After a few hours of troubleshooting I gave it up and called it a day… 11 hours at the bench is enough!

The next morning I looked over the H-bridge some more. I replaced a few transistors but it still refused to work. OK, time for plan B. In true hardware hacker form, I made a trip to the Dollar Store in search of some kind of RC toy that had motors that went forward and reverse. Why? Because inside that toy would be an H-bridge to hack into my robot! Well I scored two RC cars for $5 each. Perfect! I brought them home and opened them up. Sure enough, there were my hackable H-bridges. After a bit more hardware hacking I had them installed. That took care of that Gremlin!

Oh but there’s always another Gremlin… they come in pairs I think.
My motors weren’t spinning up right. They would start to spin then stop. Very odd. As I was working this problem I was on an IRC chat on Savage Circuits and a buddy there, Roy Eltham, reminded me that I needed to give the motors their own power supply separate from the Arduino. DUH! I was so frazzled at this point in the build that I didn’t even think of this very obvious fact! So I added another 9v battery. Now the motors had one and the Arduino had one. Success!! It finally worked!!

Thanks for the reminder Roy. 🙂

This project took a lot longer than I EVER had estimated!! Thanks to the Gremlins it was the first one since I’ve been doing a Hack A Week that went past my deadline by two full days! In the end, I learned a thing or two and made it all work.

Enjoy the video, and Keep On Hackin!

The Photophone

In Februrary of 1880, Alexander Graham Bell and his assistant Charles Sumner Tainter invented a device that allowed the transmission of sound via a beam of light. It was called the Photophone. Bell believed the Photophone was his most important invention! Indeed, 100 years later in the 1980s fiber optics came into widespread use. It is noted on a plaque that on June 3rd, 1880 the first wireless transmission of a telephone message using the Photophone took place. This year marks the 131st anniversary of this event.

Bell’s Photophone used crystalline selenium cells at the focal point of its parabolic receiver. My version uses a solar cell as the receiver. The transmitter is a mirror attached to a speaker aimed at the solar cell. The mirror is aligned so that it reflects the Suns rays onto the solar cell. The solar cell is mounted at one end of a black 4″ ABS pipe about 2 feet long. The light reflecting off the mirror is modulated by the vibrating speaker. The Solar cell receives this modulated wave of light and outputs a corresponding modulated voltage that can be fed into an amplifier and output through a speaker to produce audio. A 0.1 uF capacitor is connected in series between the solar panel and the amp.

The whole project is quite simple and fun to build. Enjoy the video and.. as always, Keep On Hackin!