Standalone device utilized with rotary encoder as input

I have started to get involved in Meshtastic. My first idea was to extend the features with a standalone operation. (Thus device can send text message without the phone app.)

I have already designed a 3D printed case with an integrated rotary encoder. You can find the design here:

The next step is the plugin.

I can imagine a new screen where the user can select from predefined (canned) texts to be sent. I can also imagine some sentence forming methods, like adding parts of the sentence from another set of predefined words. E.g.:
ā€œI need help with @{subject} at @{location}ā€ and subject can be: saw, water, shed, fire, ambulance; location can be: my GPS location, home, the forest, the river side, the landing zone; etc.

I might be able to do the coding myself, but some help might be useful because this a quite complex project. My question will follows.

5 Likes

Very cool idea, there have been discussions about pre canned messages before, I imagine much of the code involved is pretty similar to that required by the I2C keyboard.

1 Like

Can you please direct me to that discussion you mentioned?!

Garmin inReach Mini is a satellite messenger that also uses a ā€œlimited inputā€ mode for selecting pre-canned messages. You might take some interface inspiration from them! :+1: That case and rotary encoder looks great!

Really nice progress being made towards a stand alone device!

2 Likes

Garmin just released a new version of inReach Mini - Mini 2 with a bit better menu, mesaging options, navigation, digital compass,ā€¦ - this would be an ideal form factor for meshtastic device.

1 Like

Hi was just wondering if thereā€™s a guide on how to use or test the canned message plugin?

Itā€™s ok found it Canned messages | Meshtastic

Development is ongoing, not finished yet

2 Likes

@garth Iā€™m fairly excited about this. I just ordered some encoders and hope to try this out soon.

Any chance you will do some more updates within the 1.2.x branch?

For the 1.3.x / 2.0 branch I wonder if it would be a good idea to use ā€˜short codesā€™ so canned messages can be sent and received without sending the actual message.

Maybe something along the lines of 'If message starts with ^ lookup the part following ^ from an internal table and display that message. ^1 could be ā€œIā€™ve reached my destinationā€, ^01 ā€œHeading back nowā€, ^11 ā€œIā€™m Okā€ and so onā€¦ if the data after ^ isnā€™t a message in the table it would just display whatever the payload was as a normal message.

The more I think about this the more Iā€™m liking it. With this short code idea people without encoders can still use the short codes as manual entries or from a selection from the various apps and the transmission times would be very quick.

1 Like

I donā€™t actually write any firmware but I think generally stuff that will go back in 1.2 will be things that are same in both, probably not the case here as it needs some work to finish up and we probably need to clean up some of the storage of the canned messages.

1 Like

What you can see in the actual documentation is actually works now out of the box. the only issue we are facing with is how to configure (transfer) message templates, as currently we are topping out a limit here. So, if you have a hardware you can already try canned messages, but you will be limited to about 200 bytes of message template size in configuration.

I was working on a solution but stuck. I might want to continue in 1.2 as this was the base of this solution already.

About the short codesā€¦ I do not see the benefit of that. You meant to have a built in lookup table by the sort codes, or this should be a configurable thing?

2 Likes

Looking forward to seeing this function to test too. I also ordered some encoders :slight_smile:

It looks like itā€™s possible to setup custom messages:
Up to 50 messages with a total length 200 bytes.

Example from the documentation using the Python-CLI:
meshtastic --set canned_message_plugin_allow_input_source ā€œ_anyā€
meshtastic --set canned_message_plugin_messages ā€œIā€™m fine|Iā€™m out|Iā€™m back|Need helping hand|Help me with saw|I need an alpinist|I need ambulance|Keep Calm|On my way|I will be late|Iā€™m already waiting|We have company|Beer is cold|Rogerā€

Got it, thanks.

What is the cause of the 200 byte limitation?

I think some devices have an additional spi flash storage, is that already being used by the project?

My other idea was to include default canned messages in the firmware. Since the messages have to be stored on device somewhere instead of transmitting the message itself, just send a reference

This is very stupid. But it turns out that every configuration setting is actually handled as a mesh packet (e.g. you want to remotely set some configuration). Now, a mesh packet is about 250 bytes long at maximum, containing here all other configuration as well.
A new approach is developed meanwhile, and waiting to be part of the next release. This will not be part of 1.2 any more.

Would this work on Heltec v2 LoRa boards? I tried wiring this up but the push button does not bring up the list of messages.

I also tested on two tbeams. When pressing the push button on the encoder the canned messages plugin shows up on the screen however the rotary controls do not work and Iā€™m only able to select the first message. Is anyone else encountering this on tbeams?

Expected Behaviour:

  1. User presses push button on the rotary encoder
  2. Device displays list of messages configured in canned messages plugin
  3. User rotates the rotary encoder clockwise or counter clockwise to select one of the messages
  4. Device responds to the rotary encoder movements and scrolls up or down the list of messages
  5. User selects message to send and presses push button on the rotary encoder
  6. Device sends message and displays ā€œSending Messageā€¦ā€ on screen
  7. Message is successfully sent

Current Behaviour:

  1. User presses push button on the rotary encoder
  2. Device displays list of messages configured in canned messages plugin
  3. User rotates the rotary encoder clockwise or counter clockwise to select one of the messages
  4. Device does not scroll through messages. Only first message is selectable.

Looking at other tutorials online it looks like the rotary encoder might need some resistors and capacitors added.

Iā€™ll test out with another circuit.

Remixed an existing TBeam Meshtastic case on thingiverse and added space for a rotary encoder:

Messages Iā€™ve configured for family/city use includes:

  • Status Please
  • I Love You
  • BRB
  • Iā€™m back
  • On My Way
  • At Home
  • At Work
  • At School
  • W Friends
  • Need Help
  • Stay
  • Run
  • Hide
  • Iā€™m Safe
  • Hungry
  • Tired
  • Happy
  • Sad
  • Angry
  • Sick
  • Lost
  • Hot
  • Cold
  • Wet
  • Dry
  • Stuck
  • Sleepy

You do not need any resistors or capacitors as I do the debouncing in software. However the rotary encoder must be set up correctly. Iā€™m not sure what pins you can use on Heltec v2 LoRa or TBeam, but those pins must be suitable for proper digital input and not used by any other onboard parts.
Also check the setup of the rotary in the documentation: Canned messages | Meshtastic

1 Like

Hi @prampec for the heltec lora v2 Iā€™ve the following wiring:

Heltec v2 Pin 37 ------ Encoder PIN A
Heltec v2 GND -------- Encoder GND
Heltec v2 Pin 38 ------ Encoder PIN B

Heltec v2 Pin 36 ------ Encoder PRESS
Heltec v2 GND -------- Encoder Press GND

For the first TBeam (V 1.1) Iā€™ve the following:
TBeam Pin 32 ------ Encoder PIN A
TBeam GND -------- Encoder GND
TBeam Pin 33 ------ Encoder PIN B

TBeam Pin 15 ------ Encoder PRESS
TBeam GND -------- Encoder Press GND

For the second TBeam (V 1.1) Iā€™ve the following:
TBeam Pin 32 ------ Encoder PIN A
TBeam GND -------- Encoder GND
TBeam Pin 33 ------ Encoder PIN B

TBeam Pin 13 ------ Encoder PRESS
TBeam GND -------- Encoder Press GND