Every day is a wonderful one to express our love. But no matter how you do it, the essential thing is to bring a bright smile to the faces of your loved ones while doing so. Valentine's Day is the perfect occasion to express our love and appreciation with greetings and gifts, that's why, every year, we see new ideas to make a gift out of the ordinary, a gift that lasts over time and expresses the feelings you have for the person you love.
As a way to join this holiday, as well as this fantastic community of DIY creators, we thought of creating a device capable of displaying messages full of love every time you shake a beautiful heart. This way, your partner will be able to shake it every morning to start the day remembering the special relationship you have. We thought about it, and of course, we made it happen, so after following this step-by-step guide, you will be able to create that special gift for your Valentine.
Without further ado, it is time to create a heart-shaped gadget that switches messages on a display every time you shake it. Before getting into the details about its construction, let's check the requirements to understand how they help us achieve the key features.
🤩❤️ Cool HINT - In addition, you can also set up the romantic phrases to be displayed using the several options that we will be describing along with the tutorial.
Requirements- WisBlock LPWAN Module (RAK4631 WisBlock Core)
- WisBlock Base Board (RAK5005-O)
- WisBlock EPD Module (RAK14000)
- WisBlock 3-axis acceleration sensor (RAK1904)
- Li-Ion/LiPo battery
- Access to a 3D printer and filament for the heart case
At this point, you can already guess why we call it WisBlock Heart. It's because we're using several modules of RAKwireless' WisBlock modular ecosystem. Namely, The Electronic Paper Display (EPD) module is the main interface of the heart. This display shows messages that you can customize to impress your loved one. On the other side, the acceleration sensor helps the WisBlock Heart detect when you shake it to change different phrases.
Some of the message configuration options are possible by of the use of the RAK4631 WisBlock Core. This core has Bluetooth Low Energy (BLE) and LoRa communication. The BLE capability allows using an easy configuration interface and debugging from a mobile phone. On the other hand, LoRa communication enables the feature of reporting WisBlock Heart data and receiving remote instructions to set custom messages via LoRaWAN – in this case, we will be using Helium as a LoRaWAN Network server to report messages updates in our heart from the cloud.
Step-by-stepHardware setup
- Connecting the WisBlock Modules
- Connecting the antennas
- Printing the heart case
- Mounting in the heart case
Flashing the firmware
- From PlatformIO
- From a ready-to-use package
Setting your customized messages
- Over serial
- Over BLE
Expand the features connecting to LoRaWAN (optional)
- Creating the device in the Helium Console
- Setting up the LoRaWAN parameters
- Scheduling downlinks to set new messages for the WisBlock Heart
What's next?
Hardware setupThis section will describe how to attach all WisBlock modules and the necessary antennas. In addition, some information about the heart case to be printed and the assembly process.
Connecting the WisBlock Modules
First, connect the RAK4631 WisBlock Core to the Base Board (if not connected yet). Then, place the accelerometer in slot C, which contains the interrupt pin configured in the firmware to wake up the WisBlock Heart whenever motion is detected. Next, you need to connect the EPD to connector J3 on the RAK14000 board. After that, connect the RAK14000 board to the WisBlock IO slot carefully. Even though we're not going to use the Three-Pushbutton Switch, these instructions described in our documentation center may help you. Finally, always make sure that the WisBlock modules are connected using compatible tiny screws. To better understand the previous instructions, refer to the diagram below.
Connecting the antennas
The RAK4631 has a label on its sticker highlighting where to connect the antennas. In this case, you need to connect the BLE and LoRa antennas as shown below.
Printing the heart case
Download the heart-shaped box model files for 3D printing at WisBlock Heart - Thingiverse.
Printing parameters may vary according to the material and 3D printer. Nevertheless, as a reference, the final result we use to show in this tutorial was printed with PLA using the default profile available for the Ender 3 in Ultimaker Cura. The estimated time for each of the main parts is roughly 4 hours.
Mounting in the heart case
After printing, it's an excellent time to familiarize yourself with joining the pieces together. First, join the parts on the sharp end side, which has a snap mechanism. Then click the other side together. Printing may take some time, but the result is worth it!
Once you tested the closing procedure, if everything went OK, separate the pieces and put the WisBlock modules inside. First, slide the EPD carefully into the EPD holder. Then fix the WisBlock base with two screws using the holes on the left side.
There are two possible options for flashing. Select the one that is most convenient for you.
From PlatformIO
Let’s suppose you are already familiar with PlatformIO and running WisBlock projects using it. In that case, you can clone the project from GitHub by running the command shared below and using the PlatformIO upload option to quickly compile and flash it. This alternative is suitable for those looking to review the firmware source code, contribute to it or use it as a baseline for another project.
git clone https://github.com/rakstars/WisBlock-Heart
However, you can use this guide if you haven't used PlatformIO with WisBlock before and want to explore setting it up.
From a ready-to-use package
Another option is to flash a ready-to-use package available on the GitHub repo releases.
Download the using the following command and setting the <version>
according to the latest release.
Follow the step-by-step provided in this post to verify that the RAK4631 has the latest bootloader. Then you can use the following adafruit-nrfutil command to upload the firmware file you previously downloaded. Remember to set the <version>
and specify the serial <port>
to which the WisBlock is connected.
adafruit-nrfutil dfu serial --package RAK4631-WisBlock-Heart_<version>.zip -p <port> -b 115200
The green LED flashes while the new firmware is uploading.
Once the firmware is flashed, you are ready to set up the WisBlock Heart.
Setting your customized messagesSince the firmware uses the WisBlock-API library, you will find two main options to set up the WisBlock Heart without digging into the firmware source files. The first is a serial interface that you can access while the WisBlock is connected to any of your PC’s USB ports. The second uses the BLE capabilities to send the configuration from a smartphone.
You can add four different messages with a size of up to 80 characters. In addition, each line of the display can show 20 characters, so you will have to take that into account to avoid split words or when centering your messages. Adding some spaces can help you to show them correctly!
The idea is to send an AT command in the following format.
AT+SETMSG=<message_number>:<text>
The <message_number>
parameter must be an integer number between 1 and 4. Whereas the <text>
parameter must have up to 80 characters as we mentioned previously.
Over serial
Open your preferred tool to connect with serial ports. For instance, CoolTerm, PuTTY, Tera Term, the Arduino Serial Monitor, or the PlatformIO monitor command are standard options.
Let's say you want to modify message number one, the command to send it would be
AT+SETMSG=1: My New Message
Each time the set command is received, the WisBlock Heart stores it in memory and displays it on the screen.
Over BLE
WisBlock Toolbox is a mobile application for Android. It includes a UART module to communicate AT commands using the BLE UART service in the WisBlock. However, even though it is only available for Android, mobile apps that implement the BLE UART. For instance, iOS users can download nRF Toolbox as an alternative.
Using the WisBlock Toolbox UART module
Download WisBlock ToolBox available for Android devices on Google Play.
When you open the WisBlock ToolBox, you will find several modules. First, select UART. Then, click on the Bluetooth icon to display the list of available devices and choose your WisBlock Heart from the list; it is shown with the prefix WB-Love. Next, send the AT command.
AT+SETMSG=2: You are a RAKstar
Using the nRF Toolbox UART module
The WisBlock Toolbox app is not available for iOS users yet. However, the nRF ToolBox app can be used as an alternative. The process is very similar to the one described for the WisBlock Toolbox. Basically, you can send the commands in the same way after establishing a connection to the WisBlock using the UART module within the app.
Download the nRF ToolBox from Google Play or the App Store. Connect to the WisBlock, and send the command. The following animation shows the process to send an AT command that will be used for setting up one of the parameters to join a LoRaWAN network.
You have already explored and configured some features of the WisBlock Heart. However, we invite you to go deeper and use this project as a way to spread your knowledge about LoRaWAN and how it could be easier when using WisBlock.
Let's say that our goal for this section is to set messages of the WisBlock Heart remotely. For instance, you have something else in mind to express after gifting it. LoRaWAN downlink messages are suitable to do something like this.
The Helium Network continues growing, and it could be very likely that you have coverage through at least one of the many hotspots deployed at this moment. The following steps will guide you on how to achieve the goal we are aiming for.
Creating the device in the Helium Console
Sign in to your Helium Console account at console.helium.com. If it's the first time you use the Helium Console, you will find the option to register for an account.
Click on Devices, select Add New Device (+), give it a name, modify the device EUI according to the one printed on the RAK4631 sticker (it's the one you get when reading the QR code) and click on the Save Device button.
WARNING
After device creation, you will notice a Pending... indicator, which means the device is waiting for an internal process within Helium Network logic before its first join. It could take up to 20 minutes. This behavior is related to the XOR filter mechanism, and you can find more information about it here.
When you click on the device to view its information, you will find a bug button on the right side to view the device’s packet transfer logs in real time; this is a perfect option for debugging that we will use later.
Setting up the LoRaWAN parameters
We previously described the procedure for setting up custom messages for the WisBlock Heart. This is very similar to the one we're are going to use in this section.
The parameters to modify are those that differ from the default configuration. In this case, the identifiers and the AppKey for joining the network using the Over-the-Air-Activation (OTAA) method and the region frequency.
IMPORTANT NOTE
For regions such as US915 and AU915, it is possible to configure a regional channel mask (aka sub-band), which allows choosing the subset of channels the device uses to send the LoRaWAN packets. Currently, Helium uses sub-band 2 for those regions.
Over serial
First, connect to the serial interface. Then use the commands below.
From the Helium console, you can copy the values to set <YOUR_DEVEUI>
, <YOUR_APPEUI>
, and <YOUR_APPKEY>
.
Set the Device EUI.
AT+DEVEUI=<YOUR_DEVEUI>
Set the Application EUI.
AT+APPEUI=<YOUR_APPEUI>
Set the Application Key.
AT+APPKEY=<YOUR_APPKEY>
Possible values for the <REGION_CODE>
parameter for the following command are:
Set the LoRaWAN region
AT+BAND=<REGION_CODE>
If the sub-band configuration is needed for your region, you can set it up with the following command.
AT+MASK=2
Set the automatic transmission period in seconds for the uplink messages.
AT+SENDFREQ=60
Start the joining process.
AT+JOIN=1:1:8:10
Detailed documentation about all AT commands with their parameter options, is available in the WisBlock-API documentation. You won't find the AT+SETMSG command over there; that's because it's a custom command for this project. Yes, you can extend the AT command interface.
Over BLE using the WisBlock Toolbox LPWAN SETUP module
We also talked a little bit earlier about the BLE option for setting custom messages for the WisBlock Heart. The process is very similar to the one described for the serial option using AT commands in the previous section. You can use the BLE UART module of the application of your choice, but the WisBlock Toolbox includes an LPWAN SETUP module to handle the configuration more quickly.
Open the WisBlock ToolBox and this time select the LPWAN SETUP module. Then, click on the Bluetooth icon to display the list of available devices and choose your WisBlock Heart from the list; it is shown with the prefix WB-Love. Next, enable the Auto join option, select the region, and set the value for the Send Repeat Time option. Then enter the LoRaWAN credentials and set the Subband value (if required).
Using the Debug View for watching the first join
After the LoRaWAN setup, the WisBlock will attempt to join the network. If there's a hotspot in range, you will receive Join Request messages in the Helium console Event Logs. In addition, you can use the Debug View to see more detailed information. Each time you turn on or reset the WisBlock, a new join procedure is performed.
Scheduling downlinks to set new messages for the WisBlock Heart
On the right side, next to the Debug View option, there's another button with a cloud icon for sending manual downlinks. Click it, select the Text option and type a payload using the format <message_number>:<text>
. Then, press the button to schedule it.
The Event Logs will record when the downlink is queued, and each time an uplink is tried after uplink messages. Sometimes the device doesn't get the uplink the first time. Since we left the "I'd like confirmation of response" option checked, the downlink is tried until WisBlock responds.
If you have connected the serial interface, you can get some logs when the message is successfully received by WisBlock Heart.
What's next?We hope you enjoyed and learned walking through this tutorial and using it as a way to express your love ❤️ as a RAKstar.
Share your results and tag us on our different social media channels. Don't forget to join our Hackster Community!
Comments