abersailbot / kitty-hardware

Kitty's hardware files
Creative Commons Attribution 4.0 International
1 stars 1 forks source link

Use fewer USB ports #18

Open Danyc0 opened 7 years ago

Danyc0 commented 7 years ago

Kitty used so much USB that she needed a USB hub to operate. The USB hub was messy, big, and was a big extra source of possible problems.

The devices she needs are as follows: Wifi host (same as in dewi) Wifi client (same as in dewi) GPS (same as in dewi) Arduino (same as in dewi) RoWind

The need for a hub was in part because she was built using a Pi B, so only had 2 USB ports to start with. However even with the extra 2 ports gained in the B+ and above, it's still not enough to go without a hub. Thanks to Captain morgan, the GPS has been moved to the Pi's (only) serial port, however that port used to be used by the xBee, which now has to go via USB, so they have just swapped.

The main problem is that the RoWind has an RS232 interface, and therefore we opted to use an RS232-USB converter. An alternative would be to use a Logic-Level-Converter and pass the data into another serial port, however you have to be very careful with that because the voltage levels in RS232 are 0 to -12V (and also 0 to 12V as a twisted pair), the Pi uses 3.3V serial (I think, It could be 5V, but I don't think so, it's worth checking) and the Arduino uses 5v serial (again, I think, but worth checking it's not 3.3V). So care must be taken to get a converter which can deal correctly with the conversion from RS232 to the correct 3.3V/5V serial. The biggest problem with this however is that there are no free serial ports anywhere in the setup, because the Pi's is used by the GPS via Captain Morgan, and the Arduino talks to the Pi over USB (which uses up the Arduino serial port). A possible idea would be to use Software Serial on the Pi or the Arduino, but either option would need EXTENSIVE testing in the real boat, because software serial has a big habit of screwing up servo/PWM channels in the Arduino (but only temperamentally), because they use the same timer internally (there are fixes for this involving editing the serial code to use a different timer, or not using a separate timer at all, but they need proper testing). Also software serial on a not Real Time Operating System on a device like the Pi will often end up going badly because the scheduler will often decide the code generating the serial needs to be paused to let another process run, therefore screwing up the comms.

Have fun with this one!

naturesyouth commented 7 years ago

while performing my nightly dredging of component suppliers i stumbled across this chip https://www.maximintegrated.com/en/products/interface/controllers-expanders/MAX14830.html that uses spi to control 4 uarts. i would suggest using this to interface with the arduio (atmega328), gps and an rs-232 transceiver ic, then hook the xbee up to the native uart, this would allow the pi to boot with a serial monitor at all times, which would be an improvement over the current system. and the best part? https://github.com/torvalds/linux/blob/master/drivers/tty/serial/max310x.c DRIVERS!!!

Danyc0 commented 7 years ago

We can't use the Arduino over anything except USB, because we need it to be programmable from the Pi, but otherwise that sounds like a nice idea, although we have got to be a bit careful about PCB complexity.