A “Breathing” Light

A "Breathing" Light

Objective:

  • Familarize yourself with SmartNode and its interface and to understand the programming features of SmartNode
  • Learn how to make a "breathing" light
  • Learn how to connect different models such as pins, buttons, and LEDs on the extension board.

I. Overview

IoT (Internet of things) literally means connecting everything by the internet. First, let's begin with lighting up an LED.

A "breathing" light is to control and adjust the brightness of an LED. A desk lamp with an adjustable brightness knob would be an example.

Picture 1: A "breathing" light

II. Analysis 

This is a nice and easy project! All you need to do is trigger the LED to light up by pressing down the button. Besides the Arduino/Genuino101 and the extension board, you need an LED, as well as a button sensor. The whole project analysis is shown in Figure 1.

Figure 1: Project Analysis – "Breathing" Light

Project Name

"breathing" light

Function 

Control the LED's light on and off switch, making it flicker gradually at a certain time interval

Material List

Arduino/Genuino101, Extension Board, Button, LED

III. Basics

A. Arduino/Genuino101

The Arduino/Genuino 101 (Figure 2) is a development board based on an Intel® Curie™ modle, with low power consumption and offers outstanding performance. Not only the Aruduino 101 have the same features and exterior design as the Arduino UNO, but also adds Bluetooth LE capabilities, a six-axis acclerometer and a gyroscope, allowing you to have your creativity run even more wild. The Curie™ module includes an x86 Quark SE core, 32 bit ARC Zephyr, and 32MHZ clock frequency.

 

DSC00420-620x413

Picture 2: Arduino/Genuino 101 development board           Picture 3: Smart cup

B. SmartNode

SmartNode is an online graphical progamming tool based on Node-Red, targeted for entry-level smart hardware developers. SmartNode is user-friendly and is quite easy to use. You do not need to download any software. All you need is a development board that supports SmartNode. Programming is divided into 4 steps:

  1. Drag & drop
  1. Configure
  1. Link
  1. Deploy

All you must do is input the relevant parameters, link the function modules and run the program on the board. Once you've completed this, a basic smart hardware prototype is ready!

The interface of SmartNode is shown in Figure 4. Its interface is composed of three areas:

  1. Node area
  1. Working area
  1. Display area

Users can select desired nodes and may then drag and drop them into the working area, allowing you to begin editing.

 

Picture 4. Interface of SmartNode

IV. Tutorial

A. Connection

First, we need to connect the Arduino/Genuino 101, extension board, rotation sensor and LED.

Here we connect the button to analog pin 11, and connect the LED to digital pin 5, shown in Picture 5.

说明: C:\Users\WYP\AppData\Local\Microsoft\Windows\INetCacheContent.Word\图5.png

Picture 5: "Breathing" light connection diagram

B. Program

To allow the lamp to have adjustable brightness, we need to drag and drop the DFRotation, Button, and To Curie nodes, and connect the nodes as shown in Picture 6. Once this is done, the knob will now control the brightness of the LED.   

说明: C:\Users\WYP\AppData\Local\Microsoft\Windows\INetCacheContent.Word\图6.png

Picture 6: Programming behind the "breathing" light

C. Set up

Obviously, the button plays a very important role in the entire program. An interface like Picture 7 will appear if we double-click the node. Input the name you'd like, set the digital pin between 0 – 13 (for example: 11) and the function to normal button.

Picture 7: Setting up the DFButton node

Setting up the BreathLed node is quick and easy. You simply need to input a pin number. In this case, we will set the digital pin to 5, shown in Picture 8.

Picture 8: Setting up the BreathLed node

By now, you are all set!

IV. Test

Click "Deploy" and you will see if the LED is working as expected. If not, ask your friends or simply post your question on our forums!

Last but not least, don't forget to share your work and learning process with your friends and colleagues!

V. Challenge 

If you found this example too easy, SmartNode contains a variety of other interesting nodes, such as touch sensors for you to explore. Besides buttons and knobs, can you think of alternative ways to control an LED's brightness? Tell us some of your ideas!

Leave a Reply

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

Skip to toolbar