Go Down

Topic: Proto Shield General Use Button (Read 134 times) previous topic - next topic

StellarJay

So I am quite new to this whole electronics building thing, I am however quite a proficient programmer. I'm working on a project that involves addressable LED light strips being controlled by an Arduino UNO R3 with effects that take the input of an Accelerometer and output to the LED strips. I am using this Proto Shield (DFROBOT Proto Shield) and I plan to make use of the general use button on there to cycle through the effect cases? My question is do I need to incorporate a pull-up resistor to that button or do I simply wire the one wire from the switch to a digital pin to be read for HIGH or LOW and change the effect based on that?

Wawa

One side of the button seems to be connected to ground, the other one to pin 11.
Don't see a pull up resistor on that board (see schematic diagram on that page).

Easiest way is to enable the internal pull up resistor in pinMode.

pinMode(buttonPin, INPUT_PULLUP);

Leo..

StellarJay

Do I even need a pull-up resistor if I'm only using the switch to cycle through the various effects in the program? Can I just do a DigitalRead on Pin 11? Sorry for being new< I know how to write programs, the physical electronics is my weakness.

groundfungus

#3
Jul 04, 2016, 02:00 am Last Edit: Jul 04, 2016, 02:02 am by groundfungus
An unconnectd input is said to be "floating".  A floating input is suseptable to noise.  The way to make the input immune to the noise is to make sure that it is always HIGH or LOW (never open).  A pullup resistor keeps the input HIGH until the botton switch is closed, then the input is pulled LOW.  So the input is never in between (open).

Wawa

#4
Jul 04, 2016, 02:14 am Last Edit: Jul 04, 2016, 02:27 am by Wawa
Yes, you do need a pull up resistor.
Without it, the pin will be "floating" if the button isn't pushed.

As said, you don't have to use a physical resistor. Just use the one that's already inside the Atmega chip.
With  pinMode(buttonPin, INPUT_PULLUP);
That line in void setup() declares the pin as an input AND enables the internal pull up resistor.
https://www.arduino.cc/en/Tutorial/DigitalPins
Leo..



raschemmel

#5
Jul 04, 2016, 02:38 am Last Edit: Jul 04, 2016, 02:55 am by raschemmel
I'm not seeing how any of you are identifying "pin  11" with respect to the shield headers which have no such pin label. The placement of the "11" label on the general use button is useless with no "11" identified any  where else.

If you look at the UNO schematic, you see that D11 , (AKA PB3, AKA ATmega328 pin 17) is pin-4 of the header it is located in. Nowhere in the DFROBOT Protoshield SCHEMATIC, is it identified as "11". (11 WHAT ?) Are they that lame that they can't put a "d" or a "D" in front of the "11" ?
That's pathetic.

Neither is MOSI (AKA J2-PIN-4) identified as "11" (whatever that means).
In short, the general use button pin SHOULD have been labeled exactly what WAWA or anyone else who knows what the hell they are doing would have labeled, to wit, J2-PIN-4. Would there THEN be ANY ambiguity ?

Arduino UNOs, Pro-Minis, ATMega328, ATtiny85, LCDs, MCP4162, keypads,<br />DS18B20s,74c922,nRF24L01, RS232, SD card, RC fixed wing, quadcopter

Wawa

True. It has to be checked/measured to what pin that button is connected to.
There is only an "11" next to the button in the diagram of the shield.
Leo..

StellarJay

Thanks for all the info, I will use my multimeter to check how it's all connected up. One more question, all of the LED strips are going to be powered via separate power supplies, do I need to connect the ground wire on all of the strips and power supplies to the Arduino and just the 5V from each supply to each strip or is it okay to just connect the ground wires to the power supplies on each strip?

CrossRoads

Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

StellarJay

Connect all grounds together.
That is what I figured, thank you.

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy