A "Breathing" Light
- 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.
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
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
Control the LED's light on and off switch, making it flicker gradually at a certain time interval
Arduino/Genuino101, Extension Board, Button, LED
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.
Picture 2: Arduino/Genuino 101 development board Picture 3: Smart cup
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:
- Drag & drop
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:
- Node area
- Working area
- 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
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.
Picture 5: "Breathing" light connection diagram
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.
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!
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!
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!