Thursday, March 19, 2015

16x16 LED with Arduino

I think I've mentioned before I have a bit of an eBay habit.  Searching for random electronics parts that can work with Arduino or Raspberry Pi.

On one of these eBay trawls I cam across the following 16x16 LED display.  It's really 4 8x8 LED displays on a single board with what look like electronics to make it easy to control.
Looking at it I kind of thought this should be easy to get working so put down my 

When I finally got around to plugging it in I did the obvious and searched online to see if someone with more electronics and computing ability had played with the 16x16 already and worked it out.
To my pleasure and delight I came across the following page with schematic, datasheets and Arduino sample code.

I wired up the display as directed and uploaded the sketches provided and it worked first time.
The demo code had comments not in English and even then there were very few comments so I kind of figured out that the data for the pixels was held in an array of 32 Bytes. (32 x 8 = 16 x 16, so a Bit for each dot)

The one thing I couldn't figure out from the data was what order the data had to entered into the array in and thought to move this forward I'd figure out the order of the data.
First thing I found was that a 0 in the bit turned the pixel on, so the image is reversed.
Then by putting B11111111 in each position one after another I figured out the order.


Best way to think of it is 
Row 1 / Columns 1-8
Row 2 / Columns 1-8
Row 3 / Columns 1-8
Row 4 / Columns 1-8
Row 5 / Columns 1-8
Row 6 / Columns 1-8
Row 7 / Columns 1-8
Row 8 / Columns 1-8
Row 9 / Columns 1-8
Row 10 / Columns 1-8
Row 11 / Columns 1-8
Row 12 / Columns 1-8
Row 13 / Columns 1-8
Row 14 / Columns 1-8
Row 15 / Columns 1-8
Row 16 / Columns 1-8
Row 1 / Columns 9-16
Row 2 / Columns 9-16
Row 3 / Columns 9-16
Row 4 / Columns 9-16
Row 5 / Columns 9-16
Row 6 / Columns 9-16
Row 7 / Columns 9-16
Row 8 / Columns 9-16
Row 9 / Columns 9-16
Row 10 / Columns 9-16
Row 11 / Columns 9-16
Row 12 / Columns 9-16
Row 13 / Columns 9-16
Row 14 / Columns 9-16
Row 15 / Columns 9-16
Row 16 / Columns 9-16

And just to show I managed to get something displayed here is one I made earlier.

More playing to be done now I can get an image on the display.

Robot Club (I can't remember which one this is)

It's coming to an end.
We did the penultimate robot club session this week.
Seven from ten made it this week. I believe one decided it wasn't for them while two others had other things on.

This week we got the 4 teams robots all working and also turning when they came near to the walls. A couple of teams really got it and were adapting their code to make their robots do interesting things when it was near the wall.  While the other 2 needed to back over the concept of variables and conditional statements.

For the teams that were racing ahead they spend time working on putting a body on their robots.  I spoke to the ICT Co-ordinator and they were going to arrange for the kids to have assembly time to do the body and make their robots unique.  Looking forward to seeing what the the robots look like on Monday.

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.