Monday, 8 February 2016

Roby the Robot Dog gets an LED Dog Tag


Roby the Robot Dog is my 7 year old son's ongoing project. It started as a labelled diagram and has turned into a family project to make as much of it reality as possible.

Roby now has a programmable dog tag with 4 RBG LEDs which can be controlled individually to create cool patterns.

You can catch up with the Roby story in these posts:

Roby's Dog Tag - Hardware

In the original design Roby had an LED collar. We might add that at some point, but we decided that a dog tag would be a good start as we already had the components we needed. Roby's dog tag is a MakeBlock RBG LED module which was included in the servo extension pack.

This add-on module can be plugged in to a spare port on mBot and provides attachments points for screwing it on to mBot metal brackets. We actually attached it to Meccano parts of Roby.



mBlock Scratch Coding

Programming the LED module is straightforward. You just specify the port the module is connected to and which of the four (labelled) LEDs you want to address. The colour is set using RGB values which kids get the hang of pretty easily. It's really quick to just try different colour combinations with mBot because there's no compile, upload cycle, changes are instant. Time delays are created using the Scratch 'wait' command which my son is used to using.

Roby's Moods

You can address all four LEDs at once in a single command if you want to which is really convenient. My son uses this for Roby's different moods. E.g. Red for angry, Green for happy. At the moment these are controlled using by key presses but eventually they could be triggered as a response to specific situations.

You can put Roby into Happy mode with the 'h' key. The 'z' for sleep turns the LEDs off. 'a' puts Roby into angry mode but only for a few seconds - she doesn't stay angry for long. Tail-wagging can easily be included in the moods too.

Roby's Moods in mBlock Scratch code
We used events so that the moods can be triggered actions other than key presses. A great way to understand decoupling!

LED Patterns

mBlock Scratch setting individual LEDs
You can address Roby's LEDs individually which is great for creating cool patterns.

The LEDs are numbered from 1 to 4 and these numbers appear on the actual physical LED board so it's really easy for kids to understand how to address them.

We created a swirl pattern where the LEDs light up in turn.

There's so much scope for coding cool patterns with the LED dog tag.

Roby's LED dog tag in action:

Colours!

The four LEDs in the dog tag are full RGB leds so you can set red, green and blue to values from 0 to 255. This means you can choose from loads of colours!

To demonstrate this we've created a custom block that chooses random colours. The colours are really bright and Roby's dog tag lights up the floor in front of her. 

mBlock Scratch LED colours!

Overview

The more we use mBot the more impressed we are with its versatility. It's brilliant to have lots of things on the main board and still be able to easily connect lots more. The components MakeBlock have provided are perfect for children, mine always want lots of movement, light and sound in their projects.

With earlier versions of the mBlock software we had some teething troubles but there have been regular updates and everything is much smoother now.

The LED add-on for mBot has been a great addition. It came in a pack when we bought a servo so we didn't specifically choose to buy it. However, it was just right for creating Roby a very cool dog tag. The LEDs are really bright and light up the floor around the robot.

You can also control the built-in LEDs on the body of mBot in a similar way so Roby has plenty of lights! This means that even without the extra LED add-on you still have two RGB LEDs that you can address individually on the main mBot board.

In the next Roby post she will get a speaker so she can bark. You can subscribe to the Tech Age Kids mailing list to see future Roby updates.


Read next: mBot Robot Review




More from Tech Age Kids:

Comments:

Post a Comment