The happiest thing in life is to eat well and sleep well. The company starts work at 9:30, and the canteen serves lunch at 12. The happiest thing in the morning is to hear Master Du’s knock on the door.
It could have been notified in the WeChat group, but when everyone gets busy, they don’t even look at WeChat (believe it or not, I believe it). In the cold winter of Beijing, I really can’t bear to let Master Du knock on each door to notify. If Master Du could sit in a bright and warm canteen, and just tap his phone to notify everyone, wouldn’t that be perfect?
We decided to try to solve this problem with Arduino + Lego.
First, to achieve remote control, we must connect the internet terminals (mobile phones/tablets) with the functional devices.
We found a good solution, the Lewei IoT platform achieves this connectivity.
First, we set a small goal to test the Lewei IoT platform, such as remotely controlling an LED light.
1. Add platform devices
2. Add controllers and execution units
The commands in the red box can be triggered as messages after binding WeChat
3. Bind WeChat account
Two operation modes, “menu control” and “keyword control”
4. Programming and debugging
We use Arduino + W5100 network expansion board to connect the device to the internet:
Arduino UNO, W5100 expansion board, relay, LED light, 330Ω resistor (3 1K in parallel)
The Lewei IoT platform provides comprehensive library support, so we only need to call the corresponding functions to achieve real-time online devices. Once the device is powered on and connected to the internet, the program communicates with the Lewei server at regular intervals to check if there are new action commands triggered; if triggered, it executes the locally written code, such as controlling the relay switch; if no new actions are triggered, it maintains the current state until the next communication with the server.
Complete connection diagram
Steps completed, let’s test it:
Success, small goal achieved!
This is actually the implementation principle of smart sockets. If we modify the relay control code to Lego motor control code, we can upgrade from “smart socket” to “smart device”. For multi-channel control, just add Lewei network controllers, execution units, and modify local code. The relay in the picture supports control of electrical appliances with a power of 2500W(250V10A) or less; to control devices with higher power, just upgrade the relay.
Having connected the phone and the device, let’s set another small goal: to make our “Lego meal reminder”!
In previous articles, we mentioned that we need to use the Brictronics Motor control board, Lego motors, and some Lego building blocks:
Lego motor andBrictronics Motor control board
To ensure sufficient reminder effect, we made a cute Lego dining table.
Complete assembly diagram
Everything is ready, just waiting for Master Du. We quickly let our target user, Master Du, try it out. When it’s time to eat, Master Du sits in the canteen, takes out his phone, and gently taps.
Almost simultaneously, the Lego dining table on the desk of colleagues upstairs starts waving, and the reminder effect is definitely strong enough.
Master Du no longer has to knock on doors one by one!
If we replace Lego with electrical appliances, it becomes smart appliances. With more smart appliances, it forms a smart home.
The traditional control mode is a one-to-one matching of home appliances with remote controls, where home appliances are controlled by infrared signals sent by remote controls. Smart homes, on the other hand, send control commands from internet terminals (mobile phones/tablets) to smart appliances via the internet, completing the control of home appliances.
So, whether it is the “Lego meal reminder” or smart appliances, the core is to establish the connection between internet terminals and devices.
Our recent series of articles on Arduino + Lego has attracted the attention of many teachers. To facilitate communication, we welcome all teachers to join the professional discussion group of the Technology Classroom. Teachers can scan the QR code of the “Xuetang Jun” at the end of the article to apply to join the WeChat group.
Out-of-article remarks: The Internet of Things and big data are the trends of the future.
In addition to remote device control, the Lewei platform also supports the upload of device information (such as PM2.5, temperature, humidity, and other custom data). With compact and low-power devices like Arduino nano + ESP8266/GPRS modules, we can easily set up information collection points without customizing or purchasing expensive products. Through platforms like Lewei IoT, we can complete data uploads, and based on this data, we can establish mathematical models and perform various analyses.
Arduino nano control board, ESP8266 wifi module
Human infrared detection module, infrared RF module, light sensor, ethanol detector
Thanks to these mature technologies and products, we have great possibilities.
To be continued.
Scan to add “Xuetang Jun”
Join the teacher discussion group of the Technology Classroom
Links to previous articles in this series, click to read:
-
“When Lego Meets Arduino: How to Control Lego Components Externally”
-
“When Lego Meets Arduino: Lego PM2.5 Detector”
Leave a Comment
Your email address will not be published. Required fields are marked *