Showing posts with label Arduino Uno with S4A. Show all posts
Showing posts with label Arduino Uno with S4A. Show all posts

Saturday, August 22, 2015

Blink 2 - An S4A (Scratch for Arduino) Project using a Breadboard & an LED

This is version 2 of Blink, where we shall see how to use a solderless breadboard to connect an LED to the Arduino. Learning to use breadboards is very fundamental to building circuits. The S4A (Scratch for Arduino) code we shall use here is exactly the same as in the previous Blink project. And the exact same blink functionality for the LED will be developed, but using a different wiring this time involving a breadboard.

Why use a breadboard? A breadboard is a quick, easy way to prototype a circuit. It allows you to experiment with electronic circuits, build and test them without any soldering. It can be used to build the simplest of circuits to very complex ones. You can read more about breadboards here and here.

Back to Blink2... We shall connect the LED to Pin 13, just as we did in Blink version 1. The S4A code for blinking the LED turns it on and off, with an interval of 1 second, to provide the blinking effect.















Here's the wiring we shall use for Blink2 with the above S4A code:





























As you can see from the image, the LED is placed on the breadboard this time, rather than connected directly to the board as in Blink version 1. We use a resistor to connect the positive leg to Pin 13. The negative leg is connected to the GND (Ground) via a jumper wire. (Both jumper wires and resistors come as part of the Arduino kit. You can also buy them in bulk at stores such as Fry's, RadioShack, Amazon, etc.)

Here, we take advantage of the fact that all the components in a row on either side of the ravine on a breadboard are electrically connected. We connect one leg of the resistor to the same row as the positive leg of the LED, and connect the other leg of the resistor to Pin 13. The resistor is used to limit the electric current flowing in to the LED, and to ensure that the LED does not burn out due to direct power from the Arduino. The jumper wire from the Arduino GND (Ground) is connected to the same row as the negative leg of the LED, to complete the circuit. The electric current will flow in to the LED from Pin 13 through the resistor and flow out to the GND (Ground), thus completing the circuit.

Now, click on the green flag on the S4A screen and watch the LED blink...























Friday, July 31, 2015

An Introduction to Arduino & S4A (Scratch for Arduino)

Arduino is a very popular hardware platform with makers & hobbyists. The microcontroller board provides sensors and actuators that allow for interaction with the physical world. The official website for Arduino (arduino.cc) defines it as:
Arduino is an open-source prototyping platform based on easy-to-use hardware and software. It's intended for anyone making interactive projects. Arduino boards are able to read inputs - light on a sensor, a finger on a button, or a Twitter message - and turn it into an output - activating a motor, turning on an LED, publishing something online. All this is defined by a set of instructions programmed through the Arduino Software (IDE)
A more detailed explanation of "What is Arduino?" can be found on the Arduino Intro page.

Personally, I find Arduino to be a very versatile platform, that provides the opportunity for children to unleash their creativity. It would also allow for the development of interdisciplinary projects. While designing projects for children, I am always on the lookout for platforms that allow for the development of problem solving skills, logical analysis and thinking-outside-the-box, without getting trapped in the intricacies of the platform itself. I was thrilled by the opportunities that Arduino could provide, but was really skeptical about using its IDE for younger students.

A program or code written for Arduino is called a "sketch". Arduino programs are usually written in C or C++.  However, these languages are too complex for the younger kids to master and use. Hence, I did my bit of research and came across S4A - Scratch for Arduino. Developed by Citilab, a group in Spain, it is an improvised version of Scratch from MIT, with instructions that can be used to control the Arduino hardware. Here was the perfect solution to my dilemma: My students are already familiar with Scratch and absolutely love working with it; all they need to do is familiarize themseves with the extra set of instructions for the hardware. The instructions, written in plain English, are simple enough for the kids to understand and are very intuitive to use. It would open up the Arduino platform for them, without getting tangled in the intricacies of the syntax and grammar of a formal programming language.

The S4A site provides instructions on the download and installation; and frankly, it's quite a simple process. The main difference from the online Scratch is that you need to download and install S4A on your machine. And you are not allowed to share the S4A projects on the Scratch community website. The Arduino board is represented as a Sprite on this version of Scratch, and you have access to blocks that can perform digital/analog reads and writes, as well as blocks that can control motors. S4A is compatible with a few versions of Arduino, but I'll be primarily working with the Arduino Uno. Unless specifically mentioned, all references to Arduino in this blog will default to the Uno.

In the upcoming weeks, I'll be posting a few projects for Arduino, using S4A as the IDE.