Tuesday, 27 September 2016

Code a Racer with Sam Labs

SAM Labs have launched their new kit called CURIOUS, which guides you along to make and programme your own racers. Over the summer we created a remote control racer, using LEGO and 4 SAM Lab blocks. This project has been a real joint effort with various members of Tracy and my families adding their skills to the project.

We will be sharing our project with you and looking closer at the new CURIOUS kit. Stayed tuned for more exciting news and projects from Tech Age Kids, by subscribing to our mailing list.

How we made our LEGO racer

The project was made in 3 stages. We used 1 DC motor block, 1 LED block and 2 button SAM blocks for the LEGO racer project.

Firstly we built the LEGO racer base. This was done by Tracy's engineer brother-in-law. We used the SAM block LEGO compatible connectors in the design, to secure the DC Motor SAM block and a LED SAM block onto the base. A bit of sticky tack is used to secure the DC motor to the LEGO disc.

Next the race was designed and built with LEGO. This was done by my middle son (8 yrs). He loves building with LEGO and has a big selection to choose from. I sent him away to design something that will look like a racer but also give us easy access to the SAM blocks for charging.

Finally we wanted to operate the LEGO racer using two SAM block buttons. The idea was that one button will make the racer move forward and the other will move it backwards. For this part, my teenager shared his coding skills to add custom code to the project program. He improved the idea, by changing the colour of the LED depending on the direction the racer was going.

As we only had one motor block, we couldn't change the direction our racer was going in. The video below shows the LEGO racer in action.

The Sam Labs Code for our racer

Coding with SAM Labs can be very simple, but sometimes the basic drag and drop functionality of the application requires custom code to achieve your goal.

In the case of the LEGO racer, we needed quite a bit of custom code to operate one DC motor with two different buttons and program the LED to turn green when going forwards and red when reversing.

See screenshots of our SAM Application Code and custom code.

Get Started with CURIOUS

SAM Labs have come a long way, from when they first launched, by making their kits accessible for families to get started more easily.

This new kit comes with 20+ starter projects to help you get started right away. The kit includes everything you need to make your first SAM Racer:

  • 6 SAM blocks - 1 button, 1 LED, 1 tilt sensor, 1 slider and 2 DC motors
  • a LEGO compatible base for the racer
  • a plastic housing which holds the button, tilt and slider blocks to make a controller
  • 2 wheels
  • micro USB cables for charging the SAM blocks.

The kit comes with several pre-cut cardboard templates, in lovely bright colours, to make the papercraft racer. As the base is LEGO compatible, you'd be able to design your own LEGO racer like we did above.

Once you've learnt how SAM Labs work and played around with the code, you can use the SAM blocks for other projects. We've done quite a few other projects and enjoy creating, inventing and making with SAM Labs.

The new CURIOUS kit, is available from Amazon.com or the SAM Labs online store in the UK.

More from Tech Age Kids:


Post a Comment