-
-
Notifications
You must be signed in to change notification settings - Fork 35
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
Porting to Micropython / Raspberry Pi Pico ? #44
Comments
HI @petaramesh would you mind sharing your code examples? I am in the same position as you and might be able to reuse / extend your work if you're okay with that. Thank you! |
Yeah I will try snipping the BT code from the rest of my project into something that can work standalone and post it here. |
Very much appreciated |
Well here comes my quick and dirty extraction from my quick and dirty code. Make sure to install the asyncio librarires as indicated in the comments before attempting to run it. I cut it from my whole project so it may still contain unnecessary code. I've tested it with a single Victron device I have on hand, and it works. So let me know... NB: This comes from a project that does a host of other things so I didn't want the BT reception to use too much CPU time.
|
I've changed some LED related values above, that's not that important, but it was wrong (as my original project uses LEDs in a different awy). |
I got it compiled. There is a double parenthesis and missing import of "sys" (will post my code once I got it running) I am running on
but no hex value. Since I don't know the type of the value I am not sure if the key mismatch is my fault or if the device is not correct. How did you get the original hex values extracted? |
You can these values in the VictronConnedct app on your phone. Go to your device, then “parameters”, menu, “Product info”, and down there “Show encryption key”. |
Thanks for pointing that out. I got it working with your instructions. I think this is a great basis for starting of a victron_ble port - maybe it can be considered. Otherwise anyone coming from Google will find this helpful. Thanks alot @petaramesh for the port! |
Hello, I've updated my code to allow receiving and processing Victron BT advertisements even when the VictronConnect phone app is connected to the Victron device (previous code would only work when the VictronConnect app was not connected to the device). So here is the new code :
|
https://github.com/jensimik/vicky |
Maybe this is of some help? |
Hello,
I'm creating a hobby microcontroller project that involves reading Victron systems (a BMV-712 smart, a battery SmartSense, a Smart MPPT charger and an Orion DC-DC charger) on a Raspberry Pi Pico running Micropython.
I found out your project and it exactly fits the parts I miss for getting and processing the data from the Victrons.
I tested it on my Linux PC and it works like a charm.
So I tried installing the libraries onto my Pico, but bummer ! it doesn't work because Micropython doesn't have most of the standard CPython libraries you import - although it may generally provide what should be needed.
I'm not a seasoned Python dev myself - actually this is my first project in python, let alone on a microcontroller, but I have written all the code I need and it works, except for the Victron Bluetooth part that I'm still missing.
I don't feel at ease enough with your code for trying to port it myself to this environment, so i was wondering if it was in your own developments projects or if you could possiblly consider it ?
Many thanks in advance.
Addendum :
I've now written enough quick and dirty code so I can retrieve Victron's values (not all of them, just those that I need) without using your libraries.
I got inspiration from them but couldn't easily port them as they rely on a number of libraries / modules that are not available under Micropython or are trimmed down (i.e. no support for AES-CTR in cryptolib, no enum, no typing, and worse of all no construct and no support at all for 24-bit integers).
So I had to work around all this and use different and dirty solutions.
Still, generic libraries for doing this in a cleaner way would be nice.
The text was updated successfully, but these errors were encountered: