This is an Arduino-based personality tester that magically senses your current mood/personality trait and highlights it on an LED-lit back panel. The tester uses a Russian IV-9 numitron tube to count down during the sensing period and a set of LEDs to 'light up' your personality trait. This was my first build with an Arduino; I designed this project so I could learn how to use shift registers and numitrons, and to practice soldering on perf board.

I wanted to make something kinda vintage looking, like a small version of an old arcade love tester. I can imagine lots of different implementations; perhaps a chalkboard or whiteboard background so that you can write different things into the different winning numbers, or a classic love tester, or if you are a teacher like me perhaps make it into a device to assign grades to the students in your class ;-) ...

When I build a new one of these I will make a few changes. Perhaps most significantly, I will swap out the gold leaf covered wooden disk that covers the force sensor. Instead, I will acquire a large coin of some sort or perhaps a wooden nickel from an old arcade and use that as the sensor pad.

This is my first Instructable, and is intended for Arduino newbies like myself who have worked through the lessons in a beginner kit but haven't built a 'real' project yet (and who don't really know coding yet). It is verbose on purpose in some sections where I needed help in case you are stuck there too.

Step 1: How It Works

A person places two fingers on the golden sensor pad. They then press the start button and leave their fingers on the pad during the countdown. The numitron counts from 9 to 0 and the LEDs on the back board also count down. The personality tester "magically" senses your personality (or anything else you design it to sense) by measuring the force of your fingers on the sensor pad and converting the pressure into a reading. The reading is assigned to one of the numbers, and that number lights up on the numitron and the corresponding LED lights up.

The logic is pretty simple (and good for a beginner like me). The logic is this:

  • start button pressed?
    • NO - run the led lights in a fun pattern while you wait
    • YES
      • start the numitron countdown and start logging the pressure on the sensor pad
      • during the countdown, keep a running average the sensor readings
      • assign the final average pressure to a number from 1-9
      • light up that number on the numitron and light up the corresponding LED on the back panel
      • after a couple seconds, go back to the 'wait for the button to be pressed' state

Step 2: Assemble the Parts

For this build you will need:

  • An Arduino or similar, I used an Adafruit Pro Trinket 5v
  • 2 shift registers, I used TI TLC5916s that I bought from Digikey
  • 1 numitron or a seven-segment display. I bought my numitron from tubes-store.com
  • 1 force-sensitive resistor. I used an Adafruit #1075
  • 1 perf board
  • an abundance of different color wire (I used a combo of solid and stranded wire)
  • 14 LEDs of various colors (I incorporated some 2-wire color-changing LEDs)
  • 1 on-off switch and one momentary contact switch (I got both mine from allelectronics.com)
  • a cigar box
  • a backing board for you to write your personality traits on. I used a thin piece of scrap plywood I had lying around

Tools you will need include a soldering station and some basic woodworking tools (drill, router, sandpaper, etc) and maybe some glue and a few screws to hold things together.

Step 3: A Little About Shift Registers

I didn't really know anything about shift registers until I watched this great short video. click for Sparkfun's video about shift registers They are pretty cool! I used Texas Instruments TLC5916 shift registers because I read somewhere online that they were designed specifically to control LEDs and that they were 'common anode' constant current drivers that would save me some resisters (one resister sets the whole lot of LEDs rather than needing resisters for each LED). In the end I am not sure it matters much to my tiny project, but I wanted to be sure that I wasn't stressing the shift driver when I turned on all the filaments of the numitron. I did need to use shift registers though, because the TrinketPro board does not have enough pins to control everything, and using shift registers solves that problem.

Anyway, for this project, all the LEDs connected to the shift registers are connected with their shorter wires (cathode) connected to the shift register and their longer wires (anodes) connected right to the 5v power. They only turn on when the shift register 'sinks' them to ground. This is different from (opposite to) other shift registers such as the very popular 74HC595 that comes in most starter kits.

The numitron is wired to the shift register the same way, and that is explained in the next step.

Step 4: Numitrons!

Numitrons are old-fashioned 7-segment displays commonly used in Russia until the late 1980's. They have 8 tiny light bulb filaments arranged so that when you light some of them up you can make numbers (you get all the numbers 0-9 plus a decimal). Numitrons are cool because they look nifty and kinda retro, and they are relatively inexpensive. I like Nixie tubes too, but those are much more money and require high voltages. I bought some numitrons from an on-line vendor located in Russia and a couple weeks later they arrived in the mail.

The basic wiring of a numitron is the same as for a 7-segment display; they are essentially interchangeable. You need to use a resister to make sure you don't put too much voltage into the numitron filament (it likes about 4v). In the graphic above, the left side shows the arrangement of the filaments along with the A-B-C codes commonly used for 7-segment displays and also the number of the wire that lights up each filament. The middle is a diagram of the wires sticking out of the bottom of the numitron, and the right side of the graphic describes what filaments you need to light up in order to make a specific number. For example, to make the number 4, you need to send power to filaments 3,4,6 and 7. In that diagram DP stands for the decimal point.

When wiring these to the shift register, the common wire (wire 1) gets the 5v and the other wires connect into the shift register (and will be 'sunk' to ground when they need to be turned on).

Step 5: Basic Wiring

I will make a better wiring diagram (I promise). Here is a description for wiring up the personality tester. I used an Adafruit trinket but you could use most any Arduino interchangeably.

The shift registers and TrinketPro interface with 3 wires plus ground and supply voltage

  • trinket pin 8 is the latch pin and connects to pin 2 of the 1st shift register
  • trinket pin 12 is the clock pin and connects to pin 3 of both shift registers
  • trinket pin 11 is the data pin and it connects to pin 4 of both shift registers
  • pin 14 of shift register 1 is connected to pin 2 of the second shift register (this is how the 'talk')

The remainder of the pins on the shift registers are:

  • pin 1 to ground
  • pin 5-12 to either the LEDs or the filaments of the numitron
  • pin 13 to ground
  • pin 14 of the 1st shift register connects to pin 2 of the second shift register
  • pin 15 connects with a 1kohm resister to ground
  • pin 16 gets supply voltage (5v)

There are 4 LEDs on the box that are not controlled via shift registers. One connects to TrinketPro via pin 3 and one via pin 4, and two (in parallel) connect to pin 5. They are used to indicate that the system is "measuring" (pin 3), "wait" (pin 4) or "ready" (pin 5). Pin 5 gets two LEDs because on is on the box as an indicator and one is underneath the numitron for ambiance.

The momentary contact switch (start button) has two leads. One (it doesn't matter which one) connects to pin 6 of the TrinketPro and the other connects to 5v voltage. The lead to the TrinketPro also has a separate lead to ground using a 1kohm resister.

The pressure sensor also has two leads and connects the same way; one lead goes to analog pin a0 of the TrinketPro and has a separate wire via a 1kohm resister to ground. The other lead connects to 5v power.

I placed the on-off switch between the battery power (red wire) and the TrinketPro.

Step 6: Arduino Code: Sequences

The Arduino code that you can download here is set up for an Adafruit TrinketPro 5v. You can use any Arduino microcontroller, I picked the Adafruit one because it is small and inexpensive. I tried to annotate the code so that a beginner like me could see what the different lines of code do. Here are some highlights for a complete newbie:

Sequences: The numitron and LEDs are controlled by sequences sent to the shift registers. There are 9 LEDs and 7 numitron filaments = 16 things to light up. Shift register 1 handles 8 of the LEDs. Shift register 2 handles the last LED and the numitron. The bits are loaded into the shift registers in 2 sets of 8 (one set for each shift register) and then the 16 bits of information are sent to the LEDs and the numitron.

The 1st byte sequence goes to the 2nd shift register which is the numitron. Actually, it enters the first shift register but then gets 'displaced' to the second one when the 2nd set of 8 bytes comes in.

Suppose you want to light all 9 LEDs and the number 9 on the numitron. In this case, all the bytes in the first shift register need to be 'on' and all of them in the second one need to be on except for the last one (refer back to the wiring diagram of the numitron if this is confusing to you). Thus, we need two sets of 8 bits, which we can represent like this:

B11111111 and B11111110 (where the B11111110 gets sent out first but ends up in the 2nd shift register)

The statement above should light up almost everything and is the most taxing thing we are asking the system to do - at ~20 milliamps per LED or filament, we are asking the microcontroller to output 15x20=300 milliamps. Not much, but that is 2x what the TrinketPro is rated for. So, my code stresses the microcontroller board for 600 milliseconds; it works just fine, but perhaps it will burn itself out faster than normal, I don't know yet.

To light up 8 LEDs and the number 8 on the numitron we do this:

B1111111 and B01111111

because we want the first 8 LEDs on but not the 9th one (which is represented by the 0 that comes after the second B above). The rest of the sequence is like this:

7: B01111111 and B00001110

6: B00111111 and B11111100

5: B00011111 and B01111100

4: B00001111 and B00110110

3: B00000111 and B01101110

2: B00000011 and B11101010

1: B00000001 and B00000110

0: B00000000 and B11011110

Check the code to see the above stuff as adruino code. I broke it into two separate sequences. There are a total of 4 sequences in the code; two that are used during the 'wait for the button to be pushed' time, and 2 that are used to count down from 9 to 0 during measurement time. By the way, there are other ways to code this, I just don't know them yet.

Step 7: Arduino Code: Averaging the Pressure Sensor Data

The next piece of code I'd like to explain is how we capture the pressure sensor readings and convert them to 1-9 values. This code is modified from the Arduino Smoothing tutorial that you can read directly.

Up in the beginning of the code (which hopefully you downloaded in the last step and are looking at in the Arduino IDE), there are some lines defining things we need to keep track of for our simple math. They include:

  • const int numReadings = 10; //there will be 10 readings of the pressure sensor
  • int readings[numReadings]; // the readings from the analog input will be stored here
  • int index = 0; // the index of the current reading
  • int total = 0; // the running total of the sensor readings
  • int average = 0; // the average of the sensor readings
  • int inputPin = A0; // this is the fsr sensor on analog pin A0

The code that takes the pressure sensor readings and stores and averages them has be be mixed in with some code that will make the numitron count down from 9 to 0 and make the LEDs turn off one at a time. That is the code in the image above. I tried to annotate it well, line-by-line. Basically, the microcontroller is holding 10 readings in an array and it subtracts the oldest reading and then adds a new one in. Then it averages all 10 readings and stores that number in a place called 'average'. This is important because we need that number to assign a value from 1-9. It does this once then moves on to the next part of the code.

The next part of the code sends sequences 1 and 2 to the two shift registers. The numitron counts down and the LEDs light up and then distinguish themselves one at a time (see previous step about sequences). After sending out one part of the sequence, it waits some amount of time (I set it to 600 milliseconds) then does it over again - meaning it subtracts the oldest pressure value, grabs a new one, calculates a new average and displays the next part of the sequence. It does this 10 times and then exists this part of the program because it was told to do it 10 times using this line of code up at the beginning of this section:

for (int n = 0; n < 10; n++)

If this is confusing to you, as it was to me at first, just recognize that the for statement above has a { after it that starts the little loop and then there is a } at the end of the loop and the loop contains both the pressure sensor stuff and the numitron countdown stuff.

Step 8: Arduino Code: Assign the Pressure to a Value From 1-9

This part of the code is nifty because you can set your personality tester to be sensitive over whatever range works best for you. It uses nested 'if' statements and works like this:

  • Was the average pressure < 100?
    • Yes (probably nobody was touching the pad), assign these pressure readings to the number 1 and light up LED #1 and display a #1 on the numitron.
    • No? Therefore the value was above 100.
      • Was the pressure value <400?
        • Yes! Then assign #2 and light up the appropriate LED and a 2 on the numitron
        • No, then move on...
          • Was the value < 550?
            • Okay! Assign that to be #3 and light up appropriately...
            • No! They must be pressing hard on the pad... move on...
              • Etc... up to the number 9.

After doing this, the code pauses for 5 seconds and then the code is finished and it starts over at the "Was the button pressed?" stage.

You can change the pressure values so that certain numbers are harder or easier to get. My code is optimized for giving lots of 2s and 9s because I thought that was fun for my selection of personality traits, but you can make it as sensitive as you want.

That's all there is to the code. Being my first build, it took a bunch of trial and error to get the code working, but that was fun for me and if you build something like this hopefully it will be fun for you too.

Step 9: Test It All on Your Breadboard

I wired up one complete setup on a breadboard and tested the code continually as I developed the personality tester. I highly recommend you do the same - the breadboard makes testing everything so much easier. Since I had enough parts to make more than one of these, I kept the bread board version intact while I soldered up the final version. If you can do this, it is nice because it gives you a physical reference to check things against before you solder components together.

Step 10: Solder Together the Electrical Components to Your Perf Board

Since I always had the breadboard version to look at whilst soldering up the perf board, I kinda had it easy. My advice here is go slow, check twice before soldering, and acquire some desoldering wire just in case.

You can read some awesome soldering tutorials are here.

Since my LEDs and numitrons were going to have long wire leads, I went ahead and ordered some inexpensive connectors like these things linked here:

Amazon link to some red 2-wire connectors

5-wire things that are nice cause they can be soldered right to the perf board and because 2 of them can wire up 8 LEDs (with the common anode being the 9th wire)

When I soldered to the numitron I then coated the bare wires with liquid electrical tape so that they wouldn't short against themselves once I placed them in the cigar box.

Step 11: Building the Cigar Box Display

Since I like woodworking, this part wasn't daunting to me. If it is to you, then don't worry - there are tons of tutorials here on Instructables about basic woodworking, and if you get stuck just ask a question in the comments and I will try to answer.

Cigar boxes are pretty easily available but if you can't find one locally you can get them online at vendors like Cigars International. I buy them in sets of 10 because they are so useful and fun to have around.

I selected a box and planned a layout. I had some old handles from kitchen cabinets that I decided to use in this project, and I planned where the sensor pad and buttons would be. I sketched that out in my project notebook and measured on the box for where to drill holes. I test fit everything several times and then shellaced the box. I like spray shellac - it is easy, natural, smells nice and adds a nice finish to the cigar box.

For the senor pad, I used two different sized key hole saws to cut the box and then cut a circle from scrap that would fit nicely into the hole. I then used some gold leafing that I had laying around and covered the circle pad with gold. Then I shellaced it with many coats. When I make a new one of these, I will do it differently, and will acquire a large coin or perhaps a token from an arcade.

To hold the numitron up a bit, I took a piece of scrap wood and cut it into a curved shape on a band saw. I sanded it, drilled a hole for the numitron wires, used a countersink to slightly bevel the top of the hole so that the numitron fit into it nicely, and then shellaced it.

Step 12: The Backing Board

I decided on the backing board material (a piece of thin scrap plywood) and cut it into a tombstone-type
shape using a band saw. You could keep it rectangular if you wanted. The backing board slides into the cigar box via a hole I sliced in the box using a Dremel with mini saw attachment. I routed the back of the board, slotted the already-soldered and tested LED light string into place, and sealed up the back using a piece of cardstock and some Elmers spray glue.

For the front, I came up with a couple of designs you can download, but really you ought make your own fun things for the sensor to land on. I printed the text using an inkjet printer and cut my text out using a sharp scissors. I test-fitted them and then set them in place using spray glue. Then I coated the front with several coats of spray shellac.

Once it was ready, I threaded the wires through the slot in the box and then placed the backing board into the slot. In one spot I had to enlarge the slot to accompany both the wires and the plywood.

Step 13: Holding the Sensor Pad in Place

I wanted the sensor not to have too much pressure on it already before someone presses on it during 'game play'. To achieve this I loosely sandwiched the sensor in between a square piece of scrap plywood and the box, and held the box and plywood together using 4 screws. The sensor itself is not screwed in place. It stays in place because there is a piece of double-sided tape holding it and the gold-leafed pad together. It works pretty well and would be easy enough to take apart in case I want a different sensor (conductance maybe?).

Step 14: Step 7: Assembly of the Electronics With the Box

My advice here is to keep fitting and testing as you go along with the assembly. I placed the perf board with all the soldered electronics in the box, wired everything up and tested it and it didn't work - a couple wires were mis-connected and a couple others shorted out. A little bit of electrical tape later everything was up and running.

Step 15: Step 8: Enjoy the Finished Product!

Well, if you are like me you will get bored with the personality tester once it is finished, but my kids and friends liked it a lot. They spent considerable time trying to get the sensor to tell them the personality trait that they seemed to want, and many people used it over and over. It is a nice novelty item to have in the house and I am happy with how it turned out.

<p>awesome project,i don't have trinket pro,may i use ardino pro mini or ardino micro instead?</p>
<p>Yes, any Arduino-like microcontroller will work.</p>
<p>Wow! This looks like a really fun project. Thanks for sharing your build with us!</p>

About This Instructable




Bio: I like to tinker around with small electronics projects and with woodworking projects.
More by rickkeil:Cigar Box Fiddle / Violin Upcycled Hanging RGB LED Solar Yard Lights Cigar Box mini dresser jewelry box thingie 
Add instructable to: