-
1Step 1) Set up micro:bit
Micro:bit is a tiny computer which empowers anyone at all skill levels to create exciting electronics projects. It includes microphone, gyroscope, accelerometer, temperature sensor, light sensor and other features. In this example we are going to use the microphone to detect clicking fingers or any other high volume noise. Once the sound is detected we are going to:
- Display the Heart icon on the LED display
- Set the P0 pin to "1" for a short period of time (1 second) - to wake up Cricket WiFi moduleto send a notification to a phone
Let's go and create the program in https://makecode.microbit.org/ as shown below:
Here is our complete project: https://makecode.microbit.org/_3gr76PCMDXKh
Once the program is ready we need to put it on our micro:bit with the following steps:
- Click the "Download" button and save the program on the local disk
- Connect micro:bit via USB to PC (MICROBIT drive should appear)
- Copy/Paste the downloaded program to MICROBIT drive (micro:bit should be flashing LED when performing the copying)
Our micro:bit is ready! We can test it by clicking fingers and see if the heart icon shows up on the LED display. If yes, we can disconnect from USB and move on to the next step.
For more information how to get started with micro:bit please check out this official guide how to get started with micro:bit. We were inspired to do this project with the sound input tutorials which you might also like to check.
-
2Step 2) Assembly
In this step we are going to connect all the components together with the following steps:
- Connect micro:bit to the batteries
- Connect Cricket to the batteries (we peel out the coat from the cables to connect Cricket on the same power source)
- Connect micro:bit's P0 pin to Cricket's WAKE_UP pin [green cable]
A complete project assembly may look like this:
-
3Step 3) Setup Pushsafer
Pushsafer, we learned, is one of the easiest and reliable internet service which provides multi-platform push notifications. There is some free allowance of notifications but we quickly ran out of it and had to purchase 1000 extra notifications for ~$1. It is very cheap for what it gives you back and it is super simple to set up:
- Go to pushsafer.com
- Open an account
- Create a notification message
- Generate a URL link and save it somewhere (we will need this link to copy/paste to Cricket's configuration in the next step)
- Install mobile app on your phone (iPhone or Android) and login with the same account
Below there is a screenshot of how we created an example message:
Now we can press the "Send Message" button and, if everything is configured correctly, we should receive a message: "Microbit: Hello from Cricket!" on our phone.
Please do not forget to press the "Create Link" button and save the URL address as we will need this to configure Cricket In the next step.
-
4Step 4) Configure Cricket
IOT Cricketis an easy to use ultra-low power WiFi module, which can operate directly on batteries for a very long time (for years in many use cases). You simply attach a sensor and battery to it and the device is ready to transmit data instantaneously to a network.
Now we are going to configure the Cricketmodule to send notifications to a phone when it wakes up. It happens when a voltage appears on the WAKE_UP pin. In our case it is when micro:bit sets the P0 pin to "1" and as it is connected to Cricket's WAKE_UP pin, it raises the voltage on that pin and it wakes it up. After that, Cricket connects to the Pushsafer service by using the URL link, which we obtained in the previous step. Once connected, the Pushsaferservice sends the notification to our phone.
Let's do it step by step.
Let's first connect Cricket to our WiFi network:
- Press the built-in Cricket's button for 5 seconds (it opens toe_device hotspot)
- Connect to the "toe_device" hotspot from a phone or laptop
- Pass your WiFi credentials: SSID and Password; and press CONNECT button
For more information please see the steps here.
Open CONFIG panel and set the following:
- CONNECTIVITY > type: HTTP_GET
- CONNECTIVITY > url: [copy/paste the URL obtained from the previous step]
- IO1 > force update: On
An example configuration may look like this:
This is it. We can press the switch off button in the top right corner to exit from the configuration and our device is ready to go!
It's time to test it out!
-
6Summary
We have presented how easily you can make projects with Micro:bit and connect them to almost any internet service by using Cricket. It is the base to build upon for more advanced projects.
The ecosystem of software and services which Cricket can be integrated over HTTP and MQTT is HUGE! To mention a few IFTTT, Zapier, automation systems such as Home Assistant, Node RED, Grafana, etc.
Now as we know the basics, the sky is our limit of what other projects we can make!
Thanks for getting up to here. We hope you enjoyed this tutorial!
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.