This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Almost There . . .
#1
I'm excited to finally have the Pypilot working through the Opencpn plugin. Just making it move the rudder while I'm in the slip at the moment, but things are looking good.
My setup is a VNC connected RPI 3B+, MPU9250, PWM motor controller that's probably too low amps for the real world, and an Arduino UNO, after the NANO took a dive. Not entirely unexpected, the NANO had been a participant in a number of hexacopter crashes.
It's driving a fairly new Alpha 3000 ballscrew linear actuator. I've got current sense through a DIY shunt resistor, which I haven't got calibrated yet, but  I can see it work. Rudder position sense is working through the Alpha 10k pot feeding a voltage divider. No limit switches yet. I put LEDS on the motor controller Direction, PWM, and Enable inputs for troubleshooting.
My big problem is serial communication through the Pi GPIO to the Arduino. I've finally gotten a loopback test to work on the 5V side of the level converter, so I know the Pi TX and RX are working, but nothing on either Arduino. I'm almost ashamed to say how much time I've put into this issue without success. Finally plugged in USB and Bingo!
While I can get a USB Isolator on Amazon, I'd really like to get things working with an opto-isolated GPIO serial connection. Probably something simple to someone of experience, so any helpful hints would be appreciated
Thanks
Reply
#2
Did you enable the hardware uart? Is the device /dev/ttyAMA0 or /dev/ttyS0?
Reply
#3
I've tried enabling and disabling the UART, back and forth several times. I can get the minicom loopback to work using "sudo minicom -D /dev/ttyS0" when I have the UART enabled. I originally tried to use an optocoupler circuit with PC817's, but now I'm learning that they may not be fast enough. The last tries were using just logic level converters to try to simplify things. I thought it might be just the NANO since it's had a hard life, but the results were the same with the UNO. I had to comment out the "fuses" lines in the motor.ino sketch to get the UNO to work. That's just to keep experimenting till Amazon delivers some more NANOs. I've been trying it assigning /dev/ttySO to Pypilot or KPLEX or None in the Openplotter screen with equal results.
I've just found the Openplotter Serial Output thread with the advice from e-sailing:

If you disable bluetooth you can use the serial port on the rpi 3 in the same way as on rpi 2.
edit the file /boot/config.txt
sudo nano /boot/config.txt
insert at the end of the file
dtoverlay=pi3-disable-bt
stop bluetooth serial
sudo systemctl disable hciuart
reboot

so maybe I'll try that next.

I've got the setup apart working on hardwiring the MPU, the voltage dividers for rudder sense, voltage sense, and temperatures at the moment, to try and get rid of breadboard and jumper wire issues.
I'm sure it's obvious that I'm running at the very edge of my meager knowledge of electronics, Raspian and the Arduino IDE, but it's been a great learning experience.
Thanks.
Reply
#4
I have not had much luck with the software port /dev/ttyS0

It is better to enable the hardware uart, reboot and ensure you have /dev/ttyAMA0 and nothing is using this port already, then it should work fine talking to the arduino.
Reply
#5
(2019-03-23, 01:15 AM)seandepagnier Wrote: I have not had much luck with the software port /dev/ttyS0

It is better to enable the hardware uart, reboot and ensure you have /dev/ttyAMA0 and nothing is using this port already, then it should work fine talking to the arduino.

Sean,
 For some reason I was under the impression it should be /dev/ttyS0. I'll give it a try as soon as I get the hardware back together.  Should be done this weekend. What optocouplers do you recommend?
Thanks for the help.
Reply
#6
(2019-03-23, 03:02 AM)Sailbus Wrote:
(2019-03-23, 01:15 AM)seandepagnier Wrote: I have not had much luck with the software port /dev/ttyS0

It is better to enable the hardware uart, reboot and ensure you have /dev/ttyAMA0 and nothing is using this port already, then it should work fine talking to the arduino.

Sean,
 For some reason I was under the impression it should be /dev/ttyS0. I'll give it a try as soon as I get the hardware back together.  Should be done this weekend. What optocouplers do you recommend?
Thanks for the help.
/dev/ttyS0 is the unreliable software port, /dev/ttyAMA0 is the reliable hardware port you get when disabling bluetooth.

I am using cpc5001 opto isolators but others may work.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)