Book Image

Internet of Things with Arduino Blueprints

By : Pradeeka Seneviratne
Book Image

Internet of Things with Arduino Blueprints

By: Pradeeka Seneviratne

Overview of this book

Table of Contents (15 chapters)
Internet of Things with Arduino Blueprints
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Reading the serial data using Arduino


You can read incoming data from the serial port where we wrote data using the Python script in the previous section using Arduino. The following Arduino sketch will read the incoming data from the serial port and turn on the PowerSwitch Tail if it finds 1, and turn off the PowerSwich Tail if it finds 0.

The sample code, B04844_07_01.ino, can be found in the Chapter 7 codes folder, so you can copy and paste it on a new Arduino IDE and upload it to your Arduino UNO board.

Connecting the PowerSwitch Tail with Arduino

Connect the PowerSwitch Tail to your Arduino UNO board, as shown in the following Fritzing diagram. For this project, we will use a 240V AC PowerSwitch Tail:

  1. Using a hook-up wire, connect the Arduino digital pin 5 with the PowerSwitch Tail positive (+ in) connecter.

  2. Using another hook-up wire, connect the Arduino ground pin with the PowerSwitch Tail negative (- in) connector.

  3. Connect a 240V AC light bulb to the LOAD end of the PowerSwitch Tail.

  4. Connect...