Power supply of the Turtle board
The Turtle board can be powered via battery (regular AAA batteries or rechargeable NiMH batteries). As a second option, it can be powered via the micro USB port. The board automatically switches between USB and battery power supply, USB power has the preference.
Turtle board: pin and interrupt assignment
The board package includes a 2×4 pin header to be used with an external debugger. For debugger use, the header must be soldered on and connected to a remote debugger, see details on the Nucleo ST-Link Interface page. By default, the Turtle software starts and tries to connect a console to the debugger UART (TX/RX wires, 230400 baud). If no debugger UART is detected it tries to connect via a USB virtual COM port for 30 seconds. If neither of them is available there is no console output.
Note: Low-level crash messages will only be printed on the external debugger or external UART interface because USB services will stop on crashes. All regular messages will work fine with a USB virtual COM port or with a debugger UART. Instead of a debugger UART it is also possible to connect a regular external UART to the RX/TX pins for console message printing.
Install the antenna
There are three antenna options:
- The SMA antenna is included can plugged on the SMA connector
- A U.FL connector is available for external U.FL antennas
- A basic wire can be connected, for this the SMA connector must be desoldered and the wire must be soldered to the middle pin of the SMA pad on top of the PCB
A basic wire antenna must be shortened to 8.2 cm. The antenna is adapted to λ/4 for 868.1 MHz.
The exact formula for calculating the antenna length is:
Wavelength = speed of light / frequency
For λ/4 this value must be divided by 4 again.
Note: The Turtle board is shipped adjusted for a single RF frequency (433 or 470 MHz, or 868 or 915 MHz). The delivered frequency is marked on the board. The board frequency and antenna frequency must match, otherwise it will not work correctly.
Switch on/off voltage “VDD-SW” for external loads
An internal voltage switch allows external power consumers to be switched on and off so that they do not consume power permanently. The IO pin “EXT_POWER_SW” is defined in the file “PinMap.h” of the RadioShuttle software for switching. It can be switched to either “EXT_POWER_ON” or “EXT_POWER_OFF”. The measurement of the battery voltage, which is measured via the “BAT_POWER_ADC” ADC pins, is attached to the “VDD-EXT” cable. To ensure that the board requires as little power as possible, the “VDD-EXT” is usually switched off.
Measuring the battery voltage
To measure the VDD supply voltage (approx. 3.3 volts when powered via USB, approx. 3.0 volts with battery operation) a measuring device is provided on the board. The battery voltage is displayed with an accuracy of about 100 mV. The voltage is measured and displayed when booting or resetting. The
BatteryVoltage() function in the “RTCUtil.cpp” file measures and returns the value of the voltage.
Turtle “deepsleep” and wake-up
The RadioShuttle sample software for the Turtle board has a main loop where it is processing tasks and goes into the Mbed
sleep() function, i.e. into deepsleep for the lowest energy consumption.
Note: When a USB console is used,
sleep() cannot be called because this would disconnect the USB console. Also, deepsleep will not be entered when timer functions are registered. The MCU “LowPowerTimer” feature supports deepsleep and can be used instead.
Any registered input interrupt handler, or an RTC or “LowPowerTimer” handler, will wake up the MCU from deepsleep and continue processing immediately. After processing is completed the
sleep() function will be called again and enters into deepsleep. When the MCU is in sleep or deepsleep, the green LED is turned off.
Interrupt routines design advice
By default, interrupt routines should be as short as possible and should never wait for something to avoid deadlocks. Also, printing to a USB console does not work in interrupt routines, and printing to a UART is also involved with limitations.
The Turtle board sample code has a great solution for it: The interrupt routine posts an event, the main loop picks up the interrupt event and does the processing on a user level code (non-interrupt). This allows console printing, waiting for something and easy processing:
- Add a new unique interrupt bit in the “main.h” file, e.g. MY_INT = 0x20
- In the interrupt function, send the event via InterruptMSG(MY_INT);
- In the main loop check via if (pendirqs & MY_INT) for your interrupt events
This makes programming much easier and allows
dprintf() print debugging. As an example, check out how the
timerUpdate() function in “main.cpp” works.
The Turtle board supports battery voltages from 2.1 V up to 3.6 V. Usually customers use 2 x AAA batteries which will provide 3 V when full or 2 rechargeable NiMH batteries which will provide 2.4 V when full. The AAA battery holder can also be swapped against a AA battery holder because its connector (wire width) is compatible.
In colder environments regular batteries and rechargeable NiMH batteries do not work well. In this case higher-quality Lithium batteries (2 x 1.5 V) can be used.
Only batteries placed in the battery holder (+/- pins) can efficiently power the board for many years in stand-by operation with regular LoRa RadioShuttle messages.
Boards powered via USB or VIN will use an LDO (Low-dropout regulator) to reduce the input voltage to 3.3 V. The LDO permanently consumes a small amount of energy which would be no problem for a USB power supply but does not qualify for a long-lasting battery operation.
Note: Rechargeable Li-ion (lithium-ion) or LiPo (lithium polymer) batteries cannot be used to power the board via the battery input pins because their voltage is higher than 3.6 V, which will destroy the MCU and LoRa chips on the board. However, powering the board by Li-ion or LiPo batteries via VIN will work.
The Turtle board has no built-in battery charger because the boards last for many years and swapping batteries is done quickly.