Thursday 8 October 2015

ElMo - now we're moving

On Friday we took full advantage of a school inset day and cracked on with building ElMo - now the motors were soldered into place, the rest was pretty straightforward.
We powered up... and then wrestled with the PS3 controller for quite a while - it just wouldn't connect first time, but after randomly connecting via a cable and disconnecting again, we finally got the two paired and were able to run the example script that we downloaded from the piborg website.  Behold, a moving robot :)


After playing with our new toy for a while it was time to add some more hardware.  We were planning to incorporate a number of individual IR sensors for line following, but a recent MagPi article mentioned a 3 way sensor from Ryanteck, so we sent for one of those.  We cut some Vex aluminium to mount it
The line follower has 5 pins (Vin, 3 sensor outputs and Gnd).  At this point we realised we had no female/female jumper wires (some arrived today from robotshop), but we cobbled something together via a breadboard.  

The way the pi gpio pins are laid out we can attach 3.3v from pin 17, use pins  19, 21 and 23 for sensor inputs and pin 25 for ground - all in a neat row.  Note those are the physical pin numbers - the sensors are actually connected to GPIO10, GPIO09 and GPIO11

Once we power up, there are 3 leds on the top of the line follower board that go out to show when a line is detected, which is very useful.  There is also a variable resistor that can be used to adjust the sensitivity - keep turning until a black surface turns off the LED.  One of the sensors seems to be a bit more sensitive than the others - it might be a tiny bit too close to the ground?  So we may eventually swap this unit out for 3 separate detectors which each have their own variable resistor to adjust the sensitivity - definitely more testing required.  I'll post (and maybe talk through) the code another time, but we did get it working - like I say, it feels like we need to tweak things a bit, but overall we made good progress :)


Next time we will be adding some ultrasonic sensors to the front and thinking about attaching the cannon

No comments:

Post a Comment