I received an Arduino MKR WIFI 1010 from element14 with a hint to the RF (Radio Frequency) contest. So I decided to dig out my ArduTrx project and update it to work with the Arduino MKR.
Background
The ArduTrx was originally described in these blog posts:
ArduTrx - a 2-meter-band ham radio transceiver with Arduino
ArduTrx Update: Open Source Hardware and professional PCB
ArduTrx Update: new HF modules and better documentation
ArduTrx is 3.3 V compatible but the previously used HMI shield is not.
So I decided to use my ArduHMI shield. This adds a bigger graphical display as a replacement of the former alpha numerical display. The shield was already described in a former project here: NFC-Badge - Update your badge with your smartphone - Design data of the HMI shield
Finally an adapter is needed to connect the Arduino MKR to these Arduino Uno compatible boards: Arduino MKR adapter
This leads to a heavy stacking of boards. As I don't have a suitable battery for the Arduino MKR I added a 18650 LiIon battery with holder and soldered it directly with wires.
Changes
used pins
To get the shields running together some pins have to be changed. The display is connected to the microcontroller using hardware SPI. This is available on the Arduino Uno pins 11 to 13. unfortunately these pins are occupied by the ArduTrx shield. So this shield has to be modified that other pins are used.
The following table shows the new pin usage. The signals marked in red have to be changed.
shield |
signal name | direction |
pin on Arduino Uno connector |
pin on Arduino MKR connector | comment |
---|---|---|---|---|---|
ArduTrx | serial communication with hf module | input | 0 | RX | |
ArduTrx | serial communication with hf module | output | 1 | TX | |
ArduTrx | squelch | input | 2 | 2 | |
ArduTrx | analog / pwm audio output | output | 3 | 3 | |
ArduTrx | PTT | output | 4 | 4 | was pin 11 |
ArduTrx | Power down | output | 5 | 5 | was pin 12 |
ArduHMI | chip select to display | output | 6 | 6 | |
ArduTrx | output power | output | 7 | 7 | was pin 13 |
ArduHMI | signal A0 to display | output | 8 | 0 | |
ArduHMI | reset to display | output | 9 | 1 | |
ArduHMI | backlight control | output | 10 | A6 | |
ArduHMI | serial data to display | output | 11 | MOSI | |
12 | MISO | not usable as GPIO when SPI enabled | |||
ArduHMI | serial clock to display | output | 13 | SCK | |
ArduHMI | resistor divider of switches | input | A0 | A0 | |
ArduTrx | measurement of VIN | input | A1 | A1 | |
ArduTrx | audio input | input | A2 | A2 | |
ArduTrx | rotary encoder signal A | input | A3 | A3 | |
ArduTrx | rotary encoder signal B | input | A4 | A4 | |
ArduTrx | rotary encoder signal SW | input | A5 | A5 |
These images show the additional wires on ArduTrx.
power supply
The coolest feature of the Arduino MKR WIFI 1010 for this project is its builtin battery charging function. Unfortunately the battery voltage is not available in any of the pins. So you have to make an additional wire from the battery to the input (VIN) of the ArduTrx shield (or in my case the MKRadapter). On the ArduTrx shield the voltage regulator should be shorted. The maximum voltage of the battery should be somewhere around 4.2 V and this is totally fine for the HF modules.
The next problem was that the display shield needs 5V to generate the supply voltage for the display. When powered by battery the 5V rail of the Arduino MKR WIFI 1010 is not powered. So I added an additional schottky-diode from VIN to 5V (also on the MKR adapter). In my case this is OK because VIN is connected to the battery and has maximum 4.2V. On regular Arduinos the VIN rail can go up to 20 V.
Software
This updated project also needs new software. Mainly because of the new display. So I forked the old code repository and updated it.
Additionally the Arduino MKR WIFI 1010 does not have an EEPROM so I used the FlashStorage library to store the settings in the flash of the microcontroller. Also the TimerOne library does not work with the SAMD microcontroller. It turned out that there is no really good timer library for the Arduino MKR WIFI 1010. So I added a function that manipulates the timer registers directly.
The software is heavily based on the old software for the Arduino Uno and a two line alphanumerical display. So it doesn't completely take advantage of the new and much bigger display. It seems like it is time to totally rewrite the whole software.
The software is available here: https://github.com/generationmake/ArduTrx_on_Arduino_MKR