Close Menu
5gantennas.org5gantennas.org
  • Home
  • 5G
    • 5G Technology
  • 6G
  • AI
  • Data
    • Global 5G
  • Internet
  • WIFI
  • 5G Antennas
  • Legacy

Subscribe to Updates

Subscribe to our newsletter and never miss our latest news

Subscribe my Newsletter for New Posts & tips Let's stay updated!

What's Hot

4 Best Wi-Fi Mesh Networking Systems in 2024

September 6, 2024

India is on the brink of a new revolution in telecommunications and can lead the world with 6G: Jyotiraditya Scindia

August 29, 2024

Speaker Pelosi slams California AI bill headed to Governor Newsom as ‘ignorant’

August 29, 2024
Facebook X (Twitter) Instagram
Facebook X (Twitter) Instagram
5gantennas.org5gantennas.org
  • Home
  • 5G
    1. 5G Technology
    2. View All

    Deutsche Telekom to operate 12,500 5G antennas over 3.6 GHz band

    August 28, 2024

    URCA Releases Draft “Roadmap” for 5G Rollout in the Bahamas – Eye Witness News

    August 23, 2024

    Smart Launches Smart ZTE Blade A75 5G » YugaTech

    August 22, 2024

    5G Drone Integration Denmark – DRONELIFE

    August 21, 2024

    Hughes praises successful private 5G demo for U.S. Navy

    August 29, 2024

    GSA survey reveals 5G FWA has become “mainstream”

    August 29, 2024

    China Mobile expands 5G Advanced, Chunghwa Telecom enters Europe

    August 29, 2024

    Ateme and ORS Boost 5G Broadcast Capacity with “World’s First Trial of IP-Based Statmux over 5G Broadcast” | TV Tech

    August 29, 2024
  • 6G

    India is on the brink of a new revolution in telecommunications and can lead the world with 6G: Jyotiraditya Scindia

    August 29, 2024

    Vodafonewatch Weekly: Rural 4G, Industrial 5G, 6G Patents | Weekly Briefing

    August 29, 2024

    Southeast Asia steps up efforts to build 6G standards

    August 29, 2024

    Energy efficiency as an inherent attribute of 6G networks

    August 29, 2024

    Finnish working group launches push for 6G technology

    August 28, 2024
  • AI

    Speaker Pelosi slams California AI bill headed to Governor Newsom as ‘ignorant’

    August 29, 2024

    Why Honeywell is betting big on Gen AI

    August 29, 2024

    Ethically questionable or creative genius? How artists are engaging with AI in their work | Art and Design

    August 29, 2024

    “Elon Musk and Trump” arrested for burglary in disturbing AI video

    August 29, 2024

    Nvidia CFO says ‘enterprise AI wave’ has begun and Fortune 100 companies are leading the way

    August 29, 2024
  • Data
    1. Global 5G
    2. View All

    Global 5G Enterprise Market is expected to be valued at USD 34.4 Billion by 2032

    August 12, 2024

    Counterpoint predicts 5G will dominate the smartphone market in early 2024

    August 5, 2024

    Qualcomm’s new chipsets will power affordable 5G smartphones

    July 31, 2024

    Best Super Fast Download Companies — TradingView

    July 31, 2024

    Crypto Markets Rise on Strong US Economic Data

    August 29, 2024

    Microsoft approves construction of third section of Mount Pleasant data center campus

    August 29, 2024

    China has invested $6.1 billion in state-run data center projects over two years, with the “East Data, West Computing” initiative aimed at capitalizing on the country’s untapped land.

    August 29, 2024

    What is the size of the clinical data analysis solutions market?

    August 29, 2024
  • Internet

    NATO believes Russia poses a threat to Western internet and GPS services

    August 29, 2024

    Mpeppe grows fast, building traction among Internet computer owners

    August 29, 2024

    Internet Computer Whale Buys Mpeppe (MPEPE) at 340x ROI

    August 29, 2024

    Long-term internet computer investor adds PEPE rival to holdings

    August 29, 2024

    Biden-Harris Administration Approves Initial Internet for All Proposals in Mississippi and South Dakota

    August 29, 2024
  • WIFI

    4 Best Wi-Fi Mesh Networking Systems in 2024

    September 6, 2024

    Best WiFi deal: Save $200 on the Starlink Standard Kit AX

    August 29, 2024

    Sonos Roam 2 review | Good Housekeeping UK

    August 29, 2024

    Popular WiFi extender that eliminates dead zones in your home costs just $12

    August 29, 2024

    North American WiFi 6 Mesh Router Market Size, Share, Forecast, [2030] – அக்னி செய்திகள்

    August 29, 2024
  • 5G Antennas

    Nokia and Claro bring 5G to Argentina

    August 27, 2024

    Nokia expands FWA portfolio with new 5G devices – SatNews

    July 25, 2024

    Deutsche Telekom to operate 12,150 5G antennas over 3.6 GHz band

    July 24, 2024

    Vodafone and Ericsson develop a compact 5G antenna in Germany

    July 12, 2024

    Vodafone and Ericsson unveil new small antennas to power Germany’s 5G network

    July 11, 2024
  • Legacy
5gantennas.org5gantennas.org
Home»WIFI»LoRaWAN -> Wi-Fi -> Building a Cellular Fallback IoT Device
WIFI

LoRaWAN -> Wi-Fi -> Building a Cellular Fallback IoT Device

5gantennas.orgBy 5gantennas.orgFebruary 13, 2024No Comments11 Mins Read
Facebook Twitter Pinterest LinkedIn Tumblr Email
Share
Facebook Twitter LinkedIn Pinterest WhatsApp Email


With the proliferation of cellular networks, public Wi-Fi access points, and even LoRaWAN gateways, there is still no “one size fits all” when it comes to wireless IoT deployments. Unfortunately, when designing a product, you often need to choose a single radio access technology (RAT), such as one of the above, before you start doing anything else.

Why does this matter?

  • we have to design the product Regarding the form factor of specific RAT components (PCB, physical enclosure, etc.).
  • we must choose Appropriate battery technology Optimize performance with that RAT.
  • And most importantly, we must. program firmware Target specific RATs.

At the end of the day, I would argue that it doesn’t matter if you’re using LoRa, Cellular, Wi-Fi, or Zigbee. maybe. We just want to connect.

Wireless harmonization with blues

For this reason, blues note cards It’s such a breath of fresh air. By using Single JSON-based API Additionally, by building around one form factor, you can design products without fear of switching from Cellular to Wi-Fi to LoRa (and vice versa).you can too Deploying the same product with different RATswithout changing a single line of code.

But let’s be crazy

You can freely choose between Cellular, Wi-Fi, and LoRa. But what if you want to use them all?

Today I would like to introduce you to a scenario where you build a single product with the following features:

  • First, try connecting to the cloud via LoRa/LoRaWAN.
  • If LoRa fails, try using Wi-Fi.
  • And what if both fail? Fallback to cellular.

project hardware

Although this example uses a Raspberry Pi with Python, I want to be doubly clear that the same thing can be 100% achieved using an ESP32, STM32, Nordic (etc.) host with Arduino/C. I would like to go there. Same API command.

Use the following hardware:

  • Blues Note Card LoRa (Automatically connect to available networks) network of things gateway).
  • Blue Note Card Cell + WiFi (Prepaid cell phone and Wi-Fi on one board).
  • blues note carrier pie hat (Two of these are each used as carrier boards for the notecards above).
  • Raspberry Pi 5 (also works with 4B and Zero!).

The notecard is inserted into the note carrier.

…to…

Notecarriers can also be stacked on top of each other on the Pi.

How does Notecard sync cloud data?

By default, notecards are low power and “sometimes connected” devices. Notecard has up to 1MB of user-addressable flash, allowing you to store large amounts of data before Notecard needs to sync your data to the cloud. This enables battery-powered asset tracking and condition monitoring solutions that cannot be continuously connected.

To be clear, Notecard is not intended to be a drop-in replacement for Wi-Fi.This applies to individual JSON-based events (or Note Contains key-value pairs (in Blues terminology). for example:

{
"event": "a4489717-3ece-4fb6-beab-b40275c8c089",
"device": "dev:864622044598304",
"product": "product:com.blues.rlauer:aaa",
"received": 1704988174.993267,
"req": "note.add",
"file": "fallback.qo",
"body": {
"voltage": 4.9140625
},
"best_location_type": "tower",
"best_location_when": 1704988171,
"best_lat": 43.0738875,
"best_lon": -89.44357812499999,
"best_location": "Shorewood Hills WI",
"best_country": "US",
"best_timezone": "America/Chicago",
"fleets": [
"fleet:4d7ccbcb-a410-4730-9ee2-b483b3523b17"
]
}

Notecard knows exactly where to go as soon as you turn it on. You don’t need to manage security or rotate keys using Notecard. Everything is handled automatically and your data is securely streamed from your device to the cloud.

On the cloud side, blues note hub Acts as a data “hub”. What you can do from Notehub Route your data to any cloud platform Such as AWS, Azure, Datacake, Ubidots, or your own custom HTTPS or MQTT endpoint.

Notehub handles everything. It takes all the pain out of coordinating your own infrastructure to integrate wireless and cloud connectivity.

It is important to note Communication with notecards is bidirectional Essentially, you can start an event on the cloud and use it to distribute it to Notehub. Notehub API, Notehub securely sends its events to one or more Notecard devices (enabling remote control or remote update scenarios).

Python code

With these high-level concepts in mind, let’s take a look at how to actually build this. LoRa -> Wi-Fi -> Mobile phone Communication device.

When building with Notecard LoRa, it’s important to consider it as the “least common denominator” of Notecards. Everything you can do with Notecard LoRa can also be done with Notecard Cell+WiFI. However, the opposite may not be true. Higher bandwidth activities and location tracking scenarios can easily be handled by Cellular or Wi-Fi, but not as much by LoRa. Let me tell you, it makes sense to start with LoRa.

The complete source code for this project is below. Available in this gist.

Step 1: Change the I2C address

Since we are connecting to both Notecards via I2C, both Notecards cannot have the same I2C address. 0x17 (This is the default for Notecard). This can be easily handled using: Card.io API, This allows you to set one of them to a new address. 0x18:

{
"req": "card.io",
"i2c": 24
}

Learn how to connect Notecard to your in-browser terminal to send API requests. Blues quick start.

Step 2: Open I2C connection

Once the command is sent to one of your notecards, you can start programming your Python script.For example, create a new file main.pyon a Raspberry Pi.

Since both Notecards share the same I2C bus, you only need to pass the I2C address of each Notecard in your code.

port = I2C("/dev/i2c-1")

nCardLoRa = notecard.OpenI2C(port, 0, 0, True)
nCardCellWiFi = notecard.OpenI2C(port, 0x18, 0, True)

Step 3: Link notecards to Notehub

Next, you need to issue a command to Notecard telling it which project in Notehub to connect to. A “project” is exactly what you think it is: a collection of one or more Notecard devices that provides a logical way to organize and route events to cloud endpoints.

Here’s an example of a Notehub project from my account.

back in main.pyuse Hub.set command Each notecard specifies a different notecard sn (“Serial Number”) This allows you to identify the two Notecards when you start syncing data with Notehub.

rsp = hub.set(nCardLoRa, product=productUID, mode="periodic", sn="lora")
rsp = hub.set(nCardCellWiFi, product=productUID, mode="periodic", sn="cell+wifi")

You must specify your own productUID (Unique identifier for your Notehub project).

Step 4: Set up Wi-Fi

The next setup task is to ensure that the proper Wi-Fi credentials are applied to Notecard Cell+WiFi.Use of card.wifi API, You can specify the required SSID and password.

# update the wifi credentials on the notecard cell+wifi
req = {"req": "card.wifi"}
req["ssid"] = "your-ssid"
req["password"] = "your-password"
rsp = nCardCellWiFi.Transaction(req)

For reference, see this article by TJ VanToll as an example of how to use it. Multiple Wi-Fi access points in one project.

Step 5: Create a memo template

a memo template This acts as a hint to Notecard, allowing it to store data internally as fixed-length records rather than as flexible JSON objects. JSON objects tend to be large. Not only this, save storage Not just note cards saves bandwidth When you sync your data with the cloud.template too Required When using Notecard LoRa.

Again, make sure you create the same template for each notecard. In this project, we’re just sending an arbitrary value, such as the voltage registered on the notecard, but this could be anything.

this is a good point Check out all the great projects created by the blues community Use Notecard and Notehub – from machine learning to asset tracking, condition monitoring, and more

Note The code to create the template is as follows:

# create note template on each notecard
req = {"req": "note.template"}
req["file"] = "fallback.qo"
req["port"] = 10
req["body"] = {"voltage": 12.1}
rsp = nCardLoRa.Transaction(req)
rsp = nCardCellWiFi.Transaction(req)

look This document section Note Use this to understand what values ​​you should use for different data types when creating templates.

Step 6: Get any data

Again, this project keeps things very simple.And to extend it you need the following Several Since we have data to send to the cloud, let’s query Notecard to get the voltage value from the power supply.

# query one of the Notecards for power supply voltage
# this just gives us some arbitrary data to send!
req = {"req": "card.voltage"}
req["mode"] = "?"
rsp = nCardLoRa.Transaction(req)

voltage = rsp["value"]

Step 7: Send data in your notes using Notecard LoRa

Recall that the order of connection settings is as follows:

Let’s create your first note and send it with Notecard LoRa. To send this request to Notecard LoRa, note.add API:

# create the outbound note
# arbitrary data based on the voltage reported on the Notecard LoRa
reqNote = {"req": "note.add"}
reqNote["file"] = "fallback.qo"
reqNote["body"] = {"voltage": voltage}
reqNote["sync"] = True

# first, try the Notecard LoRa
rsp = nCardLoRa.Transaction(reqNote)

Now comes the difficult part. If Notecard is an “occasionally connected” device, at what point do you consent to whether data has been sent? In this scenario, use (optional). sync argument. This tells Notecard to try the following: Sync this data now.

after that, Hub.sync.status API After the above note.add Your request has been sent! This API allows you to check the status of the last sent note.

# monitor a series of requests to hub.sync.status for one minute
t_end = time.time() + 60
didLoRaComplete = False

while time.time() < t_end and didLoRaComplete is False:
req = {"req": "hub.sync.status"}
rsp = nCardLoRa.Transaction(req)

if "completed" in rsp and rsp["completed"] < 3:
# "completed" tells us how many seconds since the last sync completion
# by looking for 3, we are asking if the sync was completed in the last 3 secs
didLoRaComplete = True

time.sleep(1)

Did it work? You can check Notehub to see if that voltage data appears.

wonderful! Project completed!

Now let’s disconnect my personal LoRaWAN gateway and see what happens next. hub.sync.status request:

# request:
{"req":"hub.sync.status"}
# response:
{'sync': True, 'requested': 59, 'status': 'sync in progress {sync}'}

Um oh. Unfortunately, we are impatient. Since the “sync in progress” is still going on for more than a minute, it’s time to fall back to Wi-Fi.

Step 9: LoRa to Wi-Fi to Cellular

Since you are migrating from one Notecard device to another, first do the following: Notecard Deleting LoRa notesBecause we don’t want it to be sent later if the LoRaWAN gateway comes back online.

Use of file.delete API, You can clear notes from Notecard LoRa.

req = {"req": "file.delete"}
req["files"] = ["fallback.qo"]
rsp = nCardLoRa.Transaction(req)

Next, let’s create a new note for Notecard Cell+WiFi (same as the original note) note.add request), wait a few minutes before connecting again. Here is the complete code block:

if didLoRaComplete is False:
# no luck? now try Notecard Cell+WiFi!
# this will default to Wi-Fi, but fallback on Cellular AUTOMATICALLY!
rsp = nCardCellWiFi.Transaction(reqNote)

# while this is running, delete the original note on the Notecard LoRa
# just in case it comes back online
req = {"req": "file.delete"}
req["files"] = ["fallback.qo"]
rsp = nCardLoRa.Transaction(req)

# monitor hub.sync.status for a couple of minutes, just for kicks
t_end = time.time() + 120
didCellWiFiComplete = False

while time.time() < t_end and didCellWiFiComplete is False:
req = {"req": "hub.sync.status"}
rsp = nCardCellWiFi.Transaction(req)

if "completed" in rsp and rsp["completed"] < 3:
# "completed" tells us how many seconds since the last sync completion
# by looking for "3", we are asking if the sync was completed in the last 3 secs
didCellWiFiComplete = True

time.sleep(1)

By default, Notecard Cell+WiFi attempts to use Wi-Fi first. Use it again hub.sync.status You can use the API to check whether a note has been delivered.

{"status":"wifi disconnected {wifi-disconnected}","mode":"{modem-off}","time":1704984927,"sync":true,"completed":50}

Oh no, I don’t have Wi-Fi!

But here are the benefits of using Notecard Cell+WiFi. Fallback feature to mobile phone is automatic. You don’t need to do anything. The Notecard detects that your Wi-Fi is not working and within about a minute turns on your cellular radio to connect to the nearest base station and deliver your data.

result

When you return to Notehub, you can look at one of the event details to see how the data is transmitted (this is whether the data was delivered over LoRa, Wi-Fi, or cellular. , are effectively the same).

{
"event": "8dffcd30-0ab2-4f2e-a7bd-95d26bdb2f1f",
"session": "1a1dec6c-b2ee-4226-9758-e7a6399f860f",
"best_id": "cell+wifi",
"device": "dev:860322068073292",
"sn": "cell+wifi",
"product": "product:com.blues.rlauer:aaa",
"app": "app:9a442885-d04d-4f5d-bca5-94eb07f7a27f",
"received": 1704985303.747774,
"req": "note.add",
"file": "fallback.qo",
"body": {
"voltage": 5.1328125
},
"best_location_type": "triangulated",
"best_location_when": 1704984697,
"best_lat": 43.071268,
"best_lon": -89.432769,
"best_location": "Shorewood Hills WI",
"best_country": "US",
"best_timezone": "America/Chicago",
"tri_when": 1704984697,
"tri_lat": 43.071268,
"tri_lon": -89.432769,
"tri_location": "Shorewood Hills WI",
"tri_country": "US",
"tri_timezone": "America/Chicago",
"tri_points": 6,
"fleets": [
"fleet:4d7ccbcb-a410-4730-9ee2-b483b3523b17"
]
}

In fact, you can drill down. session Referring to data from Notecard events, mouse This was used (unfortunately, this information is not available in Notecard LoRa).

So? Once your data is synced with the cloud, the next obvious step is to route that data to your cloud endpoints. Your solution will likely use one of the cloud providers mentioned above.and luckily There’s probably a guide for you!

next step

Learn more about the Notecard API and find other Blues technical resources. Bruce.Development. Otherwise, if you’re ready to get started, get yours blues starter kit Or if you want to do exactly this project: note carrier pie hat together Note card cell + WiFi, and LoRa notecard.

Happy hacking with Bruce! 💙



Source link

Share. Facebook Twitter Pinterest LinkedIn Tumblr Email
Previous ArticleLawmakers consider expanding federal internet aid
Next Article Department of Defense notifies those potentially affected by year-old data breach
5gantennas.org
  • Website

Related Posts

4 Best Wi-Fi Mesh Networking Systems in 2024

September 6, 2024

Best WiFi deal: Save $200 on the Starlink Standard Kit AX

August 29, 2024

Sonos Roam 2 review | Good Housekeeping UK

August 29, 2024
Leave A Reply Cancel Reply

You must be logged in to post a comment.

Latest Posts

4 Best Wi-Fi Mesh Networking Systems in 2024

September 6, 2024

India is on the brink of a new revolution in telecommunications and can lead the world with 6G: Jyotiraditya Scindia

August 29, 2024

Speaker Pelosi slams California AI bill headed to Governor Newsom as ‘ignorant’

August 29, 2024

Crypto Markets Rise on Strong US Economic Data

August 29, 2024
Don't Miss

IDTechEx discusses driving the integration of antenna packaging technology for 5G and 6G

By 5gantennas.orgFebruary 27, 2024

boston, February 27, 2024 /PRNewswire/ — Once limited to military, satellite, and automotive radar applications,…

China’s important role in 6G

March 4, 2024

Golden Band and the Future of 6G (Leader Forum)

February 19, 2024

Subscribe to Updates

Subscribe to our newsletter and never miss our latest news

Subscribe my Newsletter for New Posts & tips Let's stay updated!

About Us
About Us

Welcome to 5GAntennas.org, your reliable source for comprehensive information on 5G technology, artificial intelligence (AI), and data-related advancements. We are passionate about staying at the forefront of these cutting-edge fields and bringing you the latest insights, trends, and developments.

Facebook X (Twitter) Pinterest YouTube WhatsApp
Our Picks

4 Best Wi-Fi Mesh Networking Systems in 2024

September 6, 2024

India is on the brink of a new revolution in telecommunications and can lead the world with 6G: Jyotiraditya Scindia

August 29, 2024

Speaker Pelosi slams California AI bill headed to Governor Newsom as ‘ignorant’

August 29, 2024
Most Popular

What can 5G do for packaging production?

November 29, 2023

5G could cause problems for US airlines, here’s why

June 28, 2023

Nokia and stc conduct O-RAN based 5G private wireless network trials

March 11, 2024
© 2025 5gantennas. Designed by 5gantennas.
  • Home
  • About us
  • Contact us
  • DMCA
  • Privacy Policy
  • About Creator

Type above and press Enter to search. Press Esc to cancel.