OpenMarine

Full Version: A new beginner with Pypilot !
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Hello everyone, I am an old sailor, but a beginner with Pypilot. I installed Openplotter on a Raspi4, it works fine, as well as OpenCpn. I'm now trying to setup Pypilot, with an Arduino Nano and MPU 9250, I haven't gotten to the motor control stage yet, I've connected LEDs instead, it seems to work, the LEDs react as I orient the MPU or when I give heading instructions to Pypilot. My problem is that I can't control with a wired keyboard, the buttons connected to GPIO 17, 27 or 22, or 5 and 6 have no action. On my small boat, it would be essential to have a wired control that would be easily accessible. I have read testimonials from people who have been able to connect Pypilot with a wired keyboard, I would like to do the same, but I must be doing some manipulations wrong. If someone could help me, knowing that I am bad in electronics and computers ! A huge thank you to Sean for his sharing and his work made available to all. Sincerely, Lucian.
Can you give details of your wiring?

The buttons can be shorted to GND to trigger them. Can you test and verify the state changes by running the "gpio" command?


I have considered different possible options over and over again, and essentially concluded that wired buttons are not the most useful at least for the hardware I intend to produce in the future. I offer 433mhz RF remote controls, but essentially in the future intend to produce various wireless keypads using either 433mhz or wifi. The current wired buttons require a wire per button and are therefore a lot of wires to implement. A wireless solution, even if wired (for power) or using aaa batteries (can last years) is more versatile.

For homebuilt setups, the wired buttons may prove more convenient as it avoids needing the additional arduino to support reliable 433mhz reception.
Hello Sean, thank you for answering me so quickly.
This is my hardware configuration:
Raspi 4 B with 8 GB of Ram with HDMI screen, and with keyboard and mouse on powered USB hub.
An Arduino Nano powered by Rasp's 3.3v pin, Rx and TX connected to Rasp with 1.2K resistor, pins 2,3 and 9,10 connected to LEDs for control, pin 6 to ground with resistor 1.2K, as well as the pins (1 to 7) not used
An MPU 9250, powered by a 5v pin from the Rasp and connected by SDA and SCL.
This all seems to work, except that the calibration seems to be lost every time I turn the system off.
I made control tests with a contactor connected to ground by a 2.4K resistor, and to the recommended pins without success.
I would have liked to be able to order the pilot with a wired keyboard, but it seems to me that this is not possible with Openplotter, all the testimonials that I have read were made with TinyPilot.
However, it would be better for me to have a wired control for several reasons:
First, a control located at the entrance to the boat would be accessible to me from the chart table and from outside, near the winches used for tacking. This is where the my Autohelm control is located, and it suits me just fine.
Then, I wouldn't want to add layers of electronics and wireless communications that I have very little control over and which are liable to break down for multiple reasons.
Finally, I must admit, I'm not very young anymore, I was born in 1951, and I have a little trouble with new communication technologies, especially smartphones, I must have fingers that are a little too big! However, I have professionally installed and managed a web server for a SIGB (PMB) under Ubuntu with Apache, and although I've forgotten everything since then, I'm not totally averse to Linux.
To properly situate my needs, I want to use Raspi 4 for navigation with OpenCpn AND the Pypilot function, without adding any other hardware installation. I want to replace my old ThinkPad and my Autohelm ST3000 with a Rasp, which from what I have been able to assess so far is much more efficient, but without complicating the installation.
I've read a lot since my first post, and I think there may be a solution to my problem in this topic, but I don't have the skills to take advantage of it: https://github.com /marcobergman/pypilot_conversion/blob/main/README.md
Sorry for this somewhat long post, but I think we save time by exposing the entire problem from the beginning.
you certainly can add wired control. If you can run the "gpio" command from a terminal, and ensure the output level changes when you press or release a key it will indicate this.

For the wired control you do have to enable the pypilot_hat service which maybe the reason it is not working?
just curious, why does your IMU 9250 gets 5 Volts and your Nano uses 3.3 Volt?
They should use the SAME Voltage.
Sorry I forgot to say this too. The imu should _not_ receive 5 volts. Please do not do this.

By contrast, the nano normally _does_ run on 5 volts. The code assumes it, but you would need level translators. It is possible to simply use 2 resistors for 5v to 3v3 on the uart, or a zener and resistor. Converting the other way should not be an issue.

You probably can run the nano at 3v3 but keep in mind the code and schematics I produce do not. I use optical isolation between the two which also handles voltage translation.
Good evening everyone, I had stupidly thought that not having a physical HAT I could not activate the HAT functionality. But Sean was right, I did it, and it works, I can select keys and assign a function to them. But it doesn't work 100%. I can select gpios 17,27,23,22,5 and 6, which I linked to actions 1,-1/10,-10/ engage, disengage, but I can't select any other gpios except a few times on the 26. And I can't activate the tackport and tackstarboard actions, it stays on action=none.
For Holgerw, the Arduino in 3.3 v, it allows not to send 5v in the RX of the Raspi.
Thank you all for your help.
(2022-10-20, 08:20 PM)Ebraball Wrote: [ -> ]Good evening everyone, I had stupidly thought that not having a physical HAT I could not activate the HAT functionality. But Sean was right, I did it, and it works, I can select keys and assign a function to them. But it doesn't work 100%. I can select gpios 17,27,23,22,5 and 6, which I linked to actions 1,-1/10,-10/ engage, disengage, but I can't select any other gpios except a few times on the 26. And I can't activate the tackport and tackstarboard actions, it stays on action=none.
For Holgerw, the Arduino in 3.3 v, it allows not to send 5v in the RX of the Raspi.
Thank you all for your help.

so specifically everything works except gpio 26?

Also the tackport tackstarboard dont work?

What about the generic "tack" option, does it work?

Thanks for reporting issues.  Maybe the hat service can be easier to pass the 'none' option for the lcd driver which saves some cpu and avoids using the spi bus there.
Good evening, everything works, but I am limited to gpios 17,27,23,22,5 and 6, I cannot select more connections. Sometimes I can select gpio26, but it's very random and it doesn't last. Even if I assign tackport or tackstarboard to gpios 17 and 27 which are stable, for example, there is no related action. The configuration of the keys remains on: none, and does nothing if I press the buttons. As we can no longer find new Raspi, I bought a used one, maybe it is damaged on the gpio pins.
For the "tack generic" option, if I click on it in the Pypilot interface, the leds 9 and 2 or 10 and 3 depending on whether I selected port or starboard are lit continuously until I cancel. I don't know how to put the lcd driver as an option none.
I corrected the Nano power supply and the MPU power supply as indicated by Sean.
Hi there. Some progress in my setup. I assigned GPIOs 17 and 27 to engage and disengage, 23 and 22 to +1 and -1, 5 and 6 to +10 and -10. That works well.
I had also assigned 26 and 18 to tackstarboard and tackport, but "action" stayed on "none", and there was no effect when I pressed the buttons.
So I tried assigning 26 and 18 to +5 and -5, and it works. My problem would therefore be solved if we could change the +5 and -5 setpoints to +120 and -120, this would allow tacking. I couldn't find how we could do this.
Pages: 1 2