Recently, I want to make a toy for kids, I decide to make a full-color WS2812 LED Strip, which can be controlled via mobile phone APP. I really think many kids would like it. I chose M5Stack as an platform to make. M5Stack is a fully compatible Arduino development kits. The design concept of M5Stack is “All in stack”, that means all the parts are inside the housing. Because all modules are the same size, so when they are stacked together, the whole will looks like a cube tower, the functions interfaces can be expanded in four sides.For a brief description,I will use “M5” instead of “M5 Stack” in this article.
Step 1: Hardware
M5 Core module is a cube box with a monochrome display, three touch buttons, and a encoder switch. ATmega32u4 is inside this module, so we can choose the “Arduino Micro” as the board when we download under Arduino IDE.
I use the WIFI module “HF-LPB100” to access the internet. The UART pins on this module are the PIN22, 23.
Mostly, people use the 2.54mm M5 extension module to add other electronics parts. But the HF-LPB100 pin spacing is 2.0mm, so I use the 2.0mm M5 extension module.
Step 2: Assembly
In fact M5 Core module only uses serial port to communicate with the HF-LPB100, so we only need four pins to connect between each other. I weld two 4 pins socketson the PCB board for balance, but the other socket does not have any functions at all.
Then plug the WIFI module into the socket, only the PIN22, 23, 24, 25 need to be connected to the socket, as the picture shows.
And on the other side, solder some wires to the corresponding pin, and add one 3 pins socket for the LED strip, the corresponding M5 Core control pin is D11.
Plug the HF-LPB100 intothe socket, and dock to the M5 Core module.
Step 3: Software
I use Chinese IOT service provider Gizwits as the IOT platform. Their project samples are open source, the codes on the Github website: https://github.com/gizwits.
In this project, I use the Gizwits sample can be downloaded at http://gizwits.oss-cn-hangzhou.aliyuncs.com/hardwa...
The corresponding IOS test software can be downloaded at
The corresponding Android test software can be downloaded at
Download the source code above, unzip and copy the files in the libraries directory to the libraries directory under Arduino install path. This source code is default for Arduino UNO board.
Download the M5.cpp and M5.h from http://www.m5stack.com/DOWNLOAD/ and add library into the Arduino IDE, see the figure.
Because the Gizwits sample code is for the ATmega328P, but M5 uses the ATmega32U4, so we have to change the code from “serial” to “serial1”. Modify the code in gizwits.cpp, change “serial.begin” to “serial1.begin”, “serial.read” to “serial.read”, “serial.write” to ”serial1.write” and “serialEvent” to “serialEvent1”.
Step 4: Prototype
When we finish, compile and download the bin into M5, there is a smile display on the LCD screen.
Now we can use the KEY1 or KEY2 on the M5 Core module to set up the WIFI configuration. Please select the WIFI module type as “HF”.
After setup and establish the WIFI connection, we can use the mobile phone to control the LED strip, we can change the color, at the same time, the face on the LCD screen is also changed.
All my codes are on Github: https://github.com/curiousguy98/KidsBox, including the test apps.
And M5 company website is www.M5Stack.com.
Any suggestion, please feel free to contact with me via email@example.com.