Introduction: Arduino Blynk RGB Ethernet Lamp
Hi everyone.
Today i´m going to teach you how to control an a RGB led over the internet (Ethernet wired connection) with an Arduino and the IoT platform, Blynk.
For this we need the following materials:
- RGB led common cathode
- 4 jumper male-male
- Breadboard
- Ethernet Shield W5100
- Arduino Uno
- Ethernet cable
- USB to Type-B cable
- USB adapter to give power to the Arduino
- Android or iOs phone
- Blynk App
- Arduino IDE. Download: https://www.arduino.cc/en/main/software
- You can find Blynk documentation here: http://www.blynk.cc/
Once you have all the materials it´s time to go with the first step.
Step 1: Physical Wiring
The wiring is so simple.
Attach you'll find the wiring diagram to a RGB Led montage
RGB led is connected to the 3,5 and 9 PWM digital pins of the Arduino Ethernet Shield.
Don´t forget to connect the Ethernet shield to the Arduino Uno before you do anything.
Now it's time to connect the Arduino to our PC via USB Type-B and the Ethernet shield with the Ethernet cable to the internet modem.
Now we're ready to coding.
Step 2: Creating Dashboard Into the Blynk App
To create the project/dashboard into Blynk App you just have to press "New Project" button and following the instructions inside the app.
Attaching are some screenshots that can help you to create a empty dashboard.
when the dashboard is ready, Blynk automatically send you an e-mail with the auth token. Keep save, we'll need it soon.
Step 3: Setting the ZeRGBa Widget in the App
At next, click in the "+" button of the dashboard, select zeRGBa widget.
Once you did it, the Widget will appear in the dashboard, click it to access to the widget settings.
Set the digital pins according to the pins used before in the breadboard.
Important: Use the "digital" pins, not "virtual". Virtual is for simulation or programming purposes and not for the physical project.
Now just go back and the widget is prepared for use.
it's time to coding.
Step 4: Programming the Arduino
For this step you just need to use the Blynk Sketch Code Builder link: https://examples.blynk.cc/
Set the board, the connection type and the auth token (the e-mail i was talking before) and choose Blynk Blink example.
Now click in "Copy Example" and paste into the arduino IDE.
upload the sketch in the Arduino and it´s done.
Now go to the Blynk App, click in the play button and test.
Tip: Blynk app tells you when the device is online or offline. If you see a red signal in the icon next to play button when you has clicked on it it's because the Ethernet it's not connecting to the modem.
I let you some photos of the Lamp working. I put a paper with cone form for better illumination
Code used in this guide:
/*************************************************************
Download latest Blynk library here: https://github.com/blynkkk/blynk-library/releases...
Blynk is a platform with iOS and Android apps to control Arduino, Raspberry Pi and the likes over the Internet. You can easily build graphic interfaces for all your projects by simply dragging and dropping widgets.
Downloads, docs, tutorials: http://www.blynk.cc Sketch generator: http://www.blynk.cc Blynk community: http://www.blynk.cc Follow us: http://www.blynk.cc http://www.blynk.cc
Blynk library is licensed under MIT license This example code is in public domain.
*************************************************************
You’ll need: - Blynk App (download from AppStore or Google Play) - Arduino Uno board - Decide how to connect to Blynk (USB, Ethernet, Wi-Fi, Bluetooth, ...)
There is a bunch of great example sketches included to show you how to get started. Think of them as LEGO bricks and combine them as you wish. For example, take the Ethernet Shield sketch and combine it with the Servo example, or choose a USB sketch and add a code from SendData example. *************************************************************
* Comment this out to disable prints and save space */ #define BLYNK_PRINT Serial
#include #include #include
// You should get Auth Token in the Blynk App. // Go to the Project Settings (nut icon). char auth[] = "YourAuthToken";
#define W5100_CS 10 #define SDCARD_CS 4
void setup() { // Debug console Serial.begin(9600);
pinMode(SDCARD_CS, OUTPUT); digitalWrite(SDCARD_CS, HIGH); // Deselect the SD card
Blynk.begin(auth); // You can also specify server: //Blynk.begin(auth, "blynk-cloud.com", 8442); //Blynk.begin(auth, IPAddress(192,168,1,100), 8442); }
void loop() { Blynk.run(); // You can inject your own code or combine it with other sketches. // Check other examples on how to communicate with Blynk. Remember // to avoid delay() function! }
Step 5: Final
Finally i'll hope you have fun making this project.
It take few minutes to do but give you a beautiful light in your room.
I apologize if are some grammatical or orthographic mistakes, I'm Colombian and English it´s not my native lenguage.
If you have any questions or comments please leave them down and i'll answer as soon as possible.
It's my first instructable so, please, be merciful XD.
Greetings and i guest, see you soon in another one Instructable. <3