Introduction: Digital Design: Simple Automatic Tally Counter Using Velostat Pressure Sensor

In this Tutorial, you will learn how to make a simple automatic tally counter using pressure sensors (which we will also make)!

The tally counter will increment by one every time the pressure pads are walked through which will be displayed on a seven segment display. You can put these in your front door, supermarket, concert venue, or wherever you want to see how many people have been through!

Required Materials:

  • FPGA (For our demonstration, we will be using a Basys 3 Board. Adjust settings according to your FPGA board)
    • Seven Segment Display Integrated into board
    • Analog Pin Integrated into board
    • GND pin
    • PWR pin
  • Velostat https://www.adafruit.com/products/1361
  • Aluminum Foil or Conductive Fabric (we used aluminum foil for convenience)
  • Tape
  • Aligator Clips
  • Any resistor 1kΩ - 10kΩ
  • Breadboard

Optional:

  • Arduino (prototyping/testing the sensor)

If you want to look at what the Schematic looks like in circuit form, files provided.

Step 1: Building the Pressure Sensor

Velostat is a piezoresistive material. Piezoresistive materials have an unique characteristic which allow it to change its resistance according to amount of force that is applied. Based on this property, we can build homemade pressure sensors that will detect and register the force of a footstep.

Begin by cutting a reasonably sized piece of Velostat.

Cut two squares pieces of aluminum foil or any conductive fabric. The size of the squares needs smaller than the size of Velostat.

Take one piece of foil or conductive fiber and tape it flat to one side of the Velostat. Take the other piece of foil or fiber and tape it flat to the opposite side of the Velostat. Make sure that the aluminum foils or the fibers DO NOT touch each other, as the contact of the foils will bypass the Velostat, which would cause the sensor to stop reading the values.

With that, you have built your own homemade pressure sensor! Now, off to test it.

Step 2: Testing With Arduino (optional)

When the pressure sensor is successfully built, wire the pressure sensor to the your board. In order to wire it securely, use alligator clips. Take one end of alligator clip and clip it to one of the foil or the conductive fiber. Clip the other end to a wire that connects to the bread board. Using another alligator clip, clip one end to the other side of the foil or the fiber. The other end should also clip to a wire that connects to bread board.

Wire the Pressure Sensor, following the Diagram above. The wiring is as follows.

  • 5v to one side of the resistor
  • GND to one side of the pressure pad
  • The other side of the resistor to the other side of the pressure sensor
  • The Pressure sensor side of the resistor also has a wire going to the Sensor pin A0

The sensor program is linked. Upload the program to the Arduino and open the serial monitor to see if your pressure sensor works.

Step 3: Wiring Two Sensors

Create another Pressure Sensor using the same method as Step 3. After the sensor is successfully built, wire everything together as shown in the diagram. Test the sensors individually first. When finished, use the provided code below to test them both at the same time.

After this process, the pressure sensor component will be complete. we are done with the pressure sensor component!

Step 4: Writing the VHDL

Now here is the tricky part. We will be using VHDL to write the code for our Basys 3 Board. You should be able to use VHDL to write to your FPGA board, so look up the tutorials accordingly.

Begin by opening your IDE for VHDL and go through the setup process for your specific board.

We used Vivado to write our VHDL code.The code is provided in the files below.

Note: Half of the files are saved as txt files and the other half are saved as VHD files. The People_counter.xpr is the base file that links all the source files. Open the .xpr file and upload the VHD files through your IDE. If the VHD files are not working, copy paste the txt files into each source file that you create.

Credit:

SSEG_dec - Bryan Mealy

clk_div2 - Bryan Mealy

FSM1 and FSM 2 - FSM chapter in Digital Logic by Bryan J. Mealy & James T. Mealy

Step 5: Linking the Code

Description of the code:

FSM1: Provides the sequence that will give an enable signal to the FSM2

FSM2: A bit counter that will increment by one once it receives the signal from FSM1

SSEG: The brain of all the seven segment display and which display to use. Decodes all the bit values that the FSM's give it.

clk_div: slows the clock so that FSM2 does not increment too fast

For our project, since we used a Basys 3 board, we will have to upload our code through the basys_master file provided in the step before. The basys_master file will allow us to interface with each hardware component on the board. In Verilog or your IDE, upload the basys_master file into the constraints file.

Basys_master: https://www.digilentinc.com/Products/Detail.cfm?N... (download at the bottom of the link) or use ours with all the linked board components

If you download from the link, here is what you need to change in the file

  • uncomment the clock signal portion (lines 7-9)
  • uncomment the 7 segment display section (lines 82-107)
  • upper case the seg -> SEG for each case
  • upper case the an -> AN
  • uncomment one of the buttons ( this will only be two lines that will be uncommented)
  • Under JXADC, uncomment the first 2 pins (lines 208-213)
  • Change from JXADC[0] -> PressureA and JXADC[1] -> PressureB

Now that everything is linked in the code together, it is time to wire it to the board and test.

Step 6: Wiring the Board

This step is pretty easy. Look up Analog/Digital Pins in your FPGA Reference Manual Look up your FPGA Reference Manual looking for Analog/Digital Pins. On the Basys board, it is called a Dual Analog/Digital Pmod. Wire each of the pressure sensor analog wires to the Dual Analog/Digital pin. With that, the project is ready for testing. Upload the program file to the board.

Here is how the program works: it will have to go through the different states in sequence in order to get the board to increment by one.(?) The program works that you will have to go through the different states to get the board to increment by one. Following the pins, designate the JXADC:J3 pin as pressureA and JXADC:L3 as pressureB

ST0: No pressure pad is pressed

ST1: PressureA is pressed while PressureB is NOT

ST2: PressureA and PressureB are pressed

ST3: PressureB is pressed and Pressure A is NOT pressed

When you follow the states, at ST3, the bit counter should increment by one
Congrats!

You have built a Automatic Tally Counter with pressure pads!

Note: Attaching two more wires to going back to the Arduino helps you know which pressure pad is being pressed.

Comments

author
DIY Hacks and How Tos (author)2015-12-08

Awesome Arduino project. You should enter this is the Tech Contest that is currently running.

About This Instructable

1,445views

3favorites

License:

More by BenjaminY3:Digital Design: Simple Automatic Tally Counter Using Velostat Pressure Sensor
Add instructable to: