Arduino Advanced Workshop

This workshop is provided by:

Michael Shiloh
Judy Castro
Teach Me To Make

This page is at

This workshop will introduce advanced Arduino concepts, focusing on sensors, actuators, and programming techniques that might be used to monitor or control equipment. Topics might include*:

  • Sensors using the SPI and I2C interfaces
  • An LCD interface using a 4 bit parallel port
  • How to program a menu system for displaying values and changing parameters
  • How to set and read a real time clock with battery backup
  • How to use IR for control (via TV remote) or communication between Arduinos
  • How to filter and smooth sensor values
  • How to program a servo loop to keep an actuator within a target range

*Depending on time, not all topics might be covered


  • Basic familiarity with Arduino software and hardware (i.e. know how to modify and upload a program, understand basic programming concepts, know how to use a solderless breadboard to connect simple sensors and actuators to Arduino)
  • A laptop with Arduino installed and known to function correctly (i.e. can compile and upload sketches to Uno).

Arduino and all other necessary materials will be provided for use during the workshop or you may bring your own.

If you have questions prior to or after the workshop please contact


Arduino education begins with learning how to use the basic input and output commands: digitalRead(), digitalWrite(), analogRead(), and analogWrite. This way of “communicating” with a device, be it a sensor or an actuator or anything else, is called the interface. Many interesting sensors and actuators have more complex interfaces, perhaps because they provide (or require) more information than can be conveyed easily and accurately using the basic input and output commands. Often, these more complex interfaces require extending Arduino’s capabilities with a library. Arduino is delivered with some libraries, and many other libraries are available on the internet. Knowing how to download and use a library is an important skill.

16×2 LCD Display Module

It is often useful to have a display attached to an Arduino project, so that the project can privide information without having to attach a computer and use the serial monitor. A common, inexpensive display is this LCD display with two lines of 16 characters each. Although you can control the display directly from your own program, Arduino provides a built-in library which makes this display much easier to use.

Start by wiring up the display:

16x2_LCD_bb16x2_LCD_schemArduino sketch: File -> Examples -> LiquidCrystal -> SerialDisplay

Open and upload the sketch, and then open your serial monitor. Type a few words in the box at the top of the serial monitor, and they should appear on the LCD display.

Look at the program and notice how the library is used with the #include statement. You can learn what other features this library provides by visiting the LiquidCrystal library reference, and you can learn more details about each command by clicking the command in question. For a list of libraries available in Arduino visit the Arduino libraries page.

DHT11 Temperature Sensor

The DHT11 is a simple temperature and humidity sensor that provides a lot of information and requires an external library. Follow the instructions here to learn how to use the DHT11 temperature Sensor, including how to download and install the required library.

Your Turn

Add the temperature and humidity sensor to the LCD circuit, and display the temperature on the LCD display

Infrared (IR) Decoder

TV remote controls (using Infrared or IR light) are cheap and commonly available. It is easy to receive and decode the signals, and thus control an Arduino project wirelessly. We will use an inexpensive device that detects IR light.

Get and install the necessary library:

  1. Get the Arduino IR Remote library by Ken Shirriff from
  2. Unzip and as before rename, this time to IRremote


Build the circuit

Locate your IR Receiver module and build the following circuit:



Pin 1: Data Out Pin 2: GND Pin 3: +5V


Upload example sketch

  1. Open the IRRecvDemo example in the IRremote category of examples
  2. Upload the example to your Arduino
  3. Open the serial monitor
  4. Point a TV remote at the receiver and press a button. Note the number that appears on the serial monitor. Try a different button.

Why are there so many incorrect numbers?

There is a lot of interference from other sources of IR light, for example fluorescent and other lights, reflections from walls, etc. Typically the device being controlled (your TV or whatever) is carefully designed to ignore commands that make no sense.

Use a TV remote to control an Arduino

TV remotes are plentiful and inexpensive, and make a convenient way to control an Arduino project wirelessly from some distance. Use the IRRecvDemo example to identify a couple of buttons, and then modify the sketch to control one of you Arduino outputs. Here is a simple example:

 * IRRCControl: Control an Arduino pin using a TV remote control  
 * Requires IRremote library by Ken Shirriff
 * Based on IRrecvDemo by Ken Shirriff
int RECV_PIN = 11;
IRrecv irrecv(RECV_PIN);
decode_results results;
const int outputPin = 13;
void setup()
  irrecv.enableIRIn(); // Start the receiver
  pinMode(outputPin, OUTPUT);
void loop() {
  if (irrecv.decode(&results)) {
    if (results.value == 2327013275) {
      digitalWrite(outputPin, HIGH);
    if (results.value == 3855596927) {
      digitalWrite(outputPin, LOW);
    irrecv.resume(); // Receive the next value

Controlling high voltages: Using Relays

Visit How to use a relay to control a high voltage to learn how to do this.

Combine your relay circuit with the IR remote control so that you can turn your relay on and off with a TV remote.

How to finish a project

Discussion and examples

DS1307 Real Time Clock Module

Install the two necessary libraries by going into your library manager ( Sketch -> Include Libraries -> Manager Libraries ).

Search for 1307 and install the DS1307RTC library by Michael Margolis.

Search for time and install the Time library by Michael Margolis.


Arduino sketch: File -> Examples -> DS1307RTC -> ReadTest

You will need to add the following line at the top of ReadTest:

#include <TimeLib.h>

Switch and Why you need Debouncing

SPST_bb SPST_schem

Arduino sketch: File -> Examples -> Digital -> Button

Arduino sketch: File -> Examples -> Digital -> Debounce

Your Turn

Report the time at which the switch is pressed and the duration of the press

Speeding up response time: Blink without Delay

Discuss the Blink without Delay tutorial


Arduino sketch: File -> Examples -> Analog -> Smoothing


Your turn to program: Servo Control

Goal: Keep the light level on the photoresistor at a constant level by brightening or dimming an LED. Test by increasing or decreasing ambient light

servo_bb servo_schem

Very simple approach:

Use smoothing to take the average of a small number of samples

Things to try:

  • Add a second LED with a potentiometer to change light level on photoresistor
  • If the error is very large, change the light level by bigger steps

Hall Effect sensor

A1302 Continuous-­‐Time Ratiometric Linear Hall-­‐effect Sensor IC Data sheet

  • Looking at the side with the bevel, the pins are:
    Far left: +5V
    Middle: GND
    Far right: OUTPUT
  • Output is a voltage proportional to magnetic field strength


Arduino sketch: File -> Examples -> Basics -> AnalogReadSerial

Workshop add-on kit contents. You can  purchase the kit  from Oddwires

  • 16×2 1602 Blue LCD Display Module with free 10k trimmer
  • DHT11 Temperature Sensor
  • IR Receiver Module TSOP4838 + Infrared LED 940nm 5mm TSAL7400
  • Tactile Switch 6mm (10 pack)
  • DS1307 Real Time Clock Module with I2C Interface
  • A1302 Continuous-­‐Time Ratiometric Linear Hall-­‐effect Sensor IC


Pushbutton LED challenges

  1. One LED, one pushbutton. When the pushbutton is pressed, the LED changes state, that is, if it was off it turns on, and if it was on it turns off.
  2. One LED, two pushbuttons. Pressing one pushbutton makes the LED get brighter, pushing the other makes it get dimmer. Tapping either briefly makes the light go out
  3. One LED, one pushbutton. When the pushbutton is not pressed, the LED fades up and down. Pressing the pushbutton makes the LED blink


Print Friendly
Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

Leave a Reply

Your email address will not be published. Required fields are marked *