Home
DSP
Ham radio
Java™
Arduino™
Contact

Software snippets/libraries (tested on Arduino™ Leonardo, Nano & Uno):

Having worked a lot with Java before, I was quite surprised to learn that C does not support Boolean variables or arrays (an absolute must if you don't want to waste memory). So here comes my solution to this. The library provides functions to conveniently manipulate single bits in an array of "byte". For example "getBit(array_name, 117)" would return Bit 117 from the array "byte array_name[SIZE]" with SIZE=1+NUMBER_OF_BITS/8

A library supporting Boolean arrays.

One of the most frequent topics in µC-programming is the scheduling of tasks, both repetitive and single execution. Here you'll find some proven, simple and reliable code which you may directly incorporate into your sketch. It is solely based on Arduino's scope of commands, hence does not consume any extra resources like timer or interrupts. Furthermore, it can handle all types of tasks that are of practical interest, which are cyclical, single, conditional repetitive (repeat task only if ...) or even none-linear (1st run -> repeat after 10s, 2nd run -> repeat after 25s, ...).

A universal task scheduler.

... and a simple Timer-based task scheduler which is sufficient for most tasks and easy to handle. In uses Timer 2, conflicting with tone() and analogWrite() at pins 3 & 11.

A Timer2-based task scheduler.

Linear fitting is often the method of choice when dealing with nonlinear functions (e.g. sensor curves, polynomials). Instead of sacrificing precious program memory, the data representing x/y support points could be stored in EEPROM. Such functionality is provided by the library below, which can handle linear fits of nonlinear functions with 16 bit resolution in both x and y. More complex structures (i.e. "y" can have more than one "x") can of course be fitted as well by splitting them up.

A library providing two-dimensional linear fits based on data stored in EEPROM.

Prior to storing value formats other than "Byte" in the EEPROM, some transformation must be done. The class "EEPROMdataStorage" will handle that for you, making it easy to write/read variables of arbitrary format or even whole arrays of those to/from the EEPROM.

Library supporting storage of arbitrary data formats in EEPROM.

Simple and lightweight library providing communication with a (single) DS18B20 temperature sensor (3-wire setup with separate power supply and 4.7k pullup resistor). The functions of this library do not consume any timer or interrupts and will hence stall until data-transfer has been completed (up to about a second, depending on resolution).

DS18B20

A small library supporting generation of a CRC8 checksum for a given dataset of 1...255 byte using CRC8-polynomial 0x97.

CRCGenerator

A set of libraries supporting wireless or wire-bound serial data broadcasting (e.g. sensor data via a 2-wire connection or radio broadcast on an ISM-frequency). The signal is DC-free (Manchester-coded) and error-checked (CRC8).

Data broadcasting

A library to calculate the Moon's and Sun's position, time of rise and set + Moon's phase for a given UTC (time_t) and set of coordinates

Moon and Sun

A library to control the AD9850 AD9851 DDS

AD9850_51

A simple yet robust DCF77 decoder (does not consume any timers)

DCF77-decoder

A library to generate WSPR messages for a given Call, Locator and Power

WSPR-encoder