Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add RAKwireless WisMesh Hub (RAK2560/RAK9154) #4117

Merged
merged 10 commits into from
Jun 16, 2024

Conversation

beegee-tokyo
Copy link
Contributor

@beegee-tokyo beegee-tokyo commented Jun 16, 2024

RAKwireless is planning to offer the RAK2560 SensorHub and RAK9154 Solar Battery Lite preflashed with Meshtastic Firmware as a Meshtastic Router or Repeater under the name WisMesh Hub.

This pull request adds support for the RAK2560 device and the communication protocol for the RAK9154 Solar Battery Lite to Meshtastic.

image

The RAK2560 device is based on the RAK4630 (used on RAK4631) stamp module and is a low power device with LoRa and BLE connectivity.

  • LoRa 868-930 MHz support
  • Nordic nRF52840 MCU with Semtech SX1262 LoRa transceiver
  • 12 VDC over power supply or solar panel
  • Embedded antenna (external antenna optional)
    • High efficiency (over 75%) LoRa Band 860~930 MHz
    • Support 700~960 MHz and 1700~2170 MHz.
  • IP66-rated waterproof enclosure

The RAK9154 is a solar panel/battery combination with

  • Battery capacity: 5200 mAh
  • Operating temperature: -20~60° C
  • Dimensions: 180 x 130 x 60 mm
  • Outputs: one 12 VDC output for Sensor Hub
  • Integrated BMS and heater
  • Supported mounting pole diameter: 55~80 mm (Other mounting options possible)

WisMesh Hub in Meshtastic mobile app (temperature/humidity is optional and requires RAk1901 module inside the RAK2560):
image

@CLAassistant
Copy link

CLAassistant commented Jun 16, 2024

CLA assistant check
All committers have signed the CLA.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@beegee-tokyo
Copy link
Contributor Author

Test installation (with internal antenna)
image

Copy link
Member

@caveman99 caveman99 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution, this is a very useful device in the line-up cause we have many requests for ready-made devices. Please see my review comments, hoping i judged the intent of the changes correctly.

],
"unwantedRecommendations": [
"ms-vscode.cpptools-extension-pack"
]
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't check in the vscode files. This will cause merge conflicts all over the place.

@@ -0,0 +1,191 @@
#ifdef HAS_RAKPROT
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think the RAK9154 support is places correctly. The Telemetry folder is for devices that actually transmit values over Lora. This looks more like gathering values for internal processing. If this is only ever used once for this particular device, you can as well put it in the variant folder and skip deriving it from TelemetryModule. If you add the OSThread class to inheritance you can use the runOnce model without having to define it as a sensor (which it isn't in the meshtastic sense)


bool RAK9154Sensor::getMetrics(meshtastic_Telemetry *measurement)
{
return true;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternatively if the values really should be able to go out over the mesh, you need to implementthese functions :-)

// #define PIN_GPS_EN PIN_3V3_EN
// Disable GPS
#define MESHTASTIC_EXCLUDE_GPS 1
#else
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not only disable GPS but removes all GPS code from the binary. I assume goal is to have a GPS active on Serial2?

Copy link
Contributor

@Talie5in Talie5in Jun 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@caveman99 Just thinking out loud, should this go into its own variant/rak2560/ - otherwise some code gets clobbered (eg, the JLink CDC pin assignment, unsure if that's used but noticed it while going through the changes)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Talie5in
I can create extra variant files for RAK2560, but I wanted to avoid double maintenance, RAK2560 is just a RAK4631 on a different PCB with a solar power battery. With both in one variant.h I have to work only with one file if there are changes required.

Open for suggestions @caveman99

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

really depends on how much it diverges from a stock 4631+Baseboard. Right now there's only a handful of defines. In the long term i think i'd prefer a separate variant.h file, since this is more or less a fixed configuration while we have to account for all sorts of modules on the wisblock boards. We broke out an EINK version too, since the defines were diverging too much and it got harder and harder to keep them apart.

@caveman99
Copy link
Member

also worth noting: We do have an ENUM for devices to identify who is actually talking to us. Right now this code is masquerading as a RAK4631. I'd really like to assign this its own RAK2560 label or even better call it WISMESH-HUB. If you agree i'd open up a pull request to the devicenum protobuf.

@beegee-tokyo
Copy link
Contributor Author

Hi @caveman99

(1) "Please don't check in the vscode files"
Not sure what happened, I guess my PIO installation messed it up. I will reverse that.

(2) " if the values really should be able to go out "
Personally I am not sure if a device will/should report it's battery level over the mesh. I guess that having them in the telemetry in power metrics should be sufficient. I will move the RAK9154 functions into the variant folder and check if compilation works. If users want these values over the mesh, we can add this later.

(3) "I assume goal is to have a GPS active on Serial2?"
The RAK2560 doesn't have GPS by default, I did some tests through Serial 2, but the GPS module was not detected. That's why I removed GPS for now. I hope with the help of my R&D colleagues at RAK I get it to work, but for now it doesn't.

(4) "I'd really like to assign this its own RAK2560 label"
Yeah, I wanted that, but I was not sure how to do it. For the name itslef, "WisMesh Hub" as a name is still under discussion. Better we use the RAK2560 as name, similar as for the RAK10700, which is a pre-assembled device as well.

I will work on the changes and push again.

@caveman99
Copy link
Member

caveman99 commented Jun 16, 2024

  1. regarding the vscode stuff, it does that all over the place. Just have to be careful to not check the changes in, we supply the files as a default config.
  2. the procedure is to configure a new values in meshtastic/protobufs - same for new (remote) sensors. I'll do that for the RAK2560 now.

Another request: can you enable 'maintainer edits' on the pull requests? our repo is set up so we cant' merge outdated pull requests, and we need to be able to update your fork with other changes (rebase).

@beegee-tokyo
Copy link
Contributor Author

beegee-tokyo commented Jun 16, 2024

I am sure I enabled "maintainer edits", but it might be related to this strange response I got to the CLA:
First it said signed, then it says "not signed yet". I clicked the "recheck" several times already.
image

@beegee-tokyo
Copy link
Contributor Author

image

@thebentern
Copy link
Contributor

thebentern commented Jun 16, 2024

The RAK2560 HW_MODEL protobufs should be available downstream now. @caveman99 this would just need to be pretty much a carbon copy of the RAK4631 but with the variant.h changes and the additional macro?

@beegee-tokyo
Copy link
Contributor Author

The RAK2560 HW_MODEL protobufs should be available downstream now. @caveman99 this would just need to be pretty much a carbon copy of the RAK4631 but with the variant.h changes and the additional macro?

@thebentern
Anything I need add in the variants files?

@thebentern
Copy link
Contributor

@thebentern Anything I need add in the variants files?

I believe all you should need is to pull over what you have for the RAK4631 variant.h, since they're identical except for the serial port changes and additional macros.

;upload_protocol = jlink
extra_scripts =
${env.extra_scripts}
../firmware/variants/rak2560/create_uf2.py
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can drop the ../firmware part, this doesn't work if the local folder is named differently. variants/rak2560/create_uf2.py should pick the script up just fine. The platfirmio.ini always assumes workspace root.

-L "${platformio.libdeps_dir}/${this.__env__}/bsec2/src/cortex-m4/fpv4-sp-d16-hard"
-DGPS_POWER_TOGGLE ; comment this line to disable triple press function on the user button to turn off gps entirely.
-DHAS_RAKPROT=1 ; Define if RAk OneWireSerial is used (disables GPS)
build_src_filter = ${nrf52_base.build_src_filter} +<../variants/rak2560> +<mesh/eth/> +<mesh/api/> +<mqtt/>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

src/platform/nrf52/architecture.h needs to be amended to pick up the new hardware model, before the plain 4630 is found.

@GUVWAF
Copy link
Member

GUVWAF commented Jun 16, 2024

Also maybe slightly unrelated to this PR and needless to say, but if you plan to pre-flash them as Router/Repeater please make sure to not copy completely the same configuration to each device, because all devices will get the same unique NodeNum and that leads to issues on the mesh.

@caveman99 caveman99 merged commit 02050a4 into meshtastic:master Jun 16, 2024
11 of 83 checks passed
@beegee-tokyo
Copy link
Contributor Author

@caveman99 @thebentern

Thanks a lot for the support to merge this in.

@GUVWAF
We will flash a plain Meshtastic firmware with no setup (not even as router or repeater).

@beegee-tokyo
Copy link
Contributor Author

@caveman99 @thebentern

Last question

Created a firmware from original sources for RAK2560.
The Meshtastic App now shows "Hardware model: UNRECOGNIZED"
Does it need an app update to show the model correct?

@geeksville
Copy link
Member

hi @beegee-tokyo I just happened to notice this bug and your comment. Yeah. Clients will eventually get the latest protobuf code and then properly convert the enum (which they don't recognize without those new strings) to the device name.

(long time no see - I hope all is great for you -kevin).

@beegee-tokyo
Copy link
Contributor Author

@geeksville

All good here, busy with RAKwireless WisBlock. And as RAKwireless is now jumping full speed on the Meshtastic train, I am on your trails now.

No problem for now with the module name, it will take some weeks (I guess) before you can officially buy it.
I am just ahead with the preparation and testing.

@geeksville
Copy link
Member

@beegee-tokyo cool beans. I've been away from meshtastic for a while but I've decided to devote some time to really decreasing power consumption. I'm initially using a RAK4630 that I had in a drawer as my reference platform for this work. It seems great!

@beegee-tokyo
Copy link
Contributor Author

@geeksville
Let me know if you need anything. I am sitting literally on the source 😁
Btw, we have distributor in US, Rokland in Florida (I think) if you need any parts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants