Introduction: LattePanda + Blynk = IoT Fun!
IoT stands for "Internet of things", which refers to the inter-networking of physical devices embedded with electronics, software, sensors, actuators, and network connectivity that enable these objects to communicate with each other.
A few examples of IoT applications:
- The temperature in your house drops below a threshold, a temperature sensor registers this and activates the heating.
- Your plants need to be watered, a soil moisture sensor registers this and activates an automatic watering device.
- A motion detector detects movement in a room, the lights in the room turn on.
Expect to hear about it a lot more about IoT in the years to come.
In this project I will be leveraging two cool new pieces of technology to build a simple but cool IoT control unit. This basic example will show you the tools necessary to create more complex IoT devices that you can use to automate your home!
The first cool innovation is LattePanda - an entire Windows 10 system on a single board. LattePanda ships with a full version of Windows 10 Home Edition pre installed. You can opt to buy it with a Windows activation key, or without if you'd like to install Linux, Android, etc. A few tech specs of the board:
- Intel "Cherrytrail" Quad-core 1.8GHz processor (Intel Atom z8350)
- WiFi 802.11 a/b/g (Realtek RTL8152B)
- Bluetooth 4.0 (Realtek RTL8152B)
- 500Mhz Intel Gen 8 graphics processor
- USB 2.0 x 2
- USB 3.0 x 1
- MIPI DSI (Custom pinout, connected via FPC with upgradable touch screen overlay)
- HDMI out
- 2GB/4GB DDR3 RAM (as they offer two different versions)
If that's not enough for you, it also has an ATmega32u4 microcontroller integrated in to it (like you would find in an Arduino Leonardo) with accompanying GPIO. This makes it ideal for physical computing, IoT and embedded applications. The board runs of 5V@2A, powered either through a Micro USB or header pins and uses about 10W.
Find out more about LattePanda here.
The second thing I will be using is Blynk - an app for creating IoT services. Blynk takes a lot of the development legwork out of developing IoT control interfaces. It can control hardware remotely, display sensor data, store data, visualize data and many other cool things besides.
Putting these two things together will enable me to use my smartphone to control an LED remotely over a network. Feel free to take this concept and develop it further to carry out lots of other cool things. Let's begin!
Step 1: Hardware&Hardware Setup
- 7-inch 1024x600 IPS Display for LattePanda
- USB wireless keyboard and mouse
Ensure the board is powered off, and then connect the 7-inch 1024 x 600 IPS Display to the LattePanda via the integrated DSI connector.
- Lift up the actuator.
- Insert the display's FPC cable with the contacts faced downward.
- Secure the actuator.
You now have a visual interface for your LattePanda that is powered directly from the board!
Step 2: Connect to Wi-Fi:
- Connect the Wi-Fi antenna by plugging the round shaped end into the socket labelled “ANT” located next to the 12 x 2 GPIO pins on the board.
- In Windows select a Wi-Fi connection by clicking the Wi-Fi icon in the system tray at the bottom right of the screen. Follow the wizard to setup a connection. As it's using the Windows interface, you are likely familiar with this process already.
Step 3: Power on Your LattePanda
- When plugged in, you should see the red LED indicator lights up on the underside of the board. Wait patiently for a few seconds until the LED goes out.
- When the LED turns off, press and hold the power button for one second to turn the LattePanda on. Now, the computer is running!
Now, the computer is running!
Step 4: Software Setup
The LattePanda preinstalled Windows image includes Arduino IDE, but the version might have depreciated, so I recommend installing the latest version latest version of Arduino IDE . For this tutorial I have used Arduino IDE 1.8.1
Using this version will prevent any compilation errors that might come from using an older, incomaptible version of Arduino IDE.
Next, install the Blynk app and Blynk Library. Details for this can be found in the official documentation from Blynk.
Step 5: Build a Smartphone Control App
- Open the Blynk App and create new project.
- Choose the hardware and communication type you are going to use.
- Add Button widget. You can hold and drag it to reposition it. Tap once to get to Widget Settings.
- In Widget Settings set the PIN you want to control. (My LED is connected to pin 9)
- Check your e-mail. You will find your authorization token. You can use it in your code.
Step 6: Upload the Program
You can open the example sketch or copy the code attached to this project. Upload it to the LattePanda's onboard Arduino Leonardo.
Make sure that you have selected Tools > Board > Arduino Leonardo
Also make sure you are communicating on the correct serial port.
Note: If your Arduino IDE is an older version, you may receive the following error: 'Blynk' was not declared in this scope.
To avoid this, I recommend you use the latest version of the Arduino IDE.
Step 7: Communicating With Blynk
Open a command prompt in Windows by pressing the Windows Key + R, typing "cmd" and pressing enter.
Find the directory of your Blynk scripts. By default they will be located in:
Navigate to the scripts directory in the command terminal using the cd command, e.g.:
cd C:\Program Files\Arduino\libraries\Blynk\scripts
Next, input blynk-ser.bat -c COM5 (where COM5 is the COM port for your LattePanda's Arduino - this might be different for you. You can check in Arduino IDE)
Hit enter two times so that it looks like this.
Step 8: Press PLAY in the Blynk App.
You should now be able to control the LED with the button on your smartphone!
Hello IoT world!
Step 9: How It Works
According to the Blynk documentation, every time you press a button in the Blynk app, the message travels to Blynk's Cloud, where it magically finds its way to your hardware. It works the same in the opposite direction and everything happens in a "blynk" of an eye.
I hope you had fun using Blynk and LattePanda. The LED example is very simple, but the concept can be developed to carry out larger applications. Try it yourself!
If you liked this project, have any questions, or can think of any cool IoT applications, let me know in the comments!
Question 3 years ago
Hi! Is it possible to use pins from native Windows app? Or even better - from C# app. "Use" i mean directly from program, without additional apps.
Question 5 years ago
Have you uploaded the Board_Serial_USB in the Blynk library to the arduino board?
Question 5 years ago
nice tutorial. but i have try it and found an error like the picture above. what should i do ?
5 years ago
Neat simple setup and a good tutorial :)
Reply 5 years ago