Previous Thread
Next Thread
Print Thread
Rate This Thread
Hop To
#4314757 - 11/24/16 02:19 AM STM32 Sim Panel  
Joined: Nov 2016
Posts: 8
Jak_o_Shadows Offline
Junior Member
Jak_o_Shadows  Offline
Junior Member

Joined: Nov 2016
Posts: 8
Hi. I thought I'd build myself a sim panel - not a full cockpit, I don't have the space!

Elite Dangerous is a spaceship in space game. Whilst the combat isn't overly realistic, you can enable proper newtonian physics. So you can have the full 6 Degrees of Freedom (DOF), and no dampeners on any of them.

Alas, my joystick(s) are rubbish, and cannot hold center. Wouldn't it be nice I thought to be able to trim them, like in real aircraft. Hence this project was born. I wanted a little control panel that had a few toggle switches, a few lights, a few pushbuttons, some potentiometers and slide potentiometers, and dual joysticks. Also included is a way to easily navigate menus.
So all the switches, buttons, etc that I bought are:
2 joy/thumbsticks:

1 PSP joystick. This will be used for selecting menus, etc:

16 pushbuttons:

16 light up toggle switches - 4 of each colour:

and a nice toggle switch with a cover


I chose to use the STM32F103C8T6 ARM Cortex-M3 micro-controller, as I have experience with this, and the STM32F429ZIT6 uC. This is a 32-bit micro-controller with 20Kbyte SRAM, 64Kybyte flash (in this development board), 10 12-bit ADC channels, and 2 I2C, 2 SPI, 3USART and an USB interface.

The development board I chose was the blue-pill version, seen below. This is available very cheaply (~$3) online (think eBay or Aliexpress). Whilst the micro-controller has 37 GPIOs, only 30 are available. Of these, 10 are ADC channels, 2 are I2C, 2 are SPI, and 2 are USB. Hence the effective number of GPIOs for buttons is only 14. Leaving SPI and I2C available allows the use of these protocols to connect to other sensors (e.g. accelerometers), or other micro-controllers (e.g. a port expander, wii-nunchuk/classic controller, or other detachable controller).

As the STM32F103C8T6 has a USB peripheral, all that needs to be done is to correctly configure it, and the device will show up as a joystick on the computer! (note: have to tell it to use the generic HID joystick device driver, as this is not automatically used on Windows 10. Linux is probably fine).

The UniCore-MX is a firmware library for a variety of ARM Cortex-M microcontrollers. It is a fork of the libopencm3 library. It is used in the ED Panel as I could not get a USB HID working in libopencm3.

Progress so far:
  • Device showing as a HID
  • Analgoue input working
  • Active high digital input working
  • Active low digital input working


To do:

  • Finalise button layout
  • Wire all buttons in
  • Install all buttons (and switches, joysticks, etc)
  • Create external ports (Have some 2-row DB-15 connectors)
  • Get I2C master working
  • Get I2C slave devices working (MSP430 button/digital input slave)
  • Test I2C with a Nintendo Wii Nunchuk/classic controller
  • ????


For code, please see: https://github.com/Jak-o-Shadows/simpanel

For more step-by step (well, eventually), please see http://jak-o-shadows.github.io/electronics/stm32/edpanel/edpanel.html

Inline advert (2nd and 3rd post)

#4316052 - 11/29/16 03:28 AM Re: STM32 Sim Panel [Re: Jak_o_Shadows]  
Joined: Nov 2016
Posts: 8
Jak_o_Shadows Offline
Junior Member
Jak_o_Shadows  Offline
Junior Member

Joined: Nov 2016
Posts: 8
I did a little more work. Mocking up the panel in a cardboard box for now - I was intending to use a different box, but realised that I wouldn't have enough depth.

Header pins have been soldered onto all the toggle switches.

If I want the inbuilt LED to work, they must be connected like:

Hence they are connected. The two outer lines are power (for the LEDs, and to make the switch actually work). The inner 6 are the button inputs (coming from the middle pin of the switches).

I was lazy, so just used a little breadboard power supply module to test:

and here's a gif of the lights being toggled on/off. They are much more visible in real-life, the camera flash washed them out a lot. Look at the green ones.

#4316342 - 11/30/16 05:56 AM Re: STM32 Sim Panel [Re: Jak_o_Shadows]  
Joined: Nov 2016
Posts: 8
Jak_o_Shadows Offline
Junior Member
Jak_o_Shadows  Offline
Junior Member

Joined: Nov 2016
Posts: 8
I've connected the two thumbsticks, the psp joystick, and the pushbuttons. But i've run out of female dupont connector crimp things, so have to buy some more. They'll be here in a week frown

#4322001 - 12/21/16 07:04 AM Re: STM32 Sim Panel [Re: Jak_o_Shadows]  
Joined: Nov 2016
Posts: 8
Jak_o_Shadows Offline
Junior Member
Jak_o_Shadows  Offline
Junior Member

Joined: Nov 2016
Posts: 8
Been measuring some stuff in preparation for the actual controller mounting panel:

Analog joystick on breakout board

PCB outer dimensions: 26.2mm x 34.23mm
Mounting holes: ~~3mm, 0.12"
Lengthwise hole separation: 23.2mm
Width hole separation: 17.6mm
Height from bottom of pcb to top of pot. container: 14mm
Length of attachment knob: ~6.7mm (would not be able to cover all of that, as would not be able to pivot at the bottom)
Reasonably height to top mounting panel: ~~20mm
Height solder pertrudes above(below) the base of the PCB: 4mm
Joystick is centered on the hole mounting pattern
Connecting cables are able to fit through a ~7mm diam hole EASILY
Check connecting cable plug end dimension!


PSP joystick on breakout board

PCB outer dimensions: 25.6mm x 25.8mm
Mounting holes: ~~2.8mm
Mounting hole separation: 17.75 +- 0.05
Connecting cables able to fit through a ~6mm diam hole EASILY
Check connecting cable plug end dimension!


Red-top pushbuttons

With thread diam: 11.5mm
No thread diam: 10.6mm
Height above panel (button out): ~~10.5mm
Height above panel (button depressed): ~7.2mm
Button diam: 12mm
Flare-end diam: ~~17.88mm


Lightup toggle-switch

Square bit: 16.8mm x 12.15mm
Square bit height: 9.6mm
Flange diam: 23mm
Round bit diam (below flange): 20mm
Key on round bit: 2mm wide, 1mm deep? high? extruded?
Snap-lock-in-bit-things: 4.4mm wide, bulge out 5.5mm


Guarded toggle-switch

With thread diam: 11.85 +- 0.05 ish
Guard details:
Guard plate length: 40.7mm ~= 1.6"
Guard plate width: 17.15mm ==0.675"
Guard plate hole diam: 12.12mm
Guard plate hole distance from back (not centre of hole): 21mm


LED Bar Display

10 segments
1" long
0.4" wide


Rotary Potentiometers
Threaded diam: 6.55mm
Threaded length: 6.25mm
Locking pin width: 2.6mm
Locking pin thickness: 1.1mm
Locking pin outer radius: 8.5mm
Washer thickness: 0.27mm
Washer inner diam: 7.12mm ~=0.28"
Washer outer diam: 11.52mm ~= 0.453"
Nut thickness: 1.93 mm ~= 0.075"


DB15 female

Panel size: 0.5" x 39.41mm (1.55")
Hole size: M3 will do
Hole spacing: 1.2"

#4324510 - 12/30/16 05:59 AM Re: STM32 Sim Panel [Re: Jak_o_Shadows]  
Joined: Nov 2016
Posts: 8
Jak_o_Shadows Offline
Junior Member
Jak_o_Shadows  Offline
Junior Member

Joined: Nov 2016
Posts: 8
I recieved some wire in the mail, so I've spent a little bbit of time connecting everything and programming it up.

As seen https://github.com/Jak-o-Shadows/simpanel/blob/master/code/main.c, this commit, I have 5 of the red pushbuttons connected and working, the thumbsticks entirely working (including their pushbutton), the PSP joystick working, and all but 1 of the toggle switches (I haven't overriden the default JTAG'ness of one of the pins as yet).

With the PSP joystick, I did something a little different: I made it into a hat switch, and a joystick. So a movement up is the appropriate axis value, AND a hat switch up. (Alternatively, it can pretend to be Buttons 1,2,3,4 for the cardinal directions).

The STM32 has been pretty nice to work with. Now begins the next stage - making i2c/SPI (probably i2c) slave devices to give me more buttons and more analog inputs.

#4324821 - 12/31/16 07:00 AM Re: STM32 Sim Panel [Re: Jak_o_Shadows]  
Joined: Nov 2016
Posts: 8
Jak_o_Shadows Offline
Junior Member
Jak_o_Shadows  Offline
Junior Member

Joined: Nov 2016
Posts: 8


Moderated by  RacerGT 

Quick Search
Recent Articles
Support SimHQ

If you shop on Amazon use this Amazon link to support SimHQ
.
Social


Recent Topics
Grumman Wildcat unique landing gear
by Coot. 04/17/24 03:54 PM
Peter Higgs was 94
by Rick_Rawlings. 04/17/24 12:28 AM
Whitey Herzog was 92
by F4UDash4. 04/16/24 04:41 PM
Anyone can tell me what this is?
by NoFlyBoy. 04/16/24 04:10 PM
10 Years ago MV Sewol
by wormfood. 04/15/24 08:25 PM
Pride Of Jenni race win
by NoFlyBoy. 04/15/24 12:22 AM
It's Friday: grown up humor for the weekend.
by NoFlyBoy. 04/12/24 01:41 PM
OJ Simpson Dead at 76
by bones. 04/11/24 03:02 PM
They wokefied tomb raider !!
by Blade_RJ. 04/10/24 03:09 PM
Copyright 1997-2016, SimHQ Inc. All Rights Reserved.

Powered by UBB.threads™ PHP Forum Software 7.6.0