-
Prototype Communicator Complete
08/02/2019 at 07:57 • 0 commentsMy first prototype messenger device is finished. It actually feels quite nice in the hand. I think the touch screen is about the right size, though I would love to find a capacitve touch instead of a resistive touch.
The case is a "waterproof" tackle box. I did throw it in a tub of water. It floats and keeps out water, but I wouldn't rate it for submersion. The inserts that hold everything in the box are 3d printed in PETG. The display is a 3.5" Nextion display with 320x480 resolution. The microcontroller running the show is an ESP32 right now I am using a TTGO T-beam which has an ESP32, SX1276 Lora module, NEO m6 GPS module and battery management all on one board. I have also added a buzzer rgb led slider on/off switch, charging port, and a 2000mah lipo.
While all the hardware is working assembly is too fiddly at the moment. I am still deciding which direction to go for the next revision. I will probably roll my own board, specifically because I want to utilize the new more efficient Lora chips. I have some modules using the sx1262 chips that I am looking forward to trying out.
I really love the way the antenna pops out on this unit, but I need to find some better antenna, because these ones are monopoles that really need a ground plane, and the vswr goes through the roof when they are in the case. I rebuilt one turning it into a coiled diplole which works better, but I need to find a reliable supplier for them.
All in all I am happy with the unit as a prototype, but it needs a lot of rework before it would be ready for even a small production run.
On the software side everything works, but needs a lot of tidying up. I have also not done anything yet to optimize battery life.
-
Prototype Repeater Complete
08/02/2019 at 07:04 • 0 commentsThis is a prototype unit for the repeater system I would like to implement. It is powered by a 6 watt solar panel charging 4 18650 lithium ion cells through a tp4056 controller. The microcontroller is a Lora32u4 which combines an Atmel 32u4 controller with a Semtech sx1276 Lora module. The body is a combination of a waterproof box with some 3d printed PETG elements and folded stainless steel flat stock. The antenna is a 1/4 wave ground plane monopole.
-
What Protocol Does Jebel Use?
08/01/2019 at 22:20 • 0 commentsJebel uses its own protocol specifically designed to be very lightweight and to maximize range and network reliability. It utilizes a hybrid network that employs nodes and repeaters.
Theory of wireless network protocols
How do nodes in the network transfer data?
There are different ways to create a network of connected devices for a project like this. All of these methods have advantages and disadvantages.
Peer to Peer
The simplest method which is used is used in traditional walkie talkies is a peer to peer network. In this typology all nodes communicate directly with each other without any intermediary. The messages can be addressed to specific nodes, or to all nodes.
Advantage:
Simple to set up
only requires 2 nodes
flexibility in locationsDisadvantage:
limited to the range of the device.Star or Centralized
Another typology is a star configuration where all units send and receive data via a central node. This is the system utilized in Lorawan where all nodes report to a central gateway. In this system nodes do not communicate to each-other directly, but only via the central node.
Advantages:
Centralized network control
allows for monitoringDisadvantage:
both devices need to be in range of central node
bottleneck at gatewayMesh
Another typology is a mesh or repeater mesh typology where every node also acts as a repeater. This has the advantage of giving the highest chance of a message going through as in theory as long as there is a chain of nodes between two nodes they will be able to communicate. This could be a very effective system in a network with only a few nodes, however it quickly becomes problematic with something like Lora which takes a long time to send messages, because when multiple nodes start repeating a message it can create interference, so that all the messages become corrupted.
Advantages:
Doesn’t need established network
Flexibility
any node can communicate with another nodeDisadvantage:
can’t deal with numerous nodes
nodes will interfere with other nodesHybrid System
Jebel utilizes a hybrid system that takes advantage of the benefits of the different systems, but limits the disadvantages of each of these systems. This is being called a Hybrid Repeater Network. In this system each node has a unique address. All nodes have the ability to communicate with any node in range like in a peer to peer network. If a node receives a message it will send back a message received confirmation to the sending node. In this form only two nodes are needed for communication, and they can work anywhere they are in range of each other. If the message is not received by the node however after a set amount of time the node will send a command to repeat the message. Nodes designated as repeaters will repeat the message, and later the message received confirmation. These repeater nodes would be stationary nodes placed on hilltops which maximize the line of sight which is critical for Lora messages. This is why the system is called Jebel which is a transliteration of the Arabic word for mountain. By only allowing nodes with the best locations to repeat messages there is much less noise than in a completely mesh network, which maximizes the chance for a message to get through without creating interference.
Example 1
To understand the protocol the easiest way is to look at several examples. In the first example two nodes A and B are in range of each other. A sends a message, B receives the message and sends back a confirmation to A. Any repeaters that hear the message and don’t hear a repeat command will not repeat the message.
Example 2
In the next example we have the same situation, but A is not within range of B. In this situation once an amount of time that would be sufficient to allow for B to send its confirmation has elapsed the node A will send a command to the repeater which will repeat the message from A. B will send a confirmation to the repeater which will repeat the confirmation to A. Any other repeaters which hear the confirmation sent by the repeater would not continue to repeat the message.
Example 3
Extending the range of this scenario multiple repeater hops are possible with this system. If no confirmation is received by the first repeater after a set period of time it will send a command to repeat the message again. Other repeaters in the network can then repeat the message. If the message is received by node B then confirmation will be repeated only by those repeaters that sent the original message.
Limitations
In theory this system could be extended out to an indefinite number of repeaters, but in practice this would really only be practical for a relatively small network, as a large number of repeaters would cause a message to get repeated too many times trying to locate a node. In a very complex network like this some sort of defined routing protocol would be needed, which would likely require each nodes location to be known within the system. However for a system with a few repeater the hybrid system outlined here would create a lightweight network that required no predefined routing so it would be self-healing. It also does not require any central routing, so it is very flexible. Creating a network would be as easy as turning on two devices, or slightly more complicated, setting a repeater in location with good coverage.
Other issues with the protocol would occur on outlying situations which involve multiple repeaters, or where nodes on on the edge of the repeaters range. For example if the message from node A is heard by multiple repeaters. If they then try and repeat the message at the same time they can interfere with each other. This issue can be worked around by giving each repeater a different set amount of time before it repeats a message, then if it hears another repeater it will wait a set time before repeating the message if it does not hear a confirmation. The downside of this system is that it creates extra delay, but this is acceptable as timing is not critical for this system, and it is more critical that messages get through without interference.
What information is sent:
Lora messages are low bandwidth which means that large messages will take considerable time to send. With higher spreading factors long messages could take seconds to transmit, so making a message header that is as small as possible is critical. For Jebel the message header is five bytes.
1st byte Message address (where message is going)
2nd byte Message sender address (who sent message)
3rd byte Message type (is this a text message, a received confirmation, or a command)
4th byte message id (identifier for the message)
5th byte check sum (total length of message in bytes to confirm message integrity on receiving side)Messages with Lora can be up to 256 bytes, so with this header there is 251 bytes available for the message contents. Currently the address is one byte. This allows for up to 255 devices on the network with 0x00 being allocated to send to all devices. If these spaces were not enough for the devices on the network the addresses could go to 2 bytes, which would allow for 65535 devices, but it would add two bytes to each message (one byte for message address, and one byte for senders address) it is better to stay at one byte addresses unless more devices are needed.
All messages have the five byte header attached to them, but many messages do not need any additional information beside the header. 256 possible per-configured messages can be sent by changing the value of the 3rd byte. For example one byte is set to request the current battery voltage of a node, another to get the current GPS location, another is used to confirm message receipt. These short messages can communicate a lot of information without needed great deals of on-air time.
Devices
Nodes and repeaters can utilize a number of different hardware sets to communicate on the Jebel network. Any Arduino compatible board can be used as long as they are capable of communicating with a Lora compatible device. Currently the major focus is on the ESP32 platform because it allows for multiple uarts which allows for serial communication to computer, Nextion display and GPS unit concurrently. It also allows for Bluetooth or WiFi connections which are not currently implemented. The low power processor in the ESP32 also allows for low current deep sleep to allow for long battery run times.
-
What is Lora
07/17/2019 at 09:37 • 0 commentsWhat is Lora:
Lora is a proprietary system designed by Semtech. According to them:
LoRa is a proprietary spread spectrum modulation scheme that is derivative of Chirp Spread Spectrum modulation (CSS) and which trades data rate for sensitivity within a fixed channel bandwidth. It implements a variable data rate, utilizing orthogonal spreading factors, which allows the system designer to trade data rate for range or power, so as to optimize network performance in a constant bandwidth. LoRa is a PHY layer implementation and is agnostic with to higher-layer implementations. This allows LoRa to coexist and interoperate with existing network architectures.
Basically Lora which stands for Long Range is a radio modulation system designed for long range low bandwidth applications. The standard is owned by Semtech who licenses several other manufacturers to develop Lora based chips. Lora can be thought of like wifi or bluetooth, but designed for long-range and low-bandwidth applications. It operates in the ISM band with different frequencies for different parts of the world. The three main frequencies are 433mhz, 868mhz and 915mhz. Lora is specifically designed to have a high link budget and operate with a low SNR which allows it to operate at great distances. In low quality environments with high interference and noise it can still be possible to transmit more than 1km. With line of site connections have been made using small battery powered devices that exceed 200km.
Lora devices are transceivers meaning they can both send and receive information. They are low powered. A sender only unit may be able to last years on a single set of batteries if deep sleep and infrequent update times are utilized. The units are also low cost. Though more expensive than equivalent Wifi or Bluetooth modules, Lora modules can still be purchased for well under $10 in single quantities.
Lora vs Lorawan:
Lorawan is a standard protocol for a Lora wide area network. It is built on the Lora technology, and requires Lora to function, but the protocol is not itself Lora. Lora technology can use alternative protocols to Lorawan, as long as it fits within the regulatory guidelines of the country.
Key ideas and terms with Lora:
Lora allows for a number of adjustment to be made to the output signal. All of these adjustment will be a trade off between different factors such as range, ability to transmit in noisy environments, battery usage, time on air, data rate, and message integrity.
Spreading Factor:
According to Semtech “The spread spectrum LoRa modulation is performed by representing each bit of payload information by multiple chips of information. The rate at which the spread information is sent is referred to as the symbol rate (Rs), the ratio between the nominal symbol rate and chip rate is the spreading factor and represents the number of symbols sent per bit of information.” The important take away is a lower spreading factor will mean a higher data rate, but generally lower range as it becomes more difficult to differentiate the signal over noise. Spreading factors range from 6-12 and an increase of 1 SF doubles the time on air. So for the same message SF 9 will take 4 times as long to send as SF7. Generally a lower SF is better as long as the signal is strong enough.
Bandwidth:
“An increase in signal bandwidth permits the use of a higher effective data rate, thus reducing transmission time at the expense of reduced sensitivity improvement.” Bandwidth is measured in kHz. It is the range of the spectrum the signal will broadcast in. According to Semtech the range of possible bandwidths is 7.8-500kHz. The larger the bandwidth the higher the data rate, but also the more noise.
Frequency:
Frequency is the channel in kHz at the center of the transmission. For example 433kHz, 868kHz, or 915Khz.
Coding Rate:
“To further improve the robustness of the link the LoRaTM modem employs cyclic error coding to perform forward error detection and correction. Such error coding incurs a transmission overhead. Forward error correction is particularly efficient in improving the reliability of the link in the presence of interference. So that the coding rate (and so robustness to interference) can be changed in response to channel conditions” The coding rate increase the on air time of a message by including extra signals for error correction.
Preamble Length:
The preamble occurs before the message to signal to other Lora devices that a message is incoming. This can be increased for additional robustness, but adds to on air time.
Sync Word:
Byte to signify which network the message is destined for.
Transmit power:
The power output of the transmitter in db.
CRC:
Cyclic Redundancy Check. This verifies the integrity of the data.
Packet Structure:
The LoRaTM modem employs two types of packet format, explicit and implicit. The explicit packet includes a short header that contains information about the number of bytes, coding rate and whether a CRC is used in the packet. The LoRaTM packet comprises three elements: A preamble, An optional header. The data payload.
General Principals:
In battery applications more power is consumed by higher transmit power, or longer on air time. On air time can be reduced by decreasing spreading factor, increasing bandwidth, decreasing code rate, usinf implicit headers and no crc. These all reduce range, so a balance must be found to create a reliable link that saves power, and doesn’t congest airwaves.
An Example Sending the message hello world with Spreading factor 12, bandwidth 8kHz, Code Rate 4, Explicit Header, and CRC would take 18,560ms
Sending the same message with Spreading factor 7, bandwidth 500kHz, Code Rate 1, Implicit Header, and no CRC would take 9.02ms
For a helpful overview of these ideas check out this video tutorial series
https://www.mobilefish.com/developer/lorawan/lorawan_quickguide_tutorial.html
-
Motivation for this project
06/29/2019 at 22:08 • 0 commentsMy motivation for the project is mostly a practical need. I am working with a hospital in a very remote part of Africa which has no functioning communication system. My main goal is to create a a system to communicate from the main referral hospital to the remote clinics so that we can create a dispatch system for the motorcycle ambulances we are building. The area is very mountainous, so the strategy is to build repeaters on top of the mountains to get a wide area of coverage. The goal would be to have fixed communication terminals at the hospital and the clinics, and mobile nodes on the ambulance units which could be tracked via GPS, and sent SMS messages to dispatch them to where they were needed.
Prototype motorcycle ambulance