Connecting a relay
In the first recipe of this chapter, we are going to see how to connect a relay to the Galileo board, and how to control it. This can, for example, be used in a home automation project, to control a lamp or another electrical device.
Getting ready
For this project, we will need a relay. I chose a simple 5V relay from Polulu (the Polulu 5V relay module). Of course, you can use any 5V relay module on the market and it should work just fine. You can get this module at https://www.pololu.com/product/2480.
You will also need to have your Galileo board ready to use with the Arduino IDE. Please refer to the first chapter if you haven't done this yet.
How to do it...
First, we need to assemble the hardware. The relay module only has three pins—VCC, GND, and usually one signal pin called EN (or SIG on some modules).
Connect the VCC pin to the 5V pin on the Galileo board. Then, connect the GND pin to the GND pin on the board. Finally, connect the SIG pin on the relay to pin 7 on the Galileo...