tizianoniero.it Solar system HiRes images

Focuser firmware

This is the first version for Arduino micro. You can download the source here. To compile and upload it into the Arduino board you need to install the Arduino IDE. The Arduino IDE contains also the driver to connect to the Arduino Micro Board. Follow the instructions provided here.

Description

There is a main .ino file (sketch_micro_focuser_2.ino) and two auxiliary classes (DebounceButton and AnalogReadLpFilter).

  • The setup routine contains all initialization for GPIO pins, USB serial input, reading some values from EEPROM.
  • The loop routine parses the inputs from USB serial port, from the keypad, and reads the temperature from the analog port A5. Then it change the global status which is used mainly in the "Move" routine to perform the next action.

The auxiliary classes:

  • The DebounceButton class is used to read the status of the keypad buttons filtering out the multiple transitories when a button is pressed. Only a stable LOW or HIGH status is provided, togheter with an info on LOW to HIGH and HIGH to LOW transitions. This is because I didn't use the pins 0, 1 and 2 which have interrupt capabilities.
  • The AnalogReadLpFilter class is used to low-pass filter the sampled temperature. From my measures the loop frequency is about 2000 cycles per second, i.e. 2KHz sampling frequency for the temperature. In order to sub-sample down it and reduce sampling noise a low pass filter is needed. Here it is done by a moving average.