An S.PORT Compass for FrSky Radio Control Telemetry.
by blopa1961 in Circuits > Arduino
256 Views, 1 Favorites, 0 Comments
An S.PORT Compass for FrSky Radio Control Telemetry.
Target audience:
Radio control hobbysts who would like to add Compass telemetry. It can be used with iNav LUA in EdgeTX radios.
Disclaimer:
No Warranty: THE SUBJECT SOFTWARE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, ANY WARRANTY THAT THE SUBJECT SOFTWARE WILL CONFORM TO SPECIFICATIONS, ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR FREEDOM FROM INFRINGEMENT, ANY WARRANTY THAT THE SUBJECT SOFTWARE WILL BE ERROR FREE, OR ANY WARRANTY THAT DOCUMENTATION, IF PROVIDED, WILL CONFORM TO THE SUBJECT SOFTWARE.
In other words: use at YOUR OWN RISK.
License:
Attribution Non-commercial (by-nc)
Supplies
for the Arduino Nano version:
- Arduino Nano or Arduino Pro Micro
- QMC5883L Magnetometer board
- Dupont Female to Female cables
- Dupont cable with a Futaba connector on one end and 3 female pins on the other
for the ATtiny 85 version (which requires a custom PCB):
- ATtiny85 (SOP8)
- Half height 7.3728MHz crystal
- (2) 22pF 0805 capacitors
- (3) 10K 0805 resistors
- (1) 100nF capacitor
- (1) FR4 single sided PCB (and etching materials)
- (5) Dupont PCB male pins (may come included with the QMC5883)
- (4) 90° Dupont PCB male pins
- (1) short piece of cable
- (1) Futaba male to male cable
- Arduino UNO to be used as an arduino as ISP programmer
Warning: the QMC5883L chip is 3.6V max, so, if you build this project use a sensor like the one in the photos (which has a voltage regulator and works in 5V)
Arduino Nano Code
Arduino Nano Connections:
Nano QMC5883L
GND -> GND
5V -> VCC
A4 -> SDA
A5 -> SCL
Nano S.PORT
GND -> GND
VIN -> VCC
D2 -> Signal
The code will work as it is with the unmodified QMC library if you use an Arduino Nano, but you will need copy the attached trimmed version in the sketch folder if you use the ATtiny85 version (do NOT install the QMC library if using an ATtiny85).
If you would like to improve precision, I suggest you analyze the full QMC library, do a calibration and save the obtained data hardcoded in the source code as there is no room for the calibration routine in the ATtiny. You should also add the declination for your location to the code.
CODE: see attached .ino file.
Libraries used:
"S.Port sensor library for FrSky" by Herman Kruisman and "QMC5883LCompass" by MPrograms
To compile the ATtiny85 version you will also need to install the ATTinyCore (by Spence Konde) in Boards Manager
ATTiny Version
These photos contain the Schematic, PCB (top view), component mount (bottom view), and prototype for the ATtiny85 version.
Please notice there's no room in the ATtiny85 for a bootloader. The lonely pin in the center is connected to the ATtiny's /RST pin and used for the Arduino UNO as a programmer.
ATtiny connections:
ATtiny85 QMC5883L
GND -> GND
5V -> VCC
PB0 (pin 5) -> SDA
PB2 (pin 7) -> SCL
ATtiny85 S.PORT
GND -> GND
5V -> VCC
PB1 (pin 6) -> Signal