Skip to content

Step 5 The HAT interface

marcobergman edited this page Nov 17, 2021 · 25 revisions

Software module

The HAT interface is primarily a software module that supports the raspberry's GPIO pins for keys, an LCD screen, and an infrared (IR) interface.

To enable the interface, type sudo systemctl enable pypilot_hat.

To make it work without the hat arduino, edit /etc/systemd/system/pypilot_hat.service and change '44444' into 'none'

Then it should look like this:

pi@openplotter:~/pypilot $ pypilot_hat none
have gpio for raspberry pi
loading config file: /home/pi/.pypilot/hat.conf
failed to load /proc/device-tree/hat/custom_0 : [Errno 2] No such file or directory: '/proc/device-tree/hat/custom_0'
overriding driver default  to command line none
arduino process on  28138
renice: failed to set priority for 28138 (process ID): Permission denied
warning, failed to renice hat arduino process
No hat config, arduino not found
28139 (process ID) old priority 0, new priority 19
(30 seconds pause)
web process 28139
web config {'remote': False, 'host': 'pypilot', 'actions': {'auto': [], 'menu': [], 'up': [], 'down': [], 'select': [], 'left': [], 'right': [], 'engage': ['gpio18'], 'disengage': ['gpio23'], '1': [], '-1': [], '2': [], '-2': [], '10': [], '-10': [], 'compassmode': [], 'gpsmode': [], 'windmode': [], 'tackport': [], 'tackstarboard': []}, 'pi.ir': False, 'arduino.ir': False, 'arduino.nmea.in': False, 'arduino.nmea.out': False, 'arduino.nmea.baud': 4800, 'lcd': {'contrast': 60, 'invert': False, 'backlight': 200, 'flip': False, 'language': 'en', 'bigstep': 10, 'smallstep': 1, 'remote': False, 'hue': 27}}
web process on port 33333
web client connected c9fb01fcb0ac415a91e56d8432098268
apply ('gpio23', 1) 168451.776421598
apply ('gpio23', 2) 168451.776693334
apply ('gpio23', 0) 168451.776797443

Configuration

The pypilot_hat software module can be manually configured by editing ~/.pypilot/hat.conf. For instance, if you don't have an infrared sensor, set pi.ir to False in this file.

This pypilot_hat software module also provides a web interface at socket :33333 that can be used to configure these same things. Note that the web interface at port :33333 has a startup delay of 30 seconds.

Hardware

Moreover, the pypilot_hat software module can also connect to an extra arduino that provides a RF433 wireless remote, NMEA0183 I/O and a buzzer. This extra arduino would need to be programmed with the hat.ino sketch. The reference schematics for this hardware is at https://pypilot.org/schematics/pypilot_tinypilot.pdf.

A few notes to interpret this diagram:

  • The communication between this extra HAT arduino and the raspberry is the MISO and MOSI signals.
  • The RF433 module comes in at J9, pin2, as DATA and connects to the HAT arduino on PD2.

The reason for this extra arduino is to offload the raspberry. Besides, the signal that comes out the RF433 module is serial, but too long in term of bits and too non-standard to be handled by a standard UART. It needs to be sampled (as in bitbanging) and there is no way the raspberry could do that as well.


Step 6: The Arduino controller >>>

Clone this wiki locally