Thursday, February 19, 2015

Robot Club - fifth session completed

Full house this week.

Link to Fourth Session:

Full house and I  think everyone was ready for half-term.
A lot more boisterous and distracted than early on.

From the Preparing Blog post we were working with the line following sensor.

Line following sensor£1.195£5.95

The weekend before I did some work with this sensor and rather than reflecting different amounts of infra-red light depending on the colour of the surface it is more responsive to changes in effectiveness. So, a matt black surface to a shiny white surface gives the highest contrast and so gives the best reading.
The sensor also has a very limited analogue range and really is a digital switch. Meaning if the contrast is large enough it returns a HIGH signal.

With this knowledge we discussed inputs and how up until now we have only been doing outputs. Sending signals from the Arduino to the motors, with no information coming from the robot to the Arduino.  So, we have no idea if the robot is bumping into things.

Using the whiteboard we went through the operation of the sensor and how to wire it up. VCC, GND Out. We wired it to Digital Pin 2.

Modified the code to add a pinMode(2, INPUT) to the setup and an if statement in the loop() to read the pin and for this session using the Serial Monitor display a message on the computer.

It took a while to work through this as with 5 kits there was some fun with the wiring and understanding the change in the program.  

As mentioned before rather than just having the kids type in a piece of code I'm trying to worth through the logic with them so that the process is understand and not just have the ability to copy/paste.

By the end all 5 robots were reading the sensor from digital pin 2 and outputting a message to the Serial Monitor.

We now have a 3 week gap. 2 Mondays due to half-term and an inset day and I'm unavailable for the following Monday.

For the next session I will get all the code so far to the same place for each group and we will modify the code to make the robot turn around when it gets near an obstacle. It should be fun seeing 5 little robots running around the floor turning when they get near to obstacles. 

Wednesday, February 4, 2015

Robot Club - fourth session completed

Link to Preparing post details in the parts in the kits.:

Link to First session;

Note; I did not post for the second session. There is a short summary in the Third Session post.
Link to Third session:

This week we nearly had a full house.
Only 1 child missing due to illness.

The 4 who attended the previous week remember a lot of their work and code so were getting stuck into getting their robots to go around a corner.

I had a bit more fun getting drivers on enough school PCs to permit the Arduino Nano to be seen. It needs custom USB/Serial drivers that are not included by default.

The teacher who is ICT coordinator came in to see the session in full swing with robots spinning, or moving along the floor. With coding going on and due to plus and minus lines on the batteries being shorted a nice little display of black smoke and the lovely smell of burnt plastic.
No real harm done just a jumper wires plastic sleeving was melted.
I congratulated the child on making smoke as it's something we all do when we work with electronics.  They were kind of shocked.
It was great that the teacher had the same attitude so no harm done and no concern about burning down the school.
I tested their robot kit and Arduino. Nothing damaged, amazingly so did a little bit of rewiring and handed them back their robot to get working on again.

On of the kids who was in the previous session had a problem where their robot was pulling to the left.  These are small cheap kits so the motors aren't tuned and the wheels are small and have grip meaning they catch on the carpet.  Meaning they cannot reliably go straight.
We tried to fix it by turning the wheels in or our to change the resistance but no go so introduced that child to analogWrite.
A value of 235 seemed to make it all work perfectly. They had a nice straight running robot.

Once again the kids were not that eager to leave as they were perfecting their code and making it better.

At the end one of the girls who was being collected wanted to show her mother what she had done so she gave a great demonstration of her robot.  Holding down reset to stop it moving.
Set it up and let it go. She then explained the code she had made as well as giving details on some of the other parts we will be using.

Next week we will be using an input device. A small line following sensor. I will mark the edge of the room area with white paper providing a contrast with the blue flooring. The idea will be to detect the paper and make the robot turn.
This will be the first time the kids do inputs and will also require the introduction of the 'if' statement.

Looking forward to another productive session next Monday.