Jump to content

FreeJoy - Joystick controller firmware for ARM STM32 boards


Recommended Posts

FreeJoy joystick controller firmware, by WG_Magners - similar to MMjoy2 and EasyJoy32One.

Hardware required: ARM STM32, example ~$2 STM32F103C876.

 

ST32-Duino-1-324x324.jpg

 

FreeJoy firmware supports following features:

 

Up to 8 analog axes (12 bit resolution - 4096 points)

Up to 128 buttons (Wired though Matrix or Shift Register)

Incremental encoders

TLE5010/5011 sensors (digital bus instead analog like potentiometer and conventioal Hall sensor)

Shift Registers 74HC165 and CD4021

Axes to buttons (12 buttons per axis)

4 POV hats

Push buttons, toggle switches, inverted buttons, etc.

 

All this options can be configured by user-friendly configurator tool - FreeJoy Configurator:

 

image-thumb-png-fae6ce523bf1636a252d3caad43bda25.png

Note: FreeJoy Configurator require MS NET Framework 4.5.1 installed.

 

Instructions on how use FreeJoy Configurator: https://github.com/vostrenkov/FreeJoyConfigurator/wiki

 

For flashing firmware to ARF STM32 device an ST-LINK v2 programmer is required (or USB-UART converter). Example.

 

Instructions how to flash firmware to the device can be found on Github wiki page. https://github.com/vostrenkov/FreeJo...ickstart-guide

 

Source code can be found on Github: https://github.com/vostrenkov/FreeJoy/wiki

 

FreeJoy firmware: https://github.com/vostrenkov/FreeJoy

FreeJoy Configurator tool: https://github.com/vostrenkov/FreeJoyConfigurator

 

Links to the latest releases:

https://github.com/vostrenkov/FreeJoy/releases

https://github.com/vostrenkov/FreeJoyConfigurator/releases

 

FreeJoy is free use under GPL3.0 license, can use it in your commercial projects for free, keeping the code open.

 

Autor: WG_Magners

===================================================================================================================

 

Topics in il2sturmovik forums:

English: https://forum.il2sturmovik.com/topic/57900-freejoy-opensource-joystick-controller-on-stm32/

Russian: https://forum.il2sturmovik.ru/topic/12818-freejoy-opensource-joystick-controller-on-stm32/


Edited by Sokol1_br
  • Like 1
Link to comment
Share on other sites

I have played around with this piece of Software since October (https://forums.eagle.ru/showpost.php?p=4065934&postcount=6) and it has come a long way since. Such great work by vostrenkov!

 

What it really needs is an external ADC like the MCP320x (because the internal ADCs are sadly not very good) and adjustable VIP/ PID. I hope the developer can add these features in the future! :)

Cougar, CH and Saitek PnP hall sensor kits + shift registers: https://forums.eagle.ru/showthread.php?t=220916

 

Shapeways store for DIY flight simming equipment and repair: https://www.shapeways.com/shops/rel4y-diy-joystick-flight-simming

Link to comment
Share on other sites

But, since ARM32 STMF103xxx ADC is 12 bits what advantage in use external MCP32x ADC, too 12 bits?

 

The only downsize is the 3.3v what limit the contacless sensor options a bit.

 

In Reddit an guy inform that some Chinese STM32Fxxx has issues for work in USB, is the model in what the reset button is round and have a metallic octogonal base.

The model with retangular plastic reset button is OK.


Edited by Sokol1_br
Link to comment
Share on other sites

No no, I know of the too high USB data pullup resistor on the blue pill boards. I have soldered a 1,8k resistor in parallel over the usb input R10 and it works no problem. Not all USB sockets will cause problems with the bad pullup anyway.

 

The nominal resolution of an ADC is not the only metric you need to look at. There is also sample rate & SNR of the ADCs. Said bluntly, the two internal ADCs are really cheap. There is so much noise, that your effective resolution will be more like 8-9 Bit.

 

If you have your axis in idle at an ideally steady voltage output, the digital read out of the ADC will still fluctuate quite a lot. Let's be optimistic and say you can't differentiate +-1 digits of your nominal value because of ADC noise. That means of your nominal 12 Bit resolution (4096 points), you can effectively only differentiate ~1365 absolute points. This means you have an effective resolution of only about 10,4 Bit. One solution is digitally averaging the input while sacrificing output sample rate.


Edited by rel4y

Cougar, CH and Saitek PnP hall sensor kits + shift registers: https://forums.eagle.ru/showthread.php?t=220916

 

Shapeways store for DIY flight simming equipment and repair: https://www.shapeways.com/shops/rel4y-diy-joystick-flight-simming

Link to comment
Share on other sites

  • 2 weeks later...
  • 3 weeks later...

The nominal resolution of an ADC is not the only metric you need to look at. There is also sample rate & SNR of the ADCs. Said bluntly, the two internal ADCs are really cheap. There is so much noise, that your effective resolution will be more like 8-9 Bit.

 

Rel4y,

 

About your ADC question: https://forum.il2sturmovik.com/topic/57900-freejoy-opensource-joystick-controller-on-stm32/?do=findComment&comment=898408

Link to comment
Share on other sites

 

First of all, I am by no means an expert on ADCs. Magners has a point in saying that mostly the bad board layout is to blame. I just checked the STM32F103 ADC specs and they look decent. The STM32f103 just like the ATmega32u4 has +-2 LSB max error and a bit higher nonlinearity error.

 

The main problem is the horrible blue pill voltage supply, the 3.3V reg is absolute crap. I will try to circumvent/ replace it. Another problem is that analog and digital supply/ ground are not seperated properly.

 

In terms of digital filtering, thats what I referred to earlier. That certainly helps, but you are sacrificing sample rate. Looking at the transients posted in the IL-2 forums, you may get away with "medium" filtering at 80 ms, but "high" at 200 ms is already too much for my taste. It results in noticable input lag.


Edited by rel4y

Cougar, CH and Saitek PnP hall sensor kits + shift registers: https://forums.eagle.ru/showthread.php?t=220916

 

Shapeways store for DIY flight simming equipment and repair: https://www.shapeways.com/shops/rel4y-diy-joystick-flight-simming

Link to comment
Share on other sites

First of all, I am by no means an expert on ADCs. Magners has a point in saying that mostly the bad board layout is to blame. I just checked the STM32F103 ADC specs and they look decent. The STM32f103 just like the ATmega32u4 has +-2 LSB max error and a bit higher nonlinearity error.

 

The main problem is the horrible blue pill voltage supply, the 3.3V reg is absolute crap. I will try to circumvent/ replace it. Another problem is that analog and digital supply/ ground are not seperated properly.

 

In terms of digital filtering, thats what I referred to earlier. That certainly helps, but you are sacrificing sample rate. Looking at the transients posted in the IL-2 forums, you may get away with "medium" filtering at 80 ms, but "high" at 200 ms is already too much for my taste. It results in noticable input lag.

 

In case of good PCB layout there is a very small chance you will need filtering level more than LOW. My observations is that HIGH level completely remove bouncing of cheap chinese potentiometers connected to bluepill board, but yes - you can feel the input lag a little. Input lag at MEDIUM level is nearly unnoticable.

Keep in mind that transient response test show you 0.2s lag for immediate fullscale change at input - in real cases it is much softer. Best advice I can give you - just try it :)

 

Now I am working at v1.3.5, it will contain 7 levels of filtration and dynamic deadband. I already implemented test version of it and it works pretty well.

I also ordered MCP320x parts from China to make comparison with internal ADCs and maybe add their support to the firmware. But shipping may take a long time for some reasons...

Link to comment
Share on other sites

  • 2 weeks later...

Release v1.4.1

Configurator

Firmware

 

Changes:

  • Added dynamic deadband
  • Added sequential buttons (several logic buttons mapped to same physical and pressed sequentially)
  • Influence of microcontroller periphery to ADC conversion reduced (especially if TLE sensors are used)
  • Improved timings for shift registers
  • More flexible filters (7 levels of filtration)
  • Angle setting for axis offset (step 15 degrees)
  • 3 PWM pins for LED lightning
  • Up to 24 LEDs mappable to logical buttons states
  • Optimization for small wide displays
  • Device name is set to config name while saving by default
  • Indication of pins/buttons config errors

This version should improve ADC results (especially if TLE sensors are used in configuration).

Dynamic deadband detects movements of axis and holds axis output if no movement is detected. Hold threshold is configurable.

3 PWM channels allow you to make configurable RGB lightning. Connection LEDs through transistors is recommended for lightning.

Link to comment
Share on other sites

  • 1 month later...

Amazing work on your latest release! Thank you for supporting several external ADCs and all these other great features! FreeJoy is now basically the new DIY community standard.

 

You rock! :thumbup:

Cougar, CH and Saitek PnP hall sensor kits + shift registers: https://forums.eagle.ru/showthread.php?t=220916

 

Shapeways store for DIY flight simming equipment and repair: https://www.shapeways.com/shops/rel4y-diy-joystick-flight-simming

Link to comment
Share on other sites

Some highlights of latest Release v1.5.1b3.

Support for external ADC, for AS5600 (programmable working angle) and MLX90333 (SPI mode) contactless sensor

 

Full list of features:

 

8 analog inputs (12 bit output resolution)

axis configuration options: calibration (manual or auto), filtering, offset, deadband (center or dynamic), curve shapes

axis to buttons function (up to 12 buttons per axis)

buttons/encoders to axis functions

128 digital inputs (buttons, toggle switches, hat povs, encoders)

digital inputs configuration options: normal/inverted button, 3 types of toggle switches, radiobutton sequential button

5 shift modificators

4 hat povs

16 incremental encoders

shift registers 74HC165 and CD4021

digital sensors TLE5010/5011, AS5600, MLX90393 (SPI interface only)

external ADCs ADS1115 and MCP3201/02/04/08

3 PWM channels for lighting

24 LEDs (single or matrix) bindable to button's states

device name and other USB settings

user-friendly configuration utility

updating firmware on USB

saving and loading configuration from file

 

Instructions are available on wiki of github page of the project:

https://github.com/FreeJoy-Team/FreeJoyConfigurator/wiki

https://github.com/vostrenkov/FreeJoy/wiki

 

Link to comment
Share on other sites

  • 1 month later...

New firmware:

 

Release v1.6.0

 

Changes:

 

HID bootloader (improved software updating algorithm)

Buttons logic completely reworked

Timer functionality for buttons (delay before pressing and press duration)

Sequential non-latching buttons

Logic buttons inversion option

Button output disabling option

Axis trimming by buttons

Axis centering by buttons (helicopter-style trimming)

Axis prescaler

Combined axes activation by button

Prescaler activation by button

"Equal" function for combined axes

Encoders as axes sources

Encoders reading resolution settings

High-resolution (fast) encoder support

Improved ADC performance

Improved shift registers stability

Configurator GUI improvements

USB-communication improvement

 

Migrating from v1.5.x without a programmer device

 

Run old configurator v1.5.x and connect your device

Using Firmware Flasher upload Bootloader.bin file from the archive to the device. It should reboot and connect as FreeJoy Flasher

Delete old configurator and install the new one (v1.6.0)

Upload new firmware FreeJoy_v1_6_0bx.bin via FreeJoy Configurator v1.6.0 as described in wiki

If you have a programmer device you can flash .hex file as usual (bootloader is already included in .hex file)

 

Firmware - https://github.com/FreeJoy-Team/FreeJoy/releases

Configurator - https://github.com/FreeJoy-Team/FreeJoyConfigurator/releases

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...