- 1 Overview
- 2 Hardware (Electronics)
- 3 Hardware (Enclosure)
- 4 Software
- 5 Notes
- 6 Info
A capacitive touch sensing USB device.
A 32-bit version/descendant of the Cocomake7.
A work in progress prototype to learn more about ARM dev, STM32 peripherals and compare results with the AVR and teensy based versions.
The goal is to make a versatile, affordable and playful interface device, that can be used as a creative basis for interactive (non-usb) playthings, DIY projects and electronics/interaction/game dev workshops.
- Crystal-less USB with integrated USB (fullspeed) PHY
- Capacitive touch sensing peripheral
- Cost: ~$2 on Aliexpress (Chips Store)
A test PCB with 6 touch pads lined up in a row. Easy to breakout, by cutting the PCB traces...
No USB (ESD) protection, no line termination resistors (D+/-), no filtering, optimized for simplicity, size and cost.
- 6 touchpads
- micro USB port
- debug LED
- I2C / SWD connector
Reference Value Digikey Comment Count Unit Cost SUM rawcoco:U1 STM32F042F6Px STM32F042F6P6-ND not available 1 1.48 EUR 1.48 EUR rawcoco:U2 TLV70033DDCR 296-27937-1-ND 1 0.48 EUR 0.48 EUR rawcoco:C1 100n 490-10777-1-ND 1 0.09 EUR 0.09 EUR rawcoco:C8 C9 1u 490-6423-1-ND 2 0.09 EUR 0.18 EUR rawcoco:C10 C11 1n 490-6349-1-ND 2 0.09 EUR 0.18 EUR rawcoco:D1 LED 511-1651-1-ND 1 0.41 EUR 0.41 EUR rawcoco:R1 470R CR0402-FX-4700GLFCT-ND 470 Ohm 1 0.09 EUR 0.09 EUR rawcoco:R7-R12 1k R0402-FX-1001GLFCT-ND 6 0.09 EUR 0.54 EUR rawcoco:CON1 1 1 WM17141CT-ND 1 0.91 EUR 0.91 EUR rawcoco:K1 K2 CONN_3 2 0.00 EUR 0.00 EUR rawcoco:P1 P2 CONN_4 2 0.00 EUR 0.00 EUR rawcoco:P4-P6 CONN_1 3 0.00 EUR 0.00 EUR SUM 22 4.36 €
REMARK: That price is the actual price on DigiKey for all the parts on the PCB. It is obvious, that 41 cents for an LED is way too much, so that the price can probably be lowered to about 3 Euros. The MCU is certainly the most expensive part...
Digikey BOM (MCU not included):
1,296-27937-1-ND,rawcoco:U2 1,490-10777-1-ND,rawcoco:C1 2,490-6423-1-ND ,rawcoco:C8 C9 2,490-6349-1-ND,rawcoco:C10 C11 1,511-1651-1-ND,rawcoco:D1 1,CR0402-FX-4700GLFCT-ND ,rawcoco:R1 6,CR0402-FX-1001GLFCT-ND,rawcoco:R7-R12 1,WM17141CT-ND,rawcoco:CON1
Get it at: OSHPark
SWD Pinout (topview, USB plug on the left):
Touchpad (TSC) order (topview, USB plug on the left):
Errata / Known Bugs
- tie PB8 to ground -> BOOT0
Currently used/evaluated tools and sources to get the board up and running:
- Free tools for ARM development (gcc-none-eabi toolchain, OpenOCD)
- STM32CubeMX and sample code by ST
- Code::Blocks as an IDE
More notes are collected here...
USB HID Device
Status: Mouse, Keyboard, Gamepad HID devices are working.
The generated code from STM32CubeMX was helpful. Basically only the HID report descriptors had to be modified in order to get keyboard and gamepad recognized by the OS.
This tutorial was also quite insightful: http://eleccelerator.com/tutorial-about-usb-hid-report-descriptors/
The official doc USB HID as well: http://www.usb.org/developers/hidpage/HID1_11.pdf
The HID Descriptor Tool there comes with good examples and a validator plus exporter (header file...): http://www.usb.org/developers/hidpage/
This is the current test setup to send out keyboard keys from A-F. All six keys can be pressed at once... Funny, that the Keyboard HID descriptor can store six keys at max...
Current problem: The sensitivity of the keys and fine tuning of the TSC peripheral needs to be investigated more...
Not working (yet). USB MIDI devices are more complicated to implement (USB Audio Device Class, MIDIstreaming)...
USB Serial (CDC)
Characters can be sent!
Remarks / Conclusions
The STM32's Touch Sensing Controller (TSC) peripheral can be handled without too much effort, and gives stable and fast measurements. A good explanation of the principles behind that charge transfer acquisition technique can be found in that presentation... Nicely explained. It can acquire multiple channels at the same time (not tested yet), and can be configured to run independently of the main program using interrupts. Also, pin mapping and code generation in STM32CubeMX is very useful. It should also be possible make a "device independent" library that can be used on different STM32s, that have a TSC built in...
- USB MIDI (maybe)
- Test multiplexing with 4051 to increase the number of touch channels.
- Read more about tuning the clock settings and various parameters to tune the TSC.
- Clean up code, throw unnessary things out. Make library...
- Combine USB HID and Virtual Serial Port (CDC), and try to write a boot loader that reprograms the flash over USB serial.