Motion-Sensor Cornhole Set with Flashing LEDs

I’d like to create a cornhole set (https://en.wikipedia.org/wiki/Cornhole) that uses a motion sensor to flash a string of LEDs surrounding the hole whenever a beanbag goes through the hole. For this, I think I need the following things (and what I think will work for each):

I’m trying to do this relatively cheaply. Does this seem reasonable? Anything I’m missing? I’m a computer programmer with some eletronics experience, but not a lot. I know how to solder :slight_smile:

The programmer you selected is not needed for the Arduino Pro Mini 328. There should already be a bootloader on it that can communicate with the Arduino IDE over a usb to serial connection to program it. Instead you should use something like this.

SparkFun FTDI Basic Breakout - 5V

Look at the Getting Started Tutorial link on the Arduino Pro Mini product page to see what you need to get going with it.

As for the ‘motion sensor’, it is just a light sensitive resistor. So if it should detect motion you better have a light source falling on it to detect the shadow of the beanbag. Daylight may be sufficient, but a led shining on it might get a better response. It depends on how you have this hole set up and it’s lighting conditions.

And as it is a resistor you need another resistor to make a voltage divider for the Arduino to measure a voltage change. On the product page of the light sensor is a video showing the setup. It is hard to tell, but judging from the numbers on the lcd I think they had a 10k resistor pulling up the light sensor to the 5 volt voltage. The light sensor has a low resistance (about 1Kohm) when light falls on it so the sensed voltage goes down to about 1/11th of 5 volt, or 1/11th of the ADC resolution of 1023 bits. Hence the value of 75 shown on the lcd, being near enough to 1023/11. I don’t see where you need other (pull-up) resistors in your project, but it can always be useful to have various resistor values as spare when experimenting.

The led string page says it should be powered with 3.3 volt, but in the video it is said a 3xAA battery pack should also work. Which comes down to around 4.5 volt. If you use that then you can also power the arduino from that (but not into the Vin pin, but directly into the Vcc pin). Although it is probably better to disconnect the led string while programming it to lessen the load on the FTDI module. The datasheet of the ledstring suggests that a current of 16 ma is flowing through it. Which an arduino pin is capable of supplying so I don’t think you need a transistor to turn it on/off. But I would rather test first how much this current really is to be sure at 4.5 volt. The datasheet with it mentioning 3/6/12/24 volt in contrast to sparkfun’s 3.3v recomendations is very confusing to me on which limits apply. That said, the Arduino should even work with 3.3 volt on the Vcc pin, so if you can get that as a battery pack then you are good to go with that.

Correction: If you want to use 3.3 volt (or there abouts) as the supply voltage hen you better use the 3.3 volt version of the Arduino pro mini. As it runs on a lower clock frequency (8 Mhz vs. 16 Mhz) which is better suited for that voltage. Similarly you would need the 3.3 volt version of the FTDI USB-to-serial interface for it.

Thanks, great advice. I ended up using the FTDI board for programming, as you suggested. I set it up the Pro Mini with male headers, so that I can easily detach the FTDI board in the final “product.”

Is there any harm in connecting a 3xAA battery pack directly to Vcc? I’ve been connecting power to the “raw” (unregulated power input) pin on the Pro Mini (seems to work).

I connected the LED string directly to pin 13 on the Pro Mini (again, as you suggested), which has a 1 kohm resistor built-in. This worked. Is there any downside to sticking with that for the long term?

I ended up using a PIR motion sensor (rather than the light-sensitive resistor) with a pull-up resistor, which seems to work decently well for detecting most things…except for the beanbag! I assume this is because the beanbag doesn’t emit IR. However, your comment about wiring up an LED on the opposite side of the hole from the sensor, so that the beanbag will “block” the LED, will probably work for the PIR motion sensor as well. If not, I’ll try something else.

Also, I got the 5V version of the pro mini anyway, since the PIR sensor I chose required 5V:

https://www.sparkfun.com/products/13285

Is the 3x AA battery (4.5V) is enough to power the pro mini properly (especially as the batteries drain)?

The 3xAA/4.5 volt is insufficient for the voltage regulator on the board to regulate properly. So there is no point in connecting it to Vin/raw. Instead it should be connected to Vcc. The microprocessor will work none the less.

As I tried to explain in my previous message, I’m not all that sure about the ledstring. It’s documentation is a bit confusing. I suggest you ask sparkfun techsupport for confirmation if it can be supplied directly from an arduino digital output pin.

For the IR led and detector I was more thinking like this:

https://www.sparkfun.com/products/241

See the tutorial video linked in there.

This device is another option as a ir-detector, but it requires that the led sends out pulses of IR light at a specific frequency (38 kHz). The presence of detected IR pulses makes the output go low. It is a bit more involved because you need to pulse the led, but it would be more reliable in outside lighting conditions. As it is better at filtering out ambient lighting changes.

https://www.sparkfun.com/products/10266

Man, I wish I’d found that IR detector before I shelled out for the PIR sensors! Oh well, I’m sure they’ll come in handy for another project.

Thanks for the help!