Introduction: IoT Toaster (LoRa)

About: Software Developer with a great enthusiasm

IoT Toaster

A toaster that can be both monitored and controlled through an custom made Android application.

The toaster is equipped with an SODAQ ExpLoRer card that has a 32-Bit ARM Cortex M0+ and a integrated LoRa module and antenna. This LoRa modules provides for the communication between the mobile and the toaster via a gateway. The LoRa communication operates on the ISM band at 868Mhz and are typically used in IoT applications due to its low energy and long range performance (+ free of charge to operate on the 868Mhz band). Read more about LoRa here:

An Andorid application has been developed that are able to wirelessly control the toaster by means of lowering down the breads in the toaster and turn the heater element on for a specifed amount of time. Three different ”toaster” levels can be chosen by the user(rare,medium,well done). At the same time it will monitor the outside temeperature of the toaster. All communication is directed through the LoRa gateway and further processed by PubNub that makes it possible for the Android application to subscribe and publish data form the gateway through a channel.

Step 1: Hardware Parts

1. Toaster (any toaster with similar lifting mechanism will work) :

2. Stepper Motor – Linear Stepper motor:

4. Stepper Motor Driver:

3. Sodaq One Explorer – LoRa:

4. Battery holder – 12V:

5. Switch (any 12V switch will work):

6. Aluminium Profiles:

7. Cables,Screws and Batteries

Step 2: Material

2.1 - Measure the each of the sides on the toaster and cut out the aluminium part of that. In this case, the aluminium plate's dimension is 33,5 x 13,5 cm (picture). Make four holes that match the frontpanel holes of the toaster. In this case they are placed in each corner of a rectangle with diemension of 31,5 x 12,5 cm.

2.2 - Make two holes (location is up to you). The first hole needs to be 11 x 5,5 cm in order for the SODAQ card to fit. The second hole needs to be as large as your switch are. Make a plexiglass with the same dimensions as in the picture. Drill two holes to support for the SODAQ card.

2.3 - Take the aluminium profiles and cut into two pieces. The length should be equal to the side of the aluminium plate.

Step 3: Mount the Stepper Motor

WARNING! Modifications on electrical products may cause svere damgage if not handled correctly!

3.1. Remove the nessecary srews that holds the shell onto the heater element and it's structure.

3.2 Remove the rod that holds the toaster levler in vertical position.

3.3. Use a screwdriver to make a hole right below where this rod should have been placed. Make sure you are not drilling into any electronics!

3.4. Replace the orignial rod with the linear motor and fasten the plastic mount on top of the plastic structure with three srews (picture). This will now act as the new motorized rod, which we will able to control!

Step 4: Connecting Hardware

4.1. After the motor have been mounted onto the toaster, connect it as in the above circuit diagram (picture). I used an experiment board to solder the nessecary connections between the signals and used three headers to be able to mount it on the SODAQ card.

4.2 Put it all togheter and take some adhesive tape to mount the battery holder on the back of the aluminium plate(picture). Use the screws to mount the plate on the toaster.

Step 5: Software Design

1. SODAQ Node – The node that controls the toaster and sends motor commands to the motor driver that controls the stepper motor. The stepper motor will lower or raise the toast depending on which command that has been given by the user.

2. Multiconnect Conduit – The gateway which the SODAQ node connects to over LoRa once powered up. The gateway provides a channel which data are transferred to talkpool.

3. Talkpool – Is the server provider that makes it possible to interface to the different IoT platforms via the integrated protocols. Protocols availabe to use is: MQTT, PubNub, IBM Bluemix. (In this project we are going to use PubNub)

4. PubNub – IoT platform that act as a central hub where the traffic are sent thorugh channels. Subscribe/Publish structure. Different SDK provides for different platforms to be used (In this project we are using the SDK for Android)

5. Android Application – With the PubNub Android SDK, the application provides a graphical interface to the user that shows the temperature of the toaster (subscribe channel). Moreover, it is also possible to control the toaster via buttons in the application (publish channel).

For further reading and tutorial:

Step 6: Register Device on Talkpool

There are several of LoRa gateways on the market, the MultiConnect® Conduit is just one of many.
For example, a cheaper solution would be Wirnet iFemtoCell by Kerlink, LG01-P LoRa Gateway from Dragino or The Things Gateway.

Talkpool is our local server provider in Sweden but there also exist other ones, for example LORIOT or The Things Network. Depending on which server provider that is used there will be different configuration methods.

After configuring the gateway via Talkpool we proceed by logging in and register our device.

6.1. Press the plus sign to add a device (picture), the hit "Generate An Application EUI" (picture), then type in a unique name for the device.
6.2. Go the tab "Customer Servers" and then press the plus sign (picture)
6.3. Press the "Protocol type drop down menu and select PUBNUB.
6.4. Add your PUBNUB publish key and subscribe key.(picture) (How to add these channels and get the keys will be covered in the next step)

Step 7: Creating a PUBNUB App

7.1. Create an account at PUBNUB (
7.2. Press on the red button "Create New App" - (picture)
7.3. Name the app and press ok.
7.4. Press on the newly generated app card with your name.
7.5. Now you can see your Publish Key and Subscribe Key(picture). Copy those and type them in the Talkpool device fields for the PUBNUB settings (previous step). Do also type them in the Android Project (in step 9)

Step 8: Source Code - Sodaq Explorer

The source code is written and downloaded to the SODAQ card using the Arduino IDE. Make sure to add the requried libraries before deploying the code:
"Install the required libraries from the Arduino library manager.Sketch -> Include library -> Manage libraries…Install “Sodaq_RN2483” and “Sodaq_wdt”
More info here:

To get your DevEUI, follow this tutorial here:

The AppEUI is the one you generated on Talkpool (step 2).

Remember to change the following paramters in the SODAQ_Source_Code:
const uint8_t DevEUI[8] =
//Type in your DevEUI key below in HEX format
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00

const uint8_t AppEUI[8] =
//Type in your AppEUI key below in HEX format
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00

const uint8_t AppKey[16] =
// Type in your app key below in HEX format
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00

Other important paramters to consider:
// Depending on your stepper motor, type in the number of steps for one revolution
const int stepsPerRevolution = 200;

// Type in your own times for the three different levels (in milliseconds)
int rareTime = 30000;
int mediumTime = 60000;
int wellDoneTime = 100000;

Step 9: Source Code - Android Application

Remember to change the following parameter inside the MainActivity
The subscription and publish keys is the ones generated in step 7.5 and the deviceEUI in step 6.1):

private static String pubNubSubscriptionKey="sub-x-x-x-x-x-x";
private static String pubNubPublishKey="pub-x-x-x-x-x-x";
private static String deviceEui = "xx-xx-xx-xx-xx-xx-xx-xx";

Step 10: Debug Communication

To ensure that the bidirectional communication is working from the SODAQ card all the way to the Android App we brake it down in smaller pieces to make it easier to debug.

10.1 - First of all we check that the SODAQ card is able to connect to the gateway. We can do this by either looking on the leds on the SODAQ card, or simply by connecting the SODAQ card to the computer with a micro USB and read the serial line on baudrate 57000.
SODAQ Serial monitor picture

10.2 - Make sure that the gateway receives the packages that are sent from the SODAQ card by logging in to the server provider (in this case Talkpool).
Talkpool communication picture

10.3 - Make sure that the data packages are recevied in PubNub respective channels (sent from talkpool) by logging in and view the previously created channels. Check the "Incoming" channel for the data packages sent from Talkpool.
PubNub communication picture

10.4 - Open Android application to ensure that the "Latest update" is recevied with a timestamp (this ensures that data are received all the way from the SODAQ card to the Android Application). If the communcation work "upstreams", then try send a message to the SODAQ card by selecting a toaster level and press "Toast my bread". Then you can debug the other way around to make sure the communication works "downstreams" as well. The SODAQ card will print out on the serial lines when it receives a package and what action it will do.

Android communication picture

Android communication picture

Step 11: Demo

Wireless Contest

Participated in the
Wireless Contest