This week, we are serving up part five in our series where we are using the Pololu 3pi robot as a fancy development board for the ATmega328p processor. This week we are taking a quick break from working with the perpherals specific to the processor and will show how to work with the 3pi’s line sensors. A quick look at the schematic for the 3pi might lead you to think that you should be reading the line sensors with the A2D peripheral. Even though they are wired to the A2D pins, they need to be read digitally. In the video, [Jack] will show how to read raw values from the sensors and then how to calibrate the results so that you can get a nice clean 8-bit value representing what the sensors are seeing. Of course, that would happen under normal circumstances. Murphy had his way in this video and it turned out that our studio lighting was interfering a bit with the sensor readings when we were shooting so we didn’t get as good of a calibration as we would have liked when we shot.
Video is after the break.
In case you have missed the previous videos here are some links:
Part 1: Setting up the development environment
Part 2: Basic I/O
Part 3: Pulse Width Modulation
Part 4: Analog to Digital conversion
Thanks for the vid. Those 3pi robots are a great piece of work, i love using them.
My only complaint is that lack of onboard FTDI/USB means newbs have to buy a dedicated programmer and hack the arduino ide, which is a pain.
Wolverine
Is there a reason you chose not to use the bool type for ScaleOutput since it seems like its only going to ever be a 0 or 1. I know its on topic but Im just learning C and was wondering what the reasoning was.
Answered my own question, Bool isnt regarded as an acceptable type in C apparently. Seems a shame to have 2-bytes of memory where 1 bit will do.