Arduino Home

An Open-Source platform to create digital devices and interactive objects that sense and control physical devices.

Arduino Tutorials
Arduino Projects


Main Console LCD



1.     Introduction

This blog details my project undertaken as part of Join the Challengers: Build a Smarter World: Build an Arduino MKR WAN 1300 Project for an Arduino Engineering Kit! and my initial ideas posted Elderly Person in the Community Care: Arduino MKR 1300 WAN

The Element14 challenge was to build something using a pair of the newly released Arduino MKR1300 Lora boards and an associated MKR relay board. My idea was to build a small network that allowed a warden to monitor the well-being of several elderly persons who would be able to carry on living in their own accommodation whilst still being able to summon help if required. The basis for using the LoRa technology was that they would not need to subscribe to a broadband service and the system could operate just as well in rural areas. The Element14 community team selected me as one of several successful applicants, so many thanks to tariq.ahmad. Shortly after the announcement I received a parcel from Element 14 which included two Arduino MKR1300 LoRa boards, the MKR relay board and an assortment of 'swag' .


2.     What is LoRa/LoRaWAN ?

When I applied for this roadtest I thought I understood what LoRaWAN was but, as apparent from my comments in Join the Challengers: Build a Smarter World: Build an Arduino MKR WAN 1300 Project for an Arduino Engineering Kit! , it is obvious I was wrong. It turned out that the MKR WAN 1300 boards were meant to connect to another piece of equipment, effectively a LoRa router/hub and that would allow access into the WWW - I didn't have such a unit and they seemed quite pricey. Such a setup is more geared to remoting IoT devices over a vast area, being able to access them from anywhere with Internet access. I also didn't really need to do that as I wanted to form my own, locally distributed, network of devices utilising my own packet structure.....and luckily the other Element 14 Community Members found a way to do that.


A LoRaWAN Gateway:

The New Arduino LoRaWAN Gateway


Under the Element14 Essentials there is a good learning article on LoRaWAN.

element14 Essentials: IoT II: LoRaWAN for IoT Applications


3.    Hardware

3.1     Provided Equipment

{gallery} Element14 Provided Kit

The MKR WAN 1300 Board (two provided for this test)

MKR WAN 1300

MKR Relay Board

MKR Relay Board

3.2     Extra Bits

The Arduino MKR WAN1300 boards utilise a U.Fl connector which luckily I became familiar with following the Molex 2.4GHz / 5GHz Antenna Kit - Review  and around that time I was given a dev kit of antennas by the Molex team at a roadshow. There were two thin-film antennas in that dev kit that I was able to use for this project although in the longer term I would use external antennas to increase the range.



{gallery} Antennas

WCC Main Antenna

Molex antenna

Console Antenna

Molex antenna for Console



{gallery} Sensor Parts

Temperature Sensor (I2C) Using LM75

LM75 Temperature Sensor

Microchip MM7750 Motion Sensor

Microchip MM7750 Motion Sensor Tile

Pulse Sensor - MAX30102

MAX30102 Pulse Sensor

4.     System Overview

4.1     Keep It Simple

The aim is to keep the system simple. The end user has only three buttons to press which correspond to:

  • 'I am OK'
  • 'I would like someone to call me/drop by'
  • 'Emergency'

The user will see the corresponding LED illuminate to show the status and these will flash after being acknowledged by the WCC, to give reassurance to the end user. The user can cancel the 'Assistance' call themselves but not the 'SOS'....important in perhaps an intruder situation. The various flags are set by LoRa messages and utilised in the logic accordingly.


The temperature of the user's home would also be sent back - action could be taken if it is too low (risk of hypothermia or frost damage) or could indicate a fire if too high.


The initial plan was to also add a PIR to the main unit to detect movement in the property and to correlate that to 'normal activity'.


4.2     LCD

As you can see I added a nice 4 line x 20 character LCD display for displaying system information on the CONSOLE unit. This was a I2C 5v unit. My first experimentation was trying to get the I2C working with my Arduino Uno (again the one that Element14 kindly gave me in the past for a project build). Once I got that working I had to interface the I2C to my Arduino MKR - but the MKR is 3.3v and the LCD was 5v. Initially I made a converter board using a SMT TBX0104 unit - that didn't work and I finally found an article that suggested it wasn't the best choice of device for I2C voltage translation. Undertaking an image search soon showed a nice schematic that utilised N-channel MOSFETs for this task. I only had a reel of SOT-23 SMT devices so had to mash them together on a piece of Verobaord:

My 3.3v to 5v Voltage Translator for I2C Bus


5.     Code Development

5.1     Getting Started Coding

I think I would have been completely lost with this new board, which can be seen in the related discussions, if it had not been for mahmood.hassan

and fmilburn so I owe them my kindest thanks for sharing their knowledge and help and to the underlying SandeepMistry Github content from


5.2     IDE Choice

To enable me to continue the design over the festive period, regardless of where I was, and what computer system was available to me, I opted to try out the online Arduino IDE....I found it very good, although at times it seemed to get confused about the COM port connection and I had to restart the web app (resetting the board/pulling the USB did not allow the download to complete). Finally however I started to get issues where my saved version was not the version being uploaded, lots of save errors started to roll up the screen and I decided to select all, copy and paste my valuable code into the installed version of the IDE rather than the cloud based one. Up until that point I really liked the cloud version and will be taking another look at it once this project is finished and I have some more time.


5.3     Code Design

Code development started as a hand-scribbled block diagram and directly transposed to the Arduino code. The main loop in the console loops continuously, reading any LoRa messages, sending our message every 10 seconds, reading the sensors and updating the display. Likewise the WCC unit also loops around listening to the users' console messages and periodically sending out their own messages like time of day. I was cautious not to approach the task by writing lots of code for one end of the link before the other was written as I knew that was a setup for disaster and lots of debugging. Instead I wrote small sections for the user console and then modified the WCC code accordingly....often having one setup in the kitchen (running on my laptop and the Arduino Cloud IDE) and the other setup in the lounge (running on my PC and the downloaded IDE). That was I could also stay 'socialable' over the Christmas holiday whilst writing much of the code. All project code (at time of post upload) is found here


5.3.1     WCC

The code for the WCC setup can be found here

IDE dev of WCC

5.3.2     CONSOLE

The code can be found in my Github repo here


6.     Wearables and Bluetooth

For the users I also wanted to monitor their activity and health and be able to use that to inform the WCC if intervention might be required. Alas the MKR1300 does not have the sensors I required a more portable device as a wearable tech. I decided to utilise my MKR1010WAN board to receive BLU data and feed it to the MKR1300 LoRa via the UART pins. I was now free to utilise whatever I wanted to create the BLU wearable unit.

Parts for Wearable

Unfortunately I have little experience of using BLU and my time was quickly eroded in research and nugatory testing. I spent a few weeks playing around with the Pocket Beagle board that Element14 had kindly sent me as part of the Wearable Tech challenge, another week trying to use the BBC Micro:Bit before finally settling on making my own bespoke unit....unfortunately on reflection, I spent too much time concentrating on this aspect.


I bought this case and BBC Micro:bit to make the wearable for this but had trouble getting the BLU to work and again, moved quickly on (albeit after another wasted week ! ). Its quite a nice case and something I saw in a past Element14 Roadtest.

BBC Micro:bit and wearable case

I had hoped to enter these sub-projects into the Element 14 Project 14 for wearables,


7.     Time For a PCB?

Concentrating on making my own wearable I spent too much time trying to design a PCB, before deciding to finish the actual EPCC design itself first. This small wearable was aiming on integrating the MM7750 Microchip motion sensor tile, the RN4020 BLU module and a Microchip PIC microcontroller. Most of these used SMT or sub-0.1" pitches and so would make prototyping awkward....I decided to make a PCB (and properly, not like I did for ledog - Light Emitting Dog ).


I aimed to make this as low power as possible, communicating to the Arduino MKR1010 via BLU and from there to the MKR WAN1300 via the UART pins.


8.     Operation of System

8.1 System Time and Date

It would be awkward and perhaps difficult for each user to set the time and dat on their CONSOLE unit. Therefore the system time and date are initially set to 00:00:00 and 1st Jan 2001 but the WCC periodically sends out a MULTICAST packet to update all connected CONSOLES. This is seen in the pictures below. The WCC operator can also use the monitor's command line to adjust time and date locally (but this will also be sent out to all consoles). This is achieved with the commands "Thhmmss" or "Dddmmyy".

{gallery} Console LCD

Console Screen - Initial Splash Message

Console Screen - initial splash

Console Screen - Second Splash

Second Splash

Console Screen - Date and Time Automatically Updated from WCC

Auto time and date update9.1

8.2     System Operation

When the console boots the green OK LED is lit initially. The status of the CONSOLE's LEDs, switches and temperature sensor are sent every 10 seconds to the WCC via a LoRa packet. The user will then perhaps select ASSIST or SOS and these will illuminate solidly. This message is displayed on the WCC console and will await action my the WCC operator(s). A typical setup might be that they acknowledge the request immediately, action as appropriate and finally clear the user request. The WCC operator will do all this from their Arduino Monitor console via the input line. The process is instigated by the WCC operator using the 'Q' for query and then the user ID number.


Acknowledging the situation will cause the appropriate LED to start flashing on the user's console, giving them that reassurance that their call has been noticed and will get actioned. When the WCC operator clears the calls the appropriate LED is extinguished and the green OK LED is illuminated on the user's console....they are then able to make another 'button call' if required. This operation is a bit awkward to convey in this blog (a video of the LED's illuminating when a button is pressed is not very interesting !) so instead I have included some of the MKR WAN 1300 outputs for both the CONSOLE and WCC.


A sample of data from the CONSOLE unit - shows automatic time and date updates from the WCC along with an CLEAR message for the USER's SOS call. The user does not see all this, it is used for testing and fault finding - the user sees the simple LEDs and the LCD screen.


Below is some sample data from the WCC running shows the screen after the operator has queried the ID message using "Q45678" - the 'S' button was pressed. This caused the MKR WAN 1300 to Transmit a packet which was interpreted by the CONSOLE MKR WAN 1300 and reset the SOS message (their LED went GREEN). The screen shot below shows some of the spurious data on the transmitted packets - the 'E' appearing on the end. Perhaps I needed to flush the Serial buffer more carefully ?

WCC Log file output

8.3     Issues

Testing this system became quite awkward as the system complexity increased and I was going back and forth between rooms, closing the door to stop the dog escaping, negotiating the chairs/table and annoying anyone trying to watch the TV. At times I re-located both setups to reduce the travelling time (for me) but it was a bit unsociable. The issues I had included occasional spurious packet content and some messages from the WCC not being transmitted (or received?). I think it was something to do with the LoRa buffer - so tried flushing it and finally added a 'stuffing packet' to help clear things out - the latter seemed to help and so is still in the associated code.


8.4     Boxing Up

Unfortunately my project never made it this far....almost....but still not quite there. This is the front decal artwork that will be glued onto the enclosure, the grey rectangle is where the LCD will be mounted, the circles are for the coloured push switches and LEDs:

Console Decal

9.     Further Work

I would have hopped after that massive Christmas break and all the weeks surrounding it that this project would be 99% finished. The project planning didn't follow as expected so there is still much more that I'd like to add to this project and there are some issues noted.


  • No security of data currently
  • The WCC is command line and needs to interpret the packets to human readable messages.
  • Occasionally the WCC locks up
  • Occasionally I see spurious packet contents on the CONSOLE
  • Add the PIR motion detect
  • Utilise the Pulse Sensor
  • Break out into the MKR1010 WAN + BLU Wearable unit
  • Mounting the units in the case
  • Range testing (currently 10m range, internal to house)
  • Database correlation - to make names and addresses/phone numbers available to the WCC operator(s)
  • Use the MKR Relay board to sound alarm/light for any outstanding alerts
  • System Time and Date updates can be far less frequent (only higher for testing project)
  • Add the system status to the LCD (line 4 )


10.     Conclusions

On reflection I was probably too ambitious in my ideas for the amount of knowledge I had, especially in the BLU area. Making a bespoke wearable and PCB was also another big step in itself. All this was coupled with planning to have lots of time off over the festive period but instead loosing much of that to repairing my LED Firework Suite - the details , visiting friends and repairing my car.


However I am very pleased with the project so far, being able to command messages, see them on the WCC and acknowledge/clear as required. Another milestone for me was successfully integrating 3.3v and 5v I2C in this project, and quickly adding other I2C devices online. That is a building block that will get copied again and again !


I was also very pleased with the automatic time and date updates and the ability to read/transfer the CONSOLE temperature to the WCC.


Such a system as the EPCC could be produced at a low cost - apart from the MKR1300 there is little else required (ignoring the wearable aspect). The biggest cost would be in manpower costs monitoring the signals at the WCC and responding as required. This could be undertaken cheaply by telephone and passing concerns on to the emergency services if necessary. Ideally the WCC would be covered 24 hours by two people at all times, and one would be able to make house calls as required....that would be much more expensive. I also would not be able to gauge the best ratio for numbers of end users to WCC staff....something like 20:1 seems reasonable but would again depend on frequency of calls, time of year perhaps and distances between them if opting for house calls.


11.   Final Thoughts

I'm looking forward to continuing progression of this project in the future adding some of the capabilities I aspired to and adding extra functionality. I would also like to add a second Console to test the operation of the WCC with multiple nodes. There is scope for better antennas (to increase range), finishing off the enclosure and the wearable aspects.


I hope you have enjoyed reading my blogpost and this inspires you to try out (1) the MKRWAN1300 and/or (2) the Arduino Cloud IDE


Although I have not used the LoRa boards as a LoRaWAN (i.e. as IoT nodes feeding into an open LoRaWAN network) I have found them to be very useful in setting up a free and low resource requirement system. The boards are very easy to use and I found the online Arduino IDE particularly good. Thanks again to tariq.ahmadmahmood.hassan and fmilburn.