Twitter icon
Facebook icon
LinkedIn icon
Google icon
Reddit icon
StumbleUpon icon
Del.icio.us icon

DIY Smartphone LoRa Connection

Added to IoTplaybook or last updated on: 11/20/2020
DIY Smartphone LoRa Connection

Story

This project will help you create a connection between your phone and a LoRa module using the USB port and an Arduino Lilypad USB. There is an example chat app for point to point communication, and, you can modify it to make even a TTN sensor out of a smartphone :)

Things used in this project

Hardware components

 
USB RFM App Components
 
× 1

AliExpress

 
PCBWay PCB Board A
 
× 1

PCBWay

 
PCBWay PCB Board B
 
× 1

PCBWay

Software apps and online services

Arduino IDE
Arduino IDE
 
  Arduino
Android Studio
Android Studio
 
  Android Studio

Story

This project will help you create a connection between your phone and a LoRa module using the USB port and an Arduino Lilypad USB. There is an example chat app for point to point communication, and, you can modify it to make even a TTN sensor out of a smartphone :)

Find us on Twitter

Step 1: Hardware

You can find all hardware elements here, or listed above.

You can choose between these two Atmega32U4 3.3v 8MHz models, although the black one seems to be a little bit better, the blue one stops working sometimes with my black phone ...

It is important to use OTG cable adapters

Note about the PCB, there are 2 options, left or right.

Choose one depending on what side you want to solder your chips

Since it is going to be in touch with your phone, I make use of sandpaper and transparent tape to make it smoother and protect it from short circuits

there actually is transparent tape covering the contacts :)

Step 2: Software

Now you have to setup the Arduino IDE, note that you can use any other framework you like. It is not difficult but you have to do one or two things in order to compile the project.

Code is hosted in github.com,it is open source, feel free to contribute, reporting bugs or making suggestions would be great :)

Download it and open:

ArduinoIDE/USBRFMApp/USBRFMApp/USBRFMApp.ino

Change Sketchbook location under file --> preferences

If needed add additional boards under file --> preferences... I've been using:

https://adafruit.github.io/arduino-board-index/package_adafruit_index.json

Select your board under tools --> Board

It should now compile.

Now open:

ArduinoIDE/USBRFMApp/USBRFMApp/Defaults.h

Change the default values if needed, they are in hexadecimal, I hope you can handle them, upload it to your board and configure it using the android app.

Android app Interface Configuration

Once it is all connected you can open and configure your device using the app located at.

USBRFMApp/USBRFMApp.v1.apk

You can use that one, compile one yourself or download it from Google Play Store

It could be possible to connect your browser directly to the USB port using the Web Serial API, but at this time it is not mature enough and it does not work with phone browsers, that's why you have to use an Android app to access your USB port, it may be changed in the future

The example chat program sends and receives encrypted messages using AES-256-CBC, the key depends on what room is configured under settings, use some secret room name for privacy, the same has to be configured in every device you want to chat with ... It is pretty easy...

Step 3: Custom App

If you want to get rid of the chat system and read/write raw bytes from/to the RFM module open the Android Studio Project, edit the following file and add your logic.

AndroidStudio/USBRFMApp/app/src/main/assets/USBRFMApp/app/App.js

I hope it is clear enough

Find us on Twitter

Schematics

USB RFM App

Code

USB RFM App

pulsartronic / USBRFMApp

smartphone LoRa device connection - Android - USB - Arduino - LoRa — Read More

Latest commit to the master branch on 10-23-2020 - Download as zip

Credits

pulsartronic

pulsartronic

I actually live in Mordor but they don't let you say it.

 

Hackster.io

This content is provided by our content partner Hackster.io, an Avnet developer community for learning, programming, and building hardware. Visit them online for more great content like this.

This article was originally published at Hackster.io. It was added to IoTplaybook or last modified on 11/20/2020.