Pi Pico sending Seatalk data using PIO - Printable Version +- OpenMarine (https://forum.openmarine.net) +-- Forum: OpenPlotter (https://forum.openmarine.net/forumdisplay.php?fid=1) +--- Forum: How I did it (https://forum.openmarine.net/forumdisplay.php?fid=6) +--- Thread: Pi Pico sending Seatalk data using PIO (/showthread.php?tid=5801) Pages:
1
2
|
Pi Pico sending Seatalk data using PIO - jimseng - 2024-10-31 Hello. This is just proof of concept but here is a quick video of a Raspberry Pico sending auto pilot commands to a Raymarine autopilot computer. I had it reading the Seatalk data from the Seatalk bus as well. Could be a cheap method of providing 433mhz wireless remote control of autopilot for when you need to dodge the ferries while putting fenders out on the foredeck coming into port. If anyone is interested I'd be happy to share the Micropython code. (Not my work, someone showed me how to do 9 bit serial with a Pi Pico and PIO). Image is of a discarded custom PCB I made for my boat. I'm hijacking the transistors here to get the data onto the Seatalk bus. http://kitcat.club/ki/STPico.mp4 Seatalk pico npn RE: Pi Pico sending Seatalk data using PIO - PaddyB - 2024-10-31 (2024-10-31, 06:23 PM)jimseng Wrote: If anyone is interested I'd be happy to share the Micropython code. (Not my work, someone showed me how to do 9 bit serial with a Pi Pico and PIO). Hugely interested!!! (Getting a 403 forbidden with your links) RE: Pi Pico sending Seatalk data using PIO - jimseng - 2024-10-31 Sorry about the link permissions. Sorted now. So I'm having trouble attaching things. I tried attaching a couple of Python scripts but it said "not allowed". So here is a zip file with two .py files. One is for receiving Seatalk data and one is just a test to send data as per the video. http://kitcat.club/ki/Pico_pio_Seatalk.zip The receive .py file reads seatalk data and sends it via a udp socket. Obviously it requires the usual opto set up as per this https://demo.signalk.org/documentation/setup/seatalk/seatalk.html I used this to test receiving seatalk data into the Pico and sending it to a Signalk dashboard instrument. Sending seatalk requires building a simple interface with 2 transistors and two resistors. I followed the "schematic" in the python script from here: https://github.com/marcobergman/remote_pilot/tree/master So far all I have done is tested it works, just to prove the Pi Pico 9 bit serial conecpt using PIO. I got as far as testing a cheap 433 mhz key fob from Amazon. In the attached script, it just toggles between auto and standby in the main loop, but it could be adapted for 433mhz wireless control or perhaps an auto helm repeater station. Sorry if this is a bit rough and ready, I didn't know if anybody would be interested and since I am not on my boat right now so I can't be sure these still work. But they did! I just wanted to see if a £6.00 micro controller could embed itself in the seatalk bus. It might be useful. Let me know what you think and if I can help. And please someone, improve my code! RE: Pi Pico sending Seatalk data using PIO - PaddyB - 2024-10-31 Thanks so much! Spose I'll have to by a Pico now RE: Pi Pico sending Seatalk data using PIO - jimseng - 2024-10-31 You haven't got several? I love 'em. I have 3 on my boat. (Well rp2040 based things anyway) RE: Pi Pico sending Seatalk data using PIO - PaddyB - 2024-11-01 (2024-10-31, 11:37 PM)jimseng Wrote: You haven't got several? I love 'em. I have 3 on my boat. (Well rp2040 based things anyway) Got an extended family of esp8266 & esp32 onboard, even the fridge thermostat is an esp32 taking to signalk Don't think they will do 7 bit comms though, or haven't found a way yet anyway. Pico on it's way from Amazon It's actually one of the last few things that would be useful cruising, logging seatalk depth & waterspeed to check what the tides really do where you are. RE: Pi Pico sending Seatalk data using PIO - PaddyB - 2024-11-05 Going OK so far, I got a Pico but not one with wifi so deleting the network related stuff it boots OK & sends test messages from serial so looking hopeful! And for anyone struggling with code, https://www.perplexity.ai/ can be very useful!! Think it uses chatgpt. Code: this is micropython running on a raspberry pi pico, explain what it does - def PioRx9N1(BITS=9): Code: The provided MicroPython code snippet is designed to run on a Raspberry Pi Pico and implements a simple input reading loop using the Programmable Input/Output (PIO) feature of the RP2040 microcontroller. Here’s a breakdown of what each part of the code does: Look about right jimseng(AIs do make stuff up quite often)? Some of that micropython is unfamiliar to this esp8255/esp32 micropython user And thanks again!! RE: Pi Pico sending Seatalk data using PIO - jimseng - 2024-11-06 Ah. Well, as I hopefully made clear, the PIO stuff was shared with me on the Rpi Pico forums. I asked a question and someone said here, try this. I don't know anything about the PIO side of the Pi Pico (well I do now after your AI post!) I initially went down this road as my Pi 5 was unable to read 9 bit Seatalk, until someone else far cleverer than me came up with a solution. I thought surely a Pico could do it. I think it would be handy to be able to pop a Pico into the Seatalk mix if needed. I got as far as reading the Seatalk data in and with the wifi version of the Pico had it transmitting $STALK strings via UDP to SignalK. The Seatalk_Build function of the receiving script is possibly not the most elegant way of constructing Seatalk datagrams but it works for me. I'd like to try building a super cheap wireless remote for the autohelm. I reckon it could be done for about £15.00. Glad you got things working. RE: Pi Pico sending Seatalk data using PIO - PaddyB - 2024-11-09 Yay!! It works. Just tried it, the nmea0183 coming out of the Pico didn't have a checksum but adding that manually came up with on signalk recognised. fantastic, been wanting to get log/depth data into signalk & influx for so long Adding a checksum should be easy enough. RE: Pi Pico sending Seatalk data using PIO - jimseng - 2024-11-12 I was thinking of building a rev counter with a Pico in the engine room (or should that be "room", if I were to be modest) and injecting it into the seatalk bus. I probably should do some proper collision management though. Endless possibilities. Glad you got it working. |