Main Restorations Software Audio/Jukebox/MP3 Everything Else Buy/Sell/Trade
Project Announcements Monitor/Video GroovyMAME Merit/JVL Touchscreen Meet Up Retail Vendors
Driving & Racing Woodworking Software Support Forums Consoles Project Arcade Reviews
Automated Projects Artwork Frontend Support Forums Pinball Forum Discussion Old Boards
Raspberry Pi & Dev Board controls.dat Linux Miscellaneous Arcade Wiki Discussion Old Archives
Lightguns Arcade1Up Try the site in https mode Site News

Unread posts | New Replies | Recent posts | Rules | Chatroom | Wiki | File Repository | RSS | Submit news

  

Author Topic: Using a piezo sensor with IPAC Keyboard encoder.  (Read 1176 times)

0 Members and 1 Guest are viewing this topic.

mrmalarkey

  • Trade Count: (0)
  • Jr. Member
  • **
  • Offline Offline
  • Posts: 1
  • Last login:June 04, 2020, 04:30:20 am
  • I want to build my own arcade controls!
Using a piezo sensor with IPAC Keyboard encoder.
« on: June 04, 2020, 04:24:50 am »
Hi there,

Just wondering if it is possible to use a piezo sensor with a keyboard encoder, and if so, whether I would have to do anything special to make it work?

Kind regards,

Mr Malarkey
« Last Edit: June 04, 2020, 04:26:57 am by mrmalarkey »

PL1

  • Global Moderator
  • Trade Count: (+1)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 9673
  • Last login:Today at 06:24:45 pm
  • Designated spam hunter
Re: Using a piezo sensor with IPAC Keyboard encoder.
« Reply #1 on: June 04, 2020, 07:05:37 am »
Just wondering if it is possible to use a piezo sensor with a keyboard encoder, and if so, whether I would have to do anything special to make it work?
It won't work directly with an "active low" (ground applied to input triggers the output) keyboard encoder.
- AFAIK a piezo sensor at rest with no load will generate no voltage which is the opposite of what you need.   :banghead:

The video on this Sparkfun Piezo sensor page shows it controlling an LED connected to an Arduino.
- The LED output is triggered by knocking or tapping on the sensor.



The code for that Knock sketch uses the "analogRead()" command so you'll need an Arduino with analog inputs like the Pro Micro.

There's info about how to adjust the sensitivity from 4:35-6:02 in this video.



You might be able to make the Knock sketch invert the LED state by changing line 33 from . . .
Code: [Select]
int ledState = LOW;         // variable used to store the last LED status, to toggle the light. . . to . . .
Code: [Select]
int ledState = HIGH;         // variable used to store the last LED status, to toggle the light
That change should make the LED stay on until you knock or press the sensor.

If that works, hook the Arduino LED output to your active low keyboard encoder input.
- LED on (logic high) = same as button not pressed.
- LED off (logic low) = same as button pressed.

There may be a better way, but this should get you started.   :cheers:


Scott
« Last Edit: June 04, 2020, 07:12:27 am by PL1 »