PyFly HAT-ish Board
PyFly HAT-ish Board
Summary
PyFly is a Raspberry Pi HAT-ish board primarily for drones and high power rockets. It has enough features that it can be used elsewhere as well. The Raspberry Pi Zero is very small and has more processing power than a microcontroller. The first revision of the PyFly PCB design was submitted for fabrication on March 4th and arrived on March 17th. This is a 4 layer PCB design; I was impressed with how quickly Smart-Prototyping processed the board.
Update - 9/24/2017:
I have two operating hand-built boards and an RF amplifier test board. Apart from a few bugs, they are operating as expected. The biggest nuisance is the lack of mounting holes. I am adding two more mounting holes in the revised layout. I am also adding a secure memory device for a secure data link; this is especially useful for quadcopters and airplanes receiving flight instructions from the ground. I have also designed an enclosure, using openSCAD, for mounting inside rocket body tubes. The audio output is getting redesigned for more power to a speaker.
I have re-named from PiFly to PyFly. There is another PiFly product already on the market, see: http://www.thepifly.com/
My son helped me setup a Github page for software support. He is writing a library for the GPS and the A/D converter, and I am writing a setup script and a OpenSCAD enclosure design. See:
https://github.com/robertrau/piflyMechanical
The setup script may be useful to those not using a PiFly, that would like to use a software defined transmitter or some other software we install for the PyFly. Feel free to take a look and edit it to your own needs.
Download the start of the user’s manual here: PyFly Manual.pdf
Example Applications
The PyFly was conceived for my drone and rocketry requirements. Additional features were added for my other hobbies and also to hopefully make the board interesting to a broader audience. Below is a character schematic of the PyFly in a rocketry application. I made a PDF showing six different example applications you can download.
Rocketry RC airplane
Quadcopter Weather station
HAM radio transceiver High altitude HAM TV weather balloon
Data acquisition system Clock Radio
Download it here: PyFly Applications.cct.pdf.
Hardware Features
• Power: Designed to run on 3.0 to 12.0 volts (not 13.8 volt automotive power). This includes one to three LiPo cells popular with drones, but any power source will do that has enough current. A single power supply powers the Raspberry Pi, the HAT board, and its USB device from an onboard 5 volt 2 amp buck-boost switching power supply. (The four high current outputs require at least 4.5 volts; i.e. two or three LiPo cells)
• Raspberry Pi compatible: The PyFly is intended to connect to the Raspberry Pi Zero so that components of each board face away from the middle. A 40 pin socket could be soldered to the top of the board for use on the Raspberry Pi 3, or any 40 pin Raspberry Pi.
• RF Transmitter Amplifier and Filter: The board has a dual RF filter and 200mW amplifier. It supports an RF carrier from either GPIO14 or GPIO18. One filter is for the 144MHz HAM band and the other filter is for the 440MHz HAM band. 144MHz transmission can be supported by pifm, nbfm, and rpitx. 440MHz transmission may someday be supported by rpitx, but currently rpitx doesn’t seem to work on the Raspberry Pi Zero.
• Servos: Can control up to eight servos. (Standard 6 volt servos will require 2 LiPo cells, higher voltage tolerant servos can use 2 or 3 LiPo cells)
• High Current Outputs: Intended for Rocket upper stage igniters and parachutes, these high current, high side drivers have diagnostics and a redundant enable system to prevent false assertions. Connections use press-to-release terminal blocks.
• Support for headless operation: There is a shutdown button and a shutdown acknowledgment LED for safe headless shutdown. There is also a low battery comparator that can assert a shutdown request.
• Small size: The PyFly has the same width as Raspberry Pi Zero or Pi Zero W, but it is longer. It measures 29.25mm by 150mm. It is intended to fit in a high power rocket 38mm tube coupler, strapped on the belly of a quad-copter, or in an RC airplane. Also small enough to be a smart handi-talkie with the addition of a USB software defined receiver. See PDF download below for application schematics.
• USB redirected: You cannot use the Zero’s USB port in a 32mm wide space. The USB test points on a Raspberry Pi Zero can be soldered to test points on the HAT board for the USB type A connector and still fit in a 32mm wide space.
• GPS: The board uses the Skytrac Venus838 module. In binary mode, this device can make 50 location updates per second. It has an SMA connector for an external antenna. This is required for the use of a helical, omni directional antenna. GPS data can be backed up with a super capacitor that has a connector for an external rechargeable coin cell. Currently there is only Raspberry Pi support for ASCII NMEA-0183 compatible output at 10 location updates per second. There is also a four pin connector for an external GPS if the board is built without the onboard GPS.
• Most I/Os have ESD protection.
• A/D support: Options for 8, 10, and 12 bit footprint compatible A/D converters. The default build uses the 10 bit TI ADS7957SDBTR A/D converter with 16 channels; some for internal measurement and diagnostics and some external channels. The external A/D connector is a 0.050” pitch connector. Two external channels already have pull-up resistors to the reference for thermistors. The converter uses SPI interface.
• Keypad support: A connector supports either a standard six-key or 12-key keypads. The keypad is connected through a resistor array to a A/D input. With an external resistor array up to 26 keys are possible. Keypad design software here.
• High G linear accelerometer: Uses ST Microelectronics H3LIS331DLTR. Uses SPI interface.
• Barometric pressure sensor: Uses a ST Microelectronics LPS25HBTR. Uses I2C bus.
• Alternate barometric pressure sensor: Uses a Measurement Specialties (TE Connectivity) MS560702BA03-00 that operates to -40°C. Uses SPI interface.
• 9 axis inertial and magnetic platform: PyFly version 1.2 uses a Bosch BMX160 for 3-axis acceleration, 3-axis gyro, and 3-axis magnetometer. Mounted on board centerline. Uses I2C bus.
• Humidity sensor: Uses ST’s HTS221TR sensor on I2C bus.
• Differential Pressure sensor: Can be used for drone/aircraft Pitot tube for airspeed. Measurement Specialties (TE Connectivity) 4525DO-DS5AI030DP on I2C bus.
• Audio Output: GPIO13 has PWM audio filter, amplifier to drive a speaker, and connector.
• Microphone: Knowles SPH0645LM4H-B on the I2S bus.
• Time of Day Clock: Maxim DS3231S using the GPS Super Cap/Battery Backup.
• Maxim 1-Wire bus controller and connector.
•Quad tachometer Input: compatible with Spektrum SPM1452 sensors. Uses an Analog Devices ADT7470.
•Secure memory device to allow authentication of communications DS28C36.
•Interface to RGB serial APA102 LEDs. These are also available as a continuous tape from Sparkfun.
Software
The software support includes four parts:
1)Setup and install of drivers and examples on PyFly.
2)Custom libraries for A/D and GPS on the PyFly
3)Library development support with a setup script for development on host system.
4)The vast amount of Raspberry Pi support on the Web.
I have written (with a lot of help) a bash setup script for both hardware demos and development setup. This includes bash and Python scripts for most of the boards sensors and controls.
My son is writing libraries for the serial, GPS (high speed binary protocol), and the analog to digital converter. He has also written a bash setup script for library development on Ubuntu. See these Github repositories:
https://github.com/robertrau/libpifly
https://github.com/robertrau/piflySetupScript
Download the schematic report ‘Software Book’ here: PyFly.html
Download the spreadsheet for the thermistor table here: PyFly Thermistor Table.xlsx.zip
Visit my other pages:
Mechanical
The PyFly needs a enclosure for most applications. A cylindrical clam shell enclosure designed in OpenSCAD will be available on Github, see pictures below. The size of the cylinder is parametrized so it can be adjusted for different body tube sizes. Other characteristics include:
1)Raspberry Camera support
2)Openings for all LEDs
3)Wire channels on the outside
4)Battery holder on outside for GPS battery backup
5)Openings for all connectors
6)Counter bored holes for four screws to sandwich the PyFly and Raspberry Pi Zero between the two halves.
View of Left half in OpenSCAD
View of 3D printed Left half with Raspbery Pi Zero, PyFly, and camera
View of both halves assembled