Salamander

  • 11 Posts
  • 22 Comments
Joined 5 years ago
cake
Cake day: December 19th, 2021

help-circle



  • Don’t worry, I wouldn’t ban you for this.

    Yes, the physical modulation implemented by LoRa transceivers is proprietary.

    It is not entirely correct to say that the “mesh” itself is proprietary. Meshtastic is open source, even if it relies on proprietary radio hardware. In principle, one could take the Meshtastic codebase and adapt it to a different physical layer.

    It is perfectly reasonable to reject a technology because the full stack is not open. That said, once you look closely at most modern digital and RF hardware, you are extremely likely to encounter proprietary ICs, firmware, or physical layer implementations somewhere in the stack.



  • Yes, you have many options. It depends on how much “from scratch” you want to go.

    The simplest method is to purchase a module with the radio transceiver + microcontroller, flash it, and assemble it. If you don’t want any sensors, you can for example purchase from RAK the kit a kit with a ‘RAK19003’ base board + ‘RAK4631’ module (nRF52840 micro-controller + SX1262 transciever) . For Canada, you would pick the 900 MHz version that operates in the 915 MHz band. (https://store.rakwireless.com/products/wisblock-meshtastic-starter-kit?variant=43884035113158)

    For an enclosure, you can look up ‘Project box’ or 3D print a case.

    If you want to go even more “from scratch”, you can buy a module without a micro-controller (Waveshare core1262, Ra-01SH, Wio-SX1262), and interface with these using a micro-controller via SPI. At this layer it starts to become more of a hassle if you want to implement Meshtastic, because you will need to either copy an existing configuration, or modify the firmware so that it matches the way that your electronics are connected.

    Then, if you do not want to purchase a module, you would buy the transciever directly (for example, the SX1262), and assemble your own module. You can look up the schematic of the basic modules to get an idea of what this looks like. For example, you can see the Waveshare Core1262 schematic here: https://files.waveshare.com/upload/c/c1/CoreSX1262_Sch.pdf

    If you do not want to rely on an already existing LoRa transciever, but instead use a more general radio transciever, that is also possible. But, more expensive, and is unlikely to match performance. This is something that one might want to do if you already have an SDR transciever connected to raspberry pi and want to use it to interface with LoRa (still, it is much easier to connect a LoRa device over USB). I would not recommend building a meshtastic device from more general transcievers.


  • It seems like as of right now meshtastic devices don’t have the ability to finely control LEDs/button actions to work for my use case. Which is a shame since I was hoping I could just buy a meshtastic device that has some programmable buttons inside a pre-built enclosure.

    Maybe they do have that ability already. I am not sure. I have mostly used Meshtastic devices for communication and I have played a little bit with LoRa modules for more basic sensors and logging. Perhaps someone else knows more about the Meshtastic-specific features when it comes to telemetry and triggering devices.


  • Hmm this is what I think about this:

    On the device by the gate:

    Continuous loop:

    • Switch to transmit mode

    • Check if the gate is open or closed

    • Transmit the result

    • Switch back to receive mode and wait 15 seconds

    When a message is received:

    • Run a security check

    • If the message is the Open or Close command, forward it to MQTT


    On the device in the car:

    Continuous loop:

    • Decrease the timer value

    When a message is received:

    • Set connection state to connected

    • Enable the Open/Close display and set it to the received state

    • Reset the timer to 45 seconds

    If the timer ends:

    • Set connection state to disconnected

    • Disable the Open/Close display

    On button press:

    • Stop receiving

    • Generate a secure message (Open or Close)

    • Transmit the message

    • Resume receiving


    Option 1: Use an ESP32 with WiFi and a LoRa module near the gate. This device can handle both the LoRa interface and the MQTT push with relatively simple firmware. For the device in the car, WiFi is not needed, so you can choose any microcontroller and a LoRa module.

    For the interface, LEDs are the simplest. Map the GPIOs to four LEDs (Red, Green | Red, Green). For example:

    • Red and Off = Disconnected

    • Green and Red = Connected and Closed

    • Green and Green = Connected and Open

    Two more GPIOs in input mode can handle the two physical buttons for Open and Close.

    If you want a screen, there are many options. You can use a small OLED, touch screen, or colored E-Ink. The choice depends on whether the car device is battery powered or has constant power, and how much complexity you want in the code.

    Option 2: Use Meshtastic. The device by the gate can be connected to something like a Raspberry Pi, and a Python script can process incoming messages and handle the heartbeat transmissions. Meshtastic gives you some built-in security, but you still need to be careful. The difficulty is keeping track of the connected state and the Open/Close state from the heartbeat, and then mapping that to a display or LEDs. That would probably require customizing Meshtastic firmware.

    Because of that, I think writing custom firmware is easier than trying to adapt Meshtastic for this use case. BUT - I have not been keeping up to date with the newest Meshtastic versions, and I don’t know all of the sensor-related features. So it is possible that there is already some built-in method that replicates this and I just don’t know about it.


  • I agree. I think that a firmware update taking several minutes to complete would be alright. If loss of service is a concern, they can keep more than one device at the tower and one acts as a backup while the other updates.

    One problem is that the data rate I quoted is the maximum capacity for a continuous stream. In practice, that is often illegal due to duty cycle rules. So, you might get 40 kbps while transmitting, but local laws may let you transmit only 1% of the time. If you choose to be obedient it will take a lot longer to get the firmware across.

    Even then, let’s say it takes a few hours to get the full firmware, I think this can be alright for sporadic firmware updates.


  • Is it legal or technological?

    Bandwidth is a resource that limits the amount of information that you can transfer per unit time. You can get a higher throughput if you can increase the information density or by using more bandwidth. Physically, both are possible. Increasing bandwidth of a 868 MHz radio signal is primarily limited by law, not technology. Increasing the information density is limited by the technology of the receiver, transmitter, and modulation.

    As for Meshtastic, they often rely on the SX1261/2 chips that have a bandwidth limit by design. The people who manufacture that chip could design it to support a wider bandwidth, but it makes more sense for them to optimize the specs in a way that falls within the legal boundaries of the target applications. This comes from the chip’s datasheet:

    So… It is both, legal and technological. The technology is designed considering the law. But it is not limited by the laws of physics.

    And there is an additional layer of constraints that are imposed by the Meshtastic firmware itself.


  • The frequency ranges, power of the transmitter, signal bandwidth, the fraction of time that the transmitter is transmitting (duty cycle), and some other parameters are regulated. LoRa usually transmits in an unlicensed ISM region of the radio spectrum. So, you don’t need a license to transmit, but devices still need to comply with the regulations to remain lawful.

    I’m not sure about the legal bandwidth limits in different locations. The commonly used LoRa chip (SX1261) can support up to 500 KHz bandwidth, and the OP mentioned 250 KHz as their limit.


  • According to the SX1261/2 datasheet, the maximum RAW bit rate of this LoRa chip is 62.5 kb/s for 500 KHz bandwidth and spreading factor of 5.

    The bit rate is constrained by the spreading factor and the bandwidth. Bandwidth is constrained by law, spreading factor is constrained by design. You can find the details in LoRa™ Modulation Basics, AN1200.22, section 4.

    For 250 KHz Lora, you can use the equation to get the theoratical max:

    If we set SF = 5, BW = 250,000, bit rate is 39.0625 kb/s for a raw bit stream.

    So, I think that the limit of 62.5 kb/s is a safe speed ceiling to consider. I am not sure how you would get 125 kbps using LoRa and current constraints. You could switch the chip to FSK mode and pull at 300 kb/s IF the FSK link is strong enough.








  • It took 3 walks to the park due to bugs and unhandled exceptions but it worked!

    The python script connects to a node that is left at home. The bot can detect and process a message with the following format:

    PST
    Com: Meshtastic
    Sub: Posting via Meshtastic
    Bod: Made a python script to create posts via meshtastic messages. If you can see this, the test worked! Posting from the park with no mobile data ^_^
    
    

    It will parse the message and create a post. So, as long as I can reach my home’s node I am able to create a post.