Posts: 4
Threads: 2
Joined: Mar 2020
Reputation:
0
Hello every body
I just got a non working autohelm 800 and my goal is to integrate the pypilot motor controller (arduino nano) inside the autohelm case.
Since I have pypilot installed on an openplotter, i have two questions to tune my project :
1) I would like to reuse the autohelm buttons connected to the arduino to send back some basic command to pypilot like engage/disengage or tack. Can pypilot accept that kind of command from the arduino? if yes, where can i find the command frames?
2) I was thinking using an isolated RS422 link between open plotter and the arduino. But i also may consider using a low power wierless connection like blutooth or ziegbee reducing wiering and garanteeing isolation. does someone have feedback on wiereless communication between pypilot and the motor controller?
thank you all
adrien
Posts: 495
Threads: 26
Joined: Jun 2019
Reputation:
31
(2020-05-03, 12:52 PM)adrien Wrote: 1) I would like to reuse the autohelm buttons connected to the arduino to send back some basic command to pypilot like engage/disengage or tack. Can pypilot accept that kind of command from the arduino? if yes, where can i find the command frames?
2) I was thinking using an isolated RS422 link between open plotter and the arduino. But i also may consider using a low power wierless connection like blutooth or ziegbee reducing wiering and garanteeing isolation. does someone have feedback on wiereless communication between pypilot and the motor controller?
1) I built both tinypilot (pizero) and the arduino in a former ST2000+, see this post. The keys were mapped to the pizero with a piece of custom code I added to the tinypilot image, the code is in github. The pypilot is connected to the opencpn plugin in openplotter through wifi. This was a lot of work.
2) For short distances you can even connect them only though an optocoupler/level shifter. Remember the link between pi and arduino is bi-directional. But with openplotter outside the autohelm, you'd also connect the keys back to the openplotter... I'm not aware of anyone having done this wirelessly.
Posts: 4
Threads: 2
Joined: Mar 2020
Reputation:
0
(2020-05-04, 09:50 PM)ironman Wrote: (2020-05-03, 12:52 PM)adrien Wrote: 1) I would like to reuse the autohelm buttons connected to the arduino to send back some basic command to pypilot like engage/disengage or tack. Can pypilot accept that kind of command from the arduino? if yes, where can i find the command frames?
2) I was thinking using an isolated RS422 link between open plotter and the arduino. But i also may consider using a low power wierless connection like blutooth or ziegbee reducing wiering and garanteeing isolation. does someone have feedback on wiereless communication between pypilot and the motor controller?
1) I built both tinypilot (pizero) and the arduino in a former ST2000+, see this post. The keys were mapped to the pizero with a piece of custom code I added to the tinypilot image, the code is in github. The pypilot is connected to the opencpn plugin in openplotter through wifi. This was a lot of work.
2) For short distances you can even connect them only though an optocoupler/level shifter. Remember the link between pi and arduino is bi-directional. But with openplotter outside the autohelm, you'd also connect the keys back to the openplotter... I'm not aware of anyone having done this wirelessly.
hello Ironman
thanks for the answer and Great Project
If I understand, the tiny pilot can be used autonomously with the embedder imu or receive wind, gps data and routes from open plotter (open cpn) via wifi. That sound great.
My first idea was to use open plotter pypilot without another tinypilot; Since there is between 4m to 7 m of wires between my open plotter and the tiller pilot, it is more interesting to use a full duplex isolated RS422 communication to keep the 38400 baudrate.
But your project seems to solve my two problems
Posts: 2,364
Threads: 21
Joined: Jun 2016
Reputation:
75
You don't need rs422... I have been able to use the uart at 3.3v from 200ft or more runs. If you use shielded wire or ethernet wire you can use twisted pairs grounding one wire in each pair and the noise is very low.
As for using arduino gpio for buttons... It's not implemented in the mainline. There isn't a lot of gpio left over on the arduino, and pypilot doesn't deal directly with keypresses, it is a separate application. It's also difficult to use a lot of the features of the buttons without feedback from the lcd. The tillerpilots have leds so you might need something like that too. It is definitely possible to implement but I feel like the result would be the same as tillerpilots which isn't actually very good.
It would be more flexible to use a wireless remote with lcd, and just clip it to the tillerpilot somehow. I am looking into this and there are some very cheap boards with esp32 and lcd already integrated.
Posts: 5
Threads: 0
Joined: Apr 2021
Reputation:
0
Hello,
I have finished and tested a tinypilot based AH800 refitted autopilot. The Rpi is fixed inside the sailboat and the motor controller is fitted inside the tillerpilot casing, the two being connected by a 4.5m long cable with a twisted pair of wires (I am only using a level shifter and the serial communication seems to be working fine).
For now I am using the web control app but it would be great to reuse the buttons of the AH800 (+1/+10/-1/-10/auto), in addition with an LED feedback. I was thinking of using the Arduino gpio and sending the commands over the serial communication. I would then need to also update the pypilot code for dealing with these commands.
I am not sure how complicated it would be to implement it, so I am really interested in any feedback.
Cheers
Posts: 2,364
Threads: 21
Joined: Jun 2016
Reputation:
75
2021-07-14, 02:11 AM
(This post was last modified: 2021-07-14, 02:11 AM by seandepagnier.)
it is possible with software modification.. but the problem is there are limited gpio remaining. If you dont need the end stop switches, or rudder feedback or temperature sensor, that would give you 4 keys, and you could also take advantage of a few others, but this would change motor.ino. I would then suggest sending messages back to the pi, receiving them in the servo driver and somehow dispatching them to control the pilot. The user interfaces typically run as separate services which is another issue. I think it is a nice idea, but the problem again, is a lot of people have lots of different good ideas and it is just hard to support everything. If you do make working code modifications, be sure to share, and I will do my best to integrate it (most likely with a compile time switch) but I cannot accept changes if they potentially degrade performance of the motor controller.
If you only need the buttons, one option would be a 433mhz wireless remote control and wire the buttons to it. The simplest way would be to just buy a 433mhz remote control and velcrow it on top of your tillerpilot. Then you can pull it off and use it walking around the boat. If you want to reuse the existing buttons, I have source code for how to use an arduino nano as a 433mhz wireless transmitter, already in the pypilot repository, and the transmitters and receivers cost about a dollar, but you need an arduino on the pi too. I can offer pypilot hat which has lcd with arduino and RF receiver as well as the wireless remote for a , I have not listed on my store yet, but feel free to PM me.
If you need the lcd display as well, on the tiller pilot, it is really not recommended to use the arduino to drive it but it is also maybe possible, just be aware the arduino is nearly at its capabilities to do what it is doing already. A better way would be to use ttgo-tdisplay wireless esp32 module. This would communicate directly via wifi to the raspberry pi and includes a screen, you can wire buttons directly to it. I have already working firmware for it, so it provides full control and configuration (tuning gains etc) but the display is not visible in direct sunlight. You could use a different display on an esp32 as well, I have 2 displays supported, so it should be easy to add drivers especially if you have code already for one in c.
Finally, you could just run an ethernet cable (or something with at least 6 conductors) and the buttons wired to the pi from a long distance, but I am not sure about doing this with spi for the lcd.
Posts: 5
Threads: 0
Joined: Apr 2021
Reputation:
0
2021-08-01, 11:47 AM
(This post was last modified: 2021-08-01, 11:53 AM by latilz.)
Hi!
Thanks for your very detailed answer and great ideas I will probably go for the WiFi communication from the tiller pilot to the pi, which is probably the simplest option for me.
I could use an esp32 module or an Arduino MKR1000 WiFi that I already have, connect buttons and maybe a display to it. Would it possible to get the firmware you have ?
Thank you
Posts: 2,364
Threads: 21
Joined: Jun 2016
Reputation:
75
The firmware used is micropython. The only real changes I made to support the lcd menu:
https://github.com/pypilot/micropython_ugfx
If you execute "make upload" in pypilot/hat it compiles and puts the needed modules on the esp32 using ampy. With slight modification you could probably get it working without a display using the standard micropython firmware. I am still developing the remote module mostly trying to make it waterproof which is difficult
Posts: 143
Threads: 16
Joined: Jul 2019
Reputation:
9
(2021-07-14, 02:11 AM)seandepagnier Wrote: it is possible with software modification.. but the problem is there are limited gpio remaining.
If you dont need the end stop switches, or rudder feedback or temperature sensor, that would give you 4 keys, and you could also take advantage of a few others, but this would change motor.ino.
For what it's worth, if you have an ADC pin free, you can read a few buttons by using resistors:
https://www.tinkercad.com/things/9eZJtkR...-input-pin
http://dduino.blogspot.com/2012/03/butto...adder.html
And I'm looking at the controller on the website, and ADC6 and 7 aren't used :-)
https://pypilot.org/schematics/wp_controller.pdf
motor.ino would still need to be modded to report the buttons back, but a plus is that it frees up GPIO pins on the RPi.
Posts: 2
Threads: 0
Joined: Feb 2022
Reputation:
0
Hi. I QM trying to change the default display editing the hat.config file but all the pypilot files in the directory usr/local/lib/python3.7/dist-packages, are not writeble. I have installed pypilot trough openplotter settings, and it works for me opening pypilot on my raspberry pi4B. My aim Is to have the data available on a display fit on the pi.
Any help about the appropriate procedures?
I thank for replying.
Many thanks
Francesco
|