Connect with us

Raspberry Pi BB Target

Discussion in 'Microcontrollers, Programming and IoT' started by blane, Jan 5, 2016.

Scroll to continue with content
  1. blane

    blane

    2
    0
    Jan 5, 2016
    Hi Folks,

    Im new to electronics and was looking to create a little project.

    I have experience coding php, html, java etc and just got a raspberry pi for xmas.

    I had an idea to create a little bb target for use in the airlift range.

    The idea is that when the target is hat, an led will light up red then a second hit will register orange, then a third will be Green.


    After a little research i have found that some piezo elements mounted on some hard plastic should do the job. That being said i am completely new to electronics so if you could let me know what else i would need to create the target.

    Thanks in advance
     
  2. Gryd3

    Gryd3

    4,098
    875
    Jun 25, 2014
    Break it down into blocks first.

    You need:
    -The sensor.
    -Method to read the sensor. (Note... connecting piezzo element directly to Pi may damage it! piezzo elements can create very high voltages)
    -The brain. You need to monitor inputs and deal with outputs. This will be your Pi.
    (Note... when running an OS like Linux on the Pi, you loose the ability to very quickly detect changes in the pins. There are work arounds. The Pi is used for more processor intensive tasks. Microcontrollers are used for simpler tasks like this one. Both will work though!)
     
  3. blane

    blane

    2
    0
    Jan 5, 2016

    Thanks very much for the info...

    Yes i was considering an arduino but it was just down to the fact that i have a pi, that i wanted to put it to use. If arduino would be better i don't mind purchasing one.

    How would i go about avoiding direct connection to the pi for the sensor and the LEDs.

    I was hoping it would be a simple enough piece of code.

    -sensor detects vibration
    -sends signal to pi
    -pi processes the signal and outputs info to LED

    Thanks
     
  4. Gryd3

    Gryd3

    4,098
    875
    Jun 25, 2014
    The sensor you are using will produce a very sharp fast signal. The voltage is unknown, but will be relatively high, and the duration will be incredibly short. You will need to condition this first before sending to the pi or any other 'brain' you plan to use.
    From there, the code will be in a loop, or you need to setup an 'interrupt'.

    Loop will basically check over and over again for the voltage on the pin to go high... whereas an interrupt will automatically trigger something if the voltage changes.
    Then you can do something useful ;)
     
    blane likes this.
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-