Uncategorized

smart pegboard

Sensor to distinguish between different types of pegs on a pegboard

Ask QuestionAsked todayActive todayViewed 399 times4

I have a project that is essentially a pegboard with 4 different types of pegs. Each peg fits into every hole, but when one is inserted, I’d like to digitally record its type and position. There are a total of 120 pegs, 30 of each type. The board itself is a square grid, with at most 40mm between holes. The size and design of the pegs and holes hasn’t been decided yet.

The simplest and cheapest idea I could come up with was a switch at the bottom of every hole and a separate input method to declare the type: eg. 4 buttons somewhere on the side, which you could push afterwards to tell the system that type A was just inserted. This has a large effect on the user interface, one I’d like to avoid.

I could design the hole to be asymmetrical, wire 4 switches to the bottom and have each peg have 4 prongs with one being longer than the others. That would mean soldering a lot of very tiny things together and a more delicate final product, though.

Cost is also an issue, as it’s a hobby project.

Is there some sort of sensor I could use for this?sensorshareedit  follow  flag asked 18 hours agoCelos14922 bronze badges New contributor

  • One suggestion is the following: (1) “Load” the 4 types of peg with different weights, eg, Type 1 peg = 10 grams, Type 2 = 20 grams, (2) buy 102 cheapy weight sensors (US$5 for 5 pieces): aliexpress.com/i/32669458593.html, (3) put each sensor at the bottom of the hole, and connect it with a fixed value resistor to form a voltage divider. (4) Now when a peg is inserted, the weight changes resistance of the weight sensor and therefore the voltage of the voltage divider, (5) Arduino ADC pins can be used to measure the voltage and therefore know which type of peg is inserted. – tlfong01 17 hours ago    
  • PS, we don’t need 120 Arduino ADC pins to measure 120 voltage signals. Usually we EE guys use a matrix keypad like to “scan” the keys to tell which key is pressed. Eg 12 x 12 I/O lines can scan 144 binary keys. But of course “weighted” analog keys/pegs might make my suggested design very complicated. But to us EE engineers, nothing is impossible. Instead of matrix scanning, we can also consider demux analog selectors connected to cheapy 8 channel MCP3008 ADC modules. Just brainstorming, cheers. – tlfong01 17 hours ago   
  • 2Analog synthesisers did this in the early 1970s … possibly inheriting their plugboards from ENIAC-era computers. Look for “plugboards” and if you cat’t find any, just buy a thousand jack sockets and make your own. Fit one of 4 different resistor values in each plug. – Brian Drummond 13 hours ago

add a comment

7 Answers

ActiveOldestVotes11

Use a multi-pole jack plug.

enter image description here

Figure 1. Random 4-pole, 3.5 mm jack plugs from Wish.com.

schematic

simulate this circuit – Schematic created using CircuitLab

Figure 2. Plugs can be encoded by shorting out the tip, ring 1, ring 2 to sleeve pins in a binary code pattern.

You can’t use code 0 as this will be the same as no plug inserted. That leaves you with seven possibilities and you only need four. Colour-coding the plugs to indicate their numerical value seems a good idea to me.shareedit  follow  flag answered 17 hours agoTransistor124k99 gold badges125125 silver badges280280 bronze badges

  • 1Alternatively, use sockets with break contacts. This would allow you to detect when a plug is inserted, independently of its binary code. Then TRS plugs could be used to give a 2-bit code. It may come down to what is the cheapest option, given the number of plugs and sockets needed. – Simon B 16 hours ago
  • 3Or use a mono one with different resistors… – Chris Stratton 4 hours ago
  • 1I had considered that but that means a load of ADC work. This solution is purely digital. – Transistor 4 hours ago
  • 1Finding enough ADC inputs for one side of a matrix isn’t hard, and they don’t have to be good ADCs, just able to distinguish 0/1K/10K/100K… capacitor RC time constant could work. – Chris Stratton 4 hours ago 
  • 1@ChrisStratton Or just some comparators. – DKNguyen 3 hours ago

add a comment7

Use a two-contact plug like a 3.5mm mono TR (tip-ring). Connect different resistor values between the tip and ring in each plug, and set up voltage dividers in the pegboard monitored connected to an MCU’s ADC pin.

With fixed 10K resistors in the dividers, and 0 ohm, 5.1K ohm, 15K ohm, and 91K ohm options in the plugs, you’d get roughly 0.0, 0.3, 0.6, or 0.9 of the reference voltage at the ADC pin, which should be easy for the MCU to distinguish.

This doesn’t require any particular orientation of the plug, unlike mechanical and optical solutions. You can use off-the-shelf plugs and jacks. The biggest challenge is designing the multiplexing circuit to allow all the jacks to be scanned from a single controller.shareedit  follow  flagedited 1 hour agoanswered 5 hours agoRussell Borogove76711 gold badge55 silver badges1414 bronze badgesadd a comment3

I expect the cheapest option is to point mobile phone you already own at the board and use coloured pegs along with writing some image processing software.

And as the phone is a “sensor”, I think this solution keeps to the spec.shareedit  follow  flag answered 5 hours agoIan Ringrose24011 silver badge88 bronze badgesadd a comment2

There are a total of 120 pegs, 30 of each type

That means there are four different peg designs so think of them like a key that goes in a lock and design the 4 different pegs to have 4 different physical profiles just like a door key but simpler.

You might use transparent coloured pegs and use light to determine the peg’s colour. So each hole would need a white LED emitter and an RGB photodiode circuit. Or you might decide to make the peg grooved; one groove is the fattest and is used to force the user to place the peg in the correct orientation (the reference angle). It would have another groove that could push on a microswitch. This second groove’s position would be different for each peg design.

Or you could have notches arranged as a two-bit number (representing 4 values) and use light detectors to read the 2-bit binary value of the peg.

Just a few thoughts.shareedit  follow  flag answered 18 hours agoAndy aka304k1717 gold badges236236 silver badges536536 bronze badgesadd a comment1

It would take some serious engineering, but I bet you could do some sort of matrix scheme where each of the X and Y wires had a few turns coil wound around each peg socket, and the pegs had a core made of ferrite of different permitivity.

It wouldn’t be too hard with a dedicated circuit per hole, the challenge would be making it work as a matrix. Possibly you could do something with a distinct circuit for the AC inductance measurement capacitor coupled to each cell, and then have the matrix drive diode switches to cut off all but one cell at a time?

Or build effectively magnetic core memory, but make the pegs be of different coercivity and test to see how hard you have to drive them to get them to flip.shareedit  follow  flag answered 4 hours agoChris Stratton28.6k33 gold badges3333 silver badges7979 bronze badges

add a comment1

Make the 4 kinds of pegs out of different colors of clear plastic, say red, green, blue, and yellow.

At the bottom of each hole, mount a white LED that shines through the peg (or empty space) and frost the other side so that the light diffuses through the case.

Sprinkle a few red, green, and blue sensors around inside the case.

Have an arduino rapidly light each hole in turn using row/column addressing, and use an A/D on the sensors to determine what color of peg the light is shining through.

This way, the only thing you have to do 120 times is cut a rod to make a peg, and the soldering is not so bad using row/column addressing. Just make sure you put the resistors on the row or column lines so you don’t need a separate one per LED.

You may need a demultiplexer if you don’t have enough individual pins for the rows and columns.shareedit  follow  flag answered 4 hours agoMatt Timmermans54222 silver badges55 bronze badgesadd a comment1

One suggestion is the following, using the smart pegboard below as an example illustration:

smart pegboard

(1) “Load” the 4 types of peg with different weights, eg, Type 1 peg = 10 grams, Type 2 = 20 grams,

(2) Buy 102 cheapy weight sensors (US$5 for 5 pieces, see Appendix A below for more details),

pressure sensor

(3) Put each sensor at the bottom of the hole, and connect it with a fixed value resistor to form a voltage divider.

(4) Now when a peg is inserted, the weight changes resistance of the weight sensor and therefore the voltage of the voltage divider,

(5) Arduino ADC pins can be used to measure the voltage and therefore know which type of peg is inserted.

(6) To determine the position of the peg, there are many method, as briefly described below:

(6.1) Matrix keypad with keys pressed or released

The common method is to use 12 x 12 GPIO pins wired as a matrix. As soon as a key is pressed, Arduino will be notified. Arduino will “scan” the keys row by row, and if the row with a key pressed, Arduino will then scan the keys.

(6.2) Matrix keypad with keys pressed with different pressure levels

The approach is similar to the digital on/off keypad above. But now the Arduino uses its ADC (Analog to Digital Conversion) pins to measure the pressure level of the keys.

(7) Combinations of matrix keypad and multiplexed ADC devices

Since Arduino or Raspberry do not have enough GPIO/ADC pins to go around, we can use 16 channel GPIO expanders. Two MCP23017 can make a 16 x 16 matrix and so can scan up to 256 keys.

Arduino’s ADC pin is only 8 bit resolution. If using 10/12/16/24 bit resolution ADCs (evan a 10 bit ADC can detect 2^10 = 1024 values or 0.1%), it is easy to differentiate among pegs with as little as less than 1 gram difference. So if 120 pegs have unique weights differ by small quantity not noticeable by humans, Arduino can actually tell which one of the 120 holes/pegs is inserted (but of course in this case it is which hole, not which peg we need to know.

(8) Combination of ADC and Analog multiplexors.

Popular but cheap 10/12/16 bit ADCs such as MCP3008, MCP3208, ADS1115 has 8 channels. There are also unidirectional/bidirectional analog multiplexors to make the matrix wiring much simplified


References

(1) High Accuracy Resistive Weighing/Pressure Sensor – US$3.15 (5 pieces)

(2) A Futuristic Pegboard, Turns Boring Rehab Into a Game – Rapael,2018jan17

(3) Smart Pegboard Video – Rapael,2018jan17

(4) A peg board with 24 colorful cylinder pegs and removable inner pegs helps children with perceptual motor development and finger dexterity.

(5) Haljia 5Pcs BX120-3AA High Precision Resistance Strain Gage Strain Gauge GAGE Full Bridge Used for Pressure Weighing Sensor


Appendices

Appendix A – Pressor Sensor Spec

HALJIA 5Pcs BX120-3AA High Precision Resistance Strain Gage Strain Gauge GAGE Full Bridge Used for Pressure Weighing Sensor

pressure sensor

Price: £6.99 (£1.40 / Item)

Made of constantan foil, fully enclosed structure.

Temperature self-compensation and creep self-compensation can be realized simultaneously.

The strain gauge is attached to the measured object to make it expand with the strain of the measured object, so that the metal foil inside the strain gauge can extend or shorten with the strain.

The resistance of many metals changes when they are mechanically elongated or shortened. The strain gauge is used to measure the strain by measuring the change of resistance.

In general, the sensitive grid of strain gauge is made of copper-chromium alloy, whose resistance variation rate is constant and proportional to strain.

Specifications for this item Brand Name HALJIA Item Weight 5.00 grams

Feature:

Made of constantan foil, fully enclosed structure.

Temperature self-compensation and creep self-compensation can be realized simultaneously.

The strain gauge is attached to the measured object to make it expand with the strain of the measured object, so that the metal foil inside the strain gauge can extend or shorten with the strain.

The resistance of many metals changes when they are mechanically elongated or shortened. The strain gauge is used to measure the strain by measuring the change of resistance. In general, the sensitive grid of strain gauge is made of copper-chromium alloy, whose resistance variation rate is constant and proportional to strain.

Resistance Value(R): 1002±0.1

Sensitivity Coefficient: 2.0±1%

Base Dimension: 7.3mm x 4mm x 1mm

Wire Grid Dimension: 3*3.1mm

Room Temperature Strain Limit: 20000um/m

Room Temperature Insulation Resistance: 10000MΩ

Backing Material: Modified Phenolic


shareeditdeleteflagedited 32 mins agoanswered 1 hour agotlfong0185044 silver badges77 bronze badgesadd a comment

Categories: Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.