Internet of Things (IoT) is a concept that aims to take advantage of the benefits of connected internet connectivity continuously. It creates the network of physical devices embedded with computing system (identity, software, sensors) to connect and exchange data - like between home appliances, vehicles and other objects. Each object is uniquely identifiable through its embedded computing system but is able to inter-operate within the existing Internet infrastructure – wifi connection.
According to Wikipedia, The IoT allows objects to be sensed or controlled remotely across existing network infrastructure, creating opportunities for more direct integration of the physical world into computer-based systems, and resulting in improved efficiency, accuracy and economic benefit in addition to reduced human intervention.
BBC micro:bit is the most popular development board in the current. Then can we combine BBC micro:bit with IoT? The answer is definitely yes. Today, we are going to talk about how to send data from micro:bit to thingspeak IoT platform using ESP8266WIFI module.
Step 1: Preparation
Before we start this project, firstly you have to register an account in thingspeak.
After registration completed, click New Channel under the menu of Channels to create a new channel.
Fill in your channel name and channel field, then tick the square behind the field. Here, we name the channel micro:bit DATA. I want to display the temperature data received from micro:bit, so I fill the name Temperature ℃ into the column of Field 1.
Click to save the above settings, then you will see a page like this. Click API Keys.
In this page, you can see Write API Key, which is very important in the latter steps. Note: Different projects will generate different Write API Key.
Step 2: Material List
Step 3: Operation Procedure
1.Connect ESP8266 module to Octopus:bit. Connect RX on the ESP8266 module to P0, then TX to P1. Because ESP8266 module requires 3.3V power supply, we have to "VCC+ GND" on the ESP8266 module to "VCC + GND" under the yellow pins on Octopus:bit 。
2.Plug the OLED module to IIC connector in the bottom left corner of Octopus:bit. Then plug in micro:bit to Octopus:bit. After connection completed, you will see the following picture showed.
3.Click to open makecode.microbit.org. Search in Add Package for ESP8266, and then add this package.
4.After we have added IOT Package, we can see 3 extra block drawers. In this case, we will only use ESP8266_IoT and OLED.
5Initialize OLED screen in the on start block, and set RX and TX on ESP8266 wifi module to be PO and P1 separately.
Step 4: Operation Procedure
5. Add the following blocks into forever： connect wifi : Connect ESP8266 with your wifi by filling in your wifi SSID and KEY. connect thingspeak: Connect ESP8266 to Thingspeak IOT platform. set to be send data: Set the data to be sent. Please fill in your Write API Key under your Thingspeak account to Write API Key . You can fill 8 groups of any data into field1~8. In the previous Channel setting, we have just activated field 1. So here, we place temperature block to field 1. send data to thingspeak can send data to IoT platform.
6.When the data received in the serial port, display the data on the OLED screen. Then we can monitor the program operation through OLED screen.
7.Program download. You can visit the whole program though the link here: https://makecode.microbit.org/_9DVWo5cg3iy4 Or you can visit the page below to Download the program of this case directly.
8.A very important step is to change power module. Because if you power through the USB connector on the micro:bit, the drive performance will be very weak, which might lead to the instability of ESP8266. The input of this power module can connect with DC power supply or USB, and its output can connect the battery terminal of micro:bit directly.
9.Use OLED to monitor the program operation.
Step 5: Result
Now, it's time to see a wonder. Return back to your Thingspeak page, click Private View, then you can see the data you sent from micro:bit to the IOT platform. And the data keeps updating for every minute！Micro:bit has ipload the data to the Internet! Now you can access these data with your computer, mobile or tablet!
Step 6: In the Last
From the above loaded package, we can see that our environment IoT kit is coming out soon. Environment IoT Kit can detect all kinds of environment data like temperature, humidity, wind speed, light intensity, noise, dust, PM2.5 and so on. Besides, you can upload these environment data to thingspeak IoT server through ESP8266 serial wifi module. Just waiting!
I would like to thank Mr. Zach, CEO of Micro:bit Educational Foundation, for his acknowledgement of our kit.
I want to thank Mr. Waris from micro:bit foundation too! Through several deep communication in mulitple days and nights, we have introduced this kit to the public. You have provided lots of ideas and inspirations for me. Thank you very much! Also, I want to thank our TinkerCademy parterners. Thank you for giving us so much technique support! Besides, I want to thank my wife for her support. You are the most powerful backbone in my family! Thank you!
Step 7: Source