Happy Bear Software

Let's Get Physical - Arduino Workshop

She Codes Brighton is a social meet up group for female developers co-organised by Happy Bear Software developer Rosa (me) along with Wendy Armstrong and Seren Matthews. In September 2015 She Codes held an event under the umbrella of The Brighton Digital Festival.

Entering it's 5th year, the Brighton Digital festival aggregated more than 140 events across the course of September. The festival makes for a great opportunity to meet like minded people and delve into something new, as there are multiple events held every night across the city.

In discussing ideas for our event, She Codes members expressed that they wanted to learn hardware skills to couple with their coding knowledge. Having an understanding of how to build projects with hardware would mean that we could move away from creating interactions solely on a screen which would open up new development possibilities.

The Internet of Things

As much as it might feel like an irritating buzzword ‘The Internet of Things’ is becoming increasingly difficult to ignore. The Internet of Things is a vision of technology slithering into our lives in a way that lets us interact with day to day objects for greater convenience.

The idea is to inject physical objects with digital behaviours; from Amazon Dash buttons attached to our cupboards to send more powder when supplies are diminishing, to sensors built into parking spaces to prevent us circling the car park over and over again.

Coupling physical interactions with digital APIs opens up the imagination to a new world of possibilities. There is of course a downside - technology breaks often and the more dependent we become on it, the more stuck we become when it doesn’t work. Cybercrime is also a problem. People may find discomfort in corporations knowing more about their day to day interactions - there is little control over whether these companies are using their information for the greater good.

It is an exciting area with a lot of potential. To start exploring we opted to focus the workshop on learning to use Arduino.

What is an Arduino?

Aruduino is comprised of easy to use hardware and software. It can be used to read inputs such as light or temperature (picked up by sensors) or a even things like tweets. An output is then generated from the input.

I had used Arduino a while ago but now I wanted to try to build something more advanced. I could follow a diagram and get something to happen but I wasn’t sure why it was working. I was just copying, which isn’t useful for debugging if something does go wrong. In this workshop we wanted to make sure we discussed each part of the process in some depth rather than focusing on building something more impressive but not really understanding the components.

Alex Hosford, a director at Build Brighton joined us for the workshop and helped to put together the material. Build Brighton is a communal workshop and collective of over 100 makers, designers, tinkerers, hobbyists, engineers, artists and hackers who love to build stuff. They have loads of awesome equipment and an open evening every Thursday to drop in if you are interested in finding out more.

Remy Sharp, founder of Leftlogic kindly donated 9 Arduinos and lots of wires and components to She Codes and Codebar. This was a great help and we used them all on the night.

The Maker Movement

We began the workshop by discussing the ‘Maker Movement’.

The Maker Movement is the collection of millions of people with a shared interested in making their own projects or products. Thanks to the affordability and availability of equipment such as Arduino or 3D printers, people are able to manufacture and sell their own products. This diminishes the need for external manufacturing. As this notion increases it is set to have an impact on the economy in a way that may shift the powers back from large retailers to smaller independent companies.

This becomes even more interesting if we consider that people could one day generate their own energy and free themselves from contracts with corporate energy suppliers. Grace Choi the CEO of Mink is developing a product that people can use to 3D print make up. Instead of buying a new lipstick from a store, a person could choose any colour and print their own. This(and similar use cases) would have a huge impact on the economy and is likely to mean that large corporations will need to apply greater focus to factors such as their energy impact, customer relations and promoting social justice in order for people to opt to use their products.

To begin the She Codes workshop we watched a section of this TED talk by Massimo Banzi a co-founder of Arudino. He speaks about interesting projects that people have built using Arduino. These ranged from a fun project to silence a TV when the names of certain TV Personalities are mentioned, to a start up that have built a business using an Arduino based robot to fly medical supplies between remote villages in Africa. He also mentioned a group of people in Japan who wanted to provide unbiased data as they felt they could not trust government information. They created Geiger counters (an instrument used for measuring ionising radiation) and posted the data online for the public to view.

A key take away from this video is that Arduino is completely open source. This is so that people can better understand how the hardware works and can make and share any changes. The software is also open source. The source code for the Java environment is released under the GPL and the C/C++ micro controller libraries are under the LGP.

The Arduino Board

Next we looked at the boards and discussed the different components.

Here is the link to the official description of the boards that the majority of us used on the Arduino website.

The key take aways were:

The Chip

The Pins

Digital I/O pins

Analog In pins

Analogue Out pins

5vts

gnd (ground)

This is important because electricity flows from the place of highest potential difference to the place of lowest potential difference. Ground effectively ends the circuit.

Circuits

We discussed how electricity flows through a circuit using the water analogy.

Imagine that:

How does the voltage effect the current?

When we increase the voltage, the current flowing through the circuit will increase (same as increasing water pressure at a pump and the flow rate increasing).

When we increase the resistance the current will decrease. If a pipe is small then there will be more resistance as there is less space for water to flow so it slows down.

We need resistance to prevent an over current (the component blows up due to not being able to handle the current).

Software

You can connect an Arduino to your computer with a USB cable. Information is sent to the chip via Serial Port. Serial Port basically sends information in one direction and then back in another.

We downloaded the Arduino IDE so that we could start writing programs to send to the chip. The Arduino language is designed to be simple and is modelled on a language called Processing. When code is uploaded to the board it is converted into C and then passed to an avr-gcc compiler.

We selected the port and the board and uploaded the Ardunino blink example sketch so make the first physical connection between the code and the board.

blink

An Ardunio program (often referred to as a ‘sketch’) must contain these two functions:

void setup()
{
/* This code runs once at the beginning of the code execution. This is where you would define which pins you want to use.
}

void loop()
{
/* this code runs repeatedly over and over as long as the board is powered. */
}

Breadboard

Next we looked at the breadboard. Alex explained that is is called a breadboard as people used to literally nail circuits to breadboards (the ones used to slice bread on) when prototyping. He demonstrated how the rows of holes connect using an ammeter which bleeped when a connection was made. He then showed us how components must be placed within these holes so that the flow through the board is not broken.

Breadboard

Schematics

We then started building our first circuits.

The workshop material can be found here and was kindly written by recent Computer Engineering graduate Ben Kazemi.

The schematics can be found here.

Schematics visually represent how a circuit is put together. Example One includes symbols which represent an LED, Resistor and Ground. They are connected by lines which represent wires. There are many schematic cheat sheets available online which display a vast array of symbols. Here is an example!

Components

LED stands for Light Emitting Diode.

LED

(Image source: rapidonline.com).

It is important that the LED is placed the correct way around in the circuit due to its polarity. One of the wire legs of an LED is usually longer than the other. The long leg is the anode (which has a positive polarity in a diode) and the shorter leg is the cathode (negative polarity). Alex showed us that even if someone had used wire cutters on the LED to make the legs the same length, you can tell them apart by peering inside the coloured plastic casing. Inside are two little metal shapes, each attached to a leg. The bigger shape is attached to the cathode.

Because electrons flow from positive to negative potential difference, the longer leg needs to be taking the incoming flow and the cathode needs to be placed so that the electrons will be headed towards the ground.

The resistor's ability to reduce the current is called Resistance and is measured in units of ohms (in the schematic for examples 1&2 100R means 100ohms). We can work out what the resistance of a resistor is by looking at the coloured bands on it. These colours correspond to numerical values.

This website gives a great example of what a 100R resistor looks like. The coloured bands are in the order:

Brown = 1

Black = 0

Brown = 10 (multiplier)

Gold = 0 (tolerance).

The first two colours are put together (NOT added together just kind of pushed together to make a 2 digit number) to make 10, this is then multiplied by the multiplier (10) to make 100. There are lots of online resistance calculator tools available if you are wondering what the resistance of your resistor is. Here is an example.

We found there was some lee-way and we didn’t need to use exactly 100R but if the resistance was too high then it prevented the LED from flashing.

We then worked further through the material. We experimented with changing parameters in the code and discussed how Ben had made the code examples more efficient as they were along.

Conclusion

The session served as a really useful introduction to using Arduino. In building relatively simple circuits there is still a lot to learn at each part of the process.

If you are interested in experimenting with physical computing I would highly recommend Arduino. There are plenty of kits online (check out AdaFruit and SparkFun for tutorials and project ideas). Arduino also works well with languages such as Processing and Max MSP. You may also find it useful to get involved with a hack space or maker group in your local area.

- Rosa Fox

Find this article useful? Sign up to our mailing list to get updates like this in your inbox every week. No spam, and you can unsubscribe at any time.
Give me the goodies