Skip navigation

I've been looking at some magnetic rotary encoders for a small rotary table and one of the recommendations was to average the output. This reduces the ability to record high rotation speeds but for my application this is not an issue as the table will be rotated by hand.


For numbers you can simply sum the values and then divide by the number of values. This does not work for angles because the numbers reset after 360. Luckily some mathematicians have worked it out already and have a solution using trigonometry.


For this to work with the Arduino you need to use floating point numbers hence the "double" data type and also the mathematics library.


My version of the code is over at Github, all I've done is swap stdio from the C example with serial.print.


There are a couple of things still to investigate. Firstly how much memory does this simple function take up (allowing for all the math functions in the background) and how long does it take to run.


I'm planning to use the function with a fixed number of angles to average (probably 2) so will likely "unroll" the loop in the averaging function.

Reminiscent of the SNES & PS Gamepad without the casing the Esplora board features an analog joystick on the left and four pushbuttons on the right.


The Arduino EsploraArduino Esplora is a microcontroller board based on the Arduino Leonardo. The EsploraEsplora in unique to previous board from Arduino as it has built in onboard sensors for you to utilise without make additional purchases. The best thing out the Esplora Esplora is that it is designed for everyone from complete novices to seasoned veterans. Getting you first Esplora Esplora project off the ground should take minutes rather than days.....hopefully


The Esplora Esplora uses an Atmega32U4 AVR microcontroller with 16 MHz crystal oscillator, which is the same as the Leonardo board, plus a micro USB connection capable of acting as a USB client device, like a mouse or a keyboard in included.



The Arduino EsploraArduino Esplora Features?

  • Analog joystick with central push-button
  • 4 push-buttons laid out game console style.
  • Linear potentiometer slider
  • Microphone
  • Light sensor
  • Temperature sensor
  • Three-axis accelerometer
  • Buzzer can produce square-waves.
  • RGB led bright LED with Red Green and Blue elements for colour mixing.
  • 2 TinkerKit Inputs to connect the TinkerKit sensor modules with the 3-pin connectors.
  • 2 TinkerKit Outputs to connect the TinkerKit actuator modules with the 3-pin connectors.
  • TFT display connector connector for an optional colour LCD screen, SD card, or other devices that use the SPI protocol.


Technical Info

  • Microcontroller: ATmega32u4
  • Voltage: 5V
  • Flash Memory: 32KB of which 4KB is used by the bootloader
  • SRAM: 2.5K
  • Clock Speed: 16MHz




Schematics & Reference Design




Fancy trying out the Esplora for FREE in exchange for a product review - Enrol in our latest RoadTest before the 5th August


Edit: Are you based in the UK? Arduino Esplora is now available from CPC

Filter Blog

By date: By tag: