LoRa (Long Range) is a wireless modulation technique that enables long-distance communication with low power consumption. It is widely used in IoT applications, such as smart agriculture, environmental monitoring, and asset tracking. LoRaWAN, on the other hand, is a network protocol that operates on top of LoRa, providing features like secure communication and device management.
I can remember that for my college project (6 years ago), I created a simple P2P LoRa network and presented it. But sadly my professor won't approve it and he mentioned that these kinds of networks won't be sustained. Because of many reasons like cost, data rate, and many things. So, I changed to the new one(A kind of Air Quality Monitoring System)
From that moment onwards I keep on checking the LoRa. It keeps on evolving and improving. After the P2P network, I want to try more things like TTN. But my biggest problem was the cost. In India, I can a LoRa module but the issue is hardware connections, the right libries, and most importantly the Gateways. It's not cheap in India.
When I wanted to try out the TTN, my issue was the gateway. So, I can't try at the moment. Even if you try to import from other countries the import duties are really high. Finally, I paid around 2x charges for customers and I have imported the gateway.
Then I realized if someone like me wants to try the LoRa network it's really hard. So, I thought of making a plug-and-play USB device that helps to get started with the LoRa network.
So, you just need a device that accepts USB communication to send and receive commands to get started in the LoRa World.
I plan to use a USB to UART bridge controller with LoRa a module and an onboard PCB antenna. So, everything is packed in a portable and small PCB. Here is the schematic of my PCB.
In this schematic, I have used a Seeed Wio E5 LoRa chip, which is cheap and powerful
also, I have used Silicon Lab's CP2104 Chip for USB to UART bridge.
and here is the final design of my PCB.
Once I have done with the design, I just upload my files into Seeed Fusion to fab and assembly my board. The process is really simple, just upload the gerber and select all the design parameters then upload the Gerber that's all. You will get your PCBs soon. You can easily review all the fab and assembly processes.
Instead of using wires, you can create your customized PCBs with Seeed Fusion PCBA services, and they're also offering free prototype and functional testing on your first sample.
Here you can find out more info on the Wio E5 and Wio WM1110.
The Final board:Here is my final board, which I have received from Seeed Fusion service.
These things are really a small one.
After the visual inspection, everything was okay. Next, I just connected the board to the USB board.
Luckily there is no magic smoke. So, it's alive.
Then I wanted to try the simple AT command to test the LoRa Wio E5 connection.
Here you can see the response. Which means it's functionally it's working well.
Let's Test the P2P:So now all the inspections are done. Next, I can try out the P2P. Enter these commands to the receiver side:
- AT+MODE=TEST
- AT+TEST=RXLRPKT
Enter the following to the transmitter side:
- AT+MODE=TEST
- AT+TEST=TXLRPKT, "AB"
- AT+TEST=TXLRSTR, "AB"
Here is the response from the device.
Now, this can work so, I wanted to try out the TTN. I have used this Python script to get the device information.
import serial
import time
def send_at_command(command, wait_time=1):
"""
Send AT command and read response
"""
# Add CR+LF to command
command = command + '\r\n'
# Send command
ser.write(command.encode())
time.sleep(wait_time)
# Read response
response = ''
while ser.in_waiting:
response += ser.read().decode()
return response
port_list="COM32,COM33";
port_list=port_list.split(",");
# Configure serial port
for index, port in enumerate(port_list):
print("\n port "+str(index+1)+" "+port+" opened\n")
ser = serial.Serial(
port = port,
baudrate=9600,
bytesize=8,
parity='N',
stopbits=1,
timeout=1
)
try:
# Test commands
commands = [
'AT', # Basic AT test
'AT+MODE=TEST', # Set TEST mode
'AT+ID', # Configure RF frequency
]
# Send each command and print response
for cmd in commands:
print(f"Sending {port} command: {cmd}")
response = send_at_command(cmd)
print(f"Response at port {index+1} {port} : {response}")
time.sleep(1)
except Exception as e:
print(f"Error: {e}")
finally:
# Close serial port
if ser.is_open:
ser.close()
print("port "+str(index+1)+" "+port+" closed")
print("----------------------x----------------------")
Here is the device response.
Next, let's write a simple Python code to connect to the TTN:
import serial
import time
def send_at_command(command, wait_time=1):
"""
Send AT command and read response
"""
command = command + '\r\n'
ser.write(command.encode())
time.sleep(wait_time)
response = ''
while ser.in_waiting:
response += ser.read().decode()
return response
def join_ttn():
"""
Join The Things Network
"""
# TTN configuration commands
ttn_commands = [
'AT+MODE=LWOTAA', # Set LoRaWAN mode
'AT+DR=EU868', # Set region to Europe
'AT+ID=DevEUI', # Get Device EUI
'AT+ID=AppEUI', # Get App EUI
'AT+KEY=APPKEY,"xxxxxxxxxxxxxxxxxxxxxxxxxxx"', # Set your App Key
'AT+PORT=1', # Set port number
'AT+JOIN', # Join TTN
]
for cmd in ttn_commands:
print(f"\nSending TTN config: {cmd}")
response = send_at_command(cmd, 2)
print(f"Response: {response}")
if 'JOIN' in cmd:
# Wait for join completion
for _ in range(10):
response = send_at_command('AT+JOIN?')
if 'Done' in response:
print("Successfully joined TTN")
return True
time.sleep(5)
return False
def send_data_to_ttn():
"""
Send dummy data to TTN
"""
# Example: Send temperature and humidity
temp = 25
humidity = 60
data = f"{temp:02x}{humidity:02x}" # Convert to hex
cmd = f'AT+MSG="{data}"'
print(f"\nSending data: {cmd}")
response = send_at_command(cmd, 2)
print(f"Response: {response}")
port_list="COM32"
port_list=port_list.split(",")
for index, port in enumerate(port_list):
print(f"\nPort {index+1} {port} opened\n")
ser = serial.Serial(
port = port,
baudrate=9600,
bytesize=8,
parity='N',
stopbits=1,
timeout=1
)
try:
# Basic AT test
if 'OK' in send_at_command('AT'):
print("AT test successful")
# Join TTN
if join_ttn():
# Send data every 30 seconds, 3 times
for i in range(3):
send_data_to_ttn()
time.sleep(30)
else:
print("Failed to join TTN")
except Exception as e:
print(f"Error: {e}")
finally:
if ser.is_open:
ser.close()
print(f"Port {index+1} {port} closed")
print("----------------------x----------------------")
Here is the TTN response.
I can able to view my data in the TTN network, which means my LoRa PCBs are working perfectly.
Campaign :I'm planning to launch a campaign to commercialize this ultra-portable LoRa USB device! The goal is to make this product widely accessible to everyone looking to explore the fascinating world of LoRa networks. Whether you're an IoT enthusiast, a student, or a professional, this device is designed to help you get started easily and affordably.
If you're interested in purchasing this device or supporting the project, please let me know.
Your feedback and interest will be invaluable as I gear up for this exciting journey!
Here are my contact details: pradeeplogu26@gmail.com and Twitter
Final ThoughtsBuilding an ultra-portable LoRa USB device is a meaningful step toward making LoRa technology more accessible and user-friendly. By simplifying the hardware and setup process, you're breaking down barriers for anyone eager to explore the potential of IoT and LoRa networks. This device not only empowers hobbyists and developers but also contributes to the growth of an ecosystem that thrives on innovation and collaboration.
As you embark on your Kickstarter campaign to bring this project to life, you're opening doors for countless people to experiment with and deploy IoT solutions with ease. The road ahead is exciting, and your efforts to create a cost-effective and efficient solution are bound to inspire a new wave of creativity in the LoRa community.
Let's work together to transform this idea into a reality—bridging technology, innovation, and accessibility!
Comments
Please log in or sign up to comment.