Wave Shield + RGB LCD + Switches
Moderators: adafruit_support_bill, adafruit

Wave Shield + RGB LCD + Switches

by chickenparm42 on Sat Jan 26, 2013 7:36 pm

OK, so I have a wave shield, a 20x4 RGB+ LCD, and 6 toggle switches. I can't seem to figure out how to wire this all up to my Arduino Uno.

I did get the LCD and wave shield working separately.

I need the Arduino to know which toggle switches are on and which are off (obviously). I also want the backlight color to be controlled by the Arduino.

Thanks!

Edit: 5 of the 6 toggle switches are illuminated (LED) (Product page), and I might want a little LED next to the 6th one to indicate if it is on or off. And I think my problem really lies with a lack of pins.
chickenparm42
 
Posts: 11
Joined: Sat Jan 26, 2013 7:31 pm

Re: Wave Shield + RGB LCD + Switches

by adafruit_support_bill on Sun Jan 27, 2013 8:05 am

What you need is one of these: https://www.adafruit.com/products/715
It is designed for a 16x2, but it will drive the 20x4 display also. The 20x4 will hang over the on-board pushbuttons, but you can leave those off the board and run wires from the pads to your toggle switches.

The best part is that the whole thing will connect to your Arduino via I2C using just 2 pins (Analog 4 & 5). It is designed to be a shield, but many people leave off the headers and just run wires.
User avatar
adafruit_support_bill
 
Posts: 30820
Joined: Sat Feb 07, 2009 10:11 am

Re: Wave Shield + RGB LCD + Switches

by chickenparm42 on Sun Jan 27, 2013 9:32 am

Ok, thanks! Just to clarify, I would use this board to drive the lcd (including color control) and 5 of my toggle switches, and just hook the 6th switch up normally?
chickenparm42
 
Posts: 11
Joined: Sat Jan 26, 2013 7:31 pm

Re: Wave Shield + RGB LCD + Switches

by adafruit_support_bill on Sun Jan 27, 2013 10:18 am

Yes. That will work.
User avatar
adafruit_support_bill
 
Posts: 30820
Joined: Sat Feb 07, 2009 10:11 am

Re: Wave Shield + RGB LCD + Switches

by chickenparm42 on Sun Jan 27, 2013 10:32 am

When I look at the picture HERE, it looks like the LCD will also cover the chip and pot and stuff. The chip isn't an issue, assuming it has clearance (which I don't know if it does). And I'm assuming the pot could just be put on short wires. I just want to make sure that there is clearance for the screen over everything.

Also, what voltage do the buttons operate at? And what is the maximum amperage? I just want to make sure my switches will illuminate properly (LED off/dim when the switch is off, and brightly on when the switch is on).
chickenparm42
 
Posts: 11
Joined: Sat Jan 26, 2013 7:31 pm

Re: Wave Shield + RGB LCD + Switches

by adafruit_support_bill on Sun Jan 27, 2013 11:35 am

It does interfere if you push the long pins of the header all the way in. But the pins are long enough that you can clear the pot (although you will have difficulty adjusting it). Some also mount the display separately - connected with a short length of ribbon cable.

The pushbuttons use the internal pullups in the port expander to hold them at 5v when open. When the switch closes, the contacts short to ground.

What switches are you using? The illuminated switches we sell have separate pins for the leds and the contacts.
User avatar
adafruit_support_bill
 
Posts: 30820
Joined: Sat Feb 07, 2009 10:11 am

Re: Wave Shield + RGB LCD + Switches

by chickenparm42 on Sun Jan 27, 2013 12:54 pm

I am using THESE switches.

Useful quotes from different people on the product page:
"One side has a ground symbol, plus sign, and an symbol with rays coming out of a half circle (LED positive)...If you connect ground to the ground contact, and positive to the LED positive contact it will illuminate. When you flip the switch the plus sign and the LED positive are connected."

"there are only 3 pins but the pin with the ground symbol is not the common pin — it is only connected to the LED. The pin with the plus on it and the LED pin are connected together when the switch is closed."

However, an employee commented "There are only three contacts, with a common ground."

I am going to go do some testing with connecting the switch (no LCD) to see what I come up with. Hopefully then you will be able to tell me if my switch will work properly with your product.
chickenparm42
 
Posts: 11
Joined: Sat Jan 26, 2013 7:31 pm

Re: Wave Shield + RGB LCD + Switches

by adafruit_support_bill on Sun Jan 27, 2013 1:27 pm

There are some conflicting descriptions there. It would be nice if Sparkfun had a wiring diagram or spec sheet for it.

But it sounds like the anode of the led is hard-wired to a pole of the switch and that it is designed for 'positive logic'. That makes things a little tougher because you can't use the built-in pullup resistors on the Arduino or the port expander. You will need separate pull-down resistors.
User avatar
adafruit_support_bill
 
Posts: 30820
Joined: Sat Feb 07, 2009 10:11 am

Re: Wave Shield + RGB LCD + Switches

by chickenparm42 on Sun Jan 27, 2013 1:59 pm

I just did some testing, with the (+) connected to +5v, the (ground) to ground, and the (led symbol) to a digital pin, the LED on the switch only illuminates when the switch is on.

When I run the sketch below, the switch turns on the Uno's built-in LED

Code: Select all | TOGGLE FULL SIZE
 int ledPin = 13;                     // LED connected to digital pin 13
 int SwitchPin = 2;                 // Switch connected to digital pin 2
 int val = 0;                          // variable to store the read value

void setup()
{
  pinMode(ledPin, OUTPUT);      // sets the digital pin 13 as output
  pinMode(SwitchPin, INPUT);    // sets the digital pin 2 as input
  digitalWrite(SwitchPin, HIGH); // turn on pullup resistor for switch
}

void loop()
{
  val = digitalRead(SwitchPin);   // read the input pin
  digitalWrite(ledPin, val);    // sets the LED to the switch's value
}


Mind you, the wave shield is disconnected. But it shouldn't matter.

EDIT: I didn't use any additional hardware (i.e. resistors).
chickenparm42
 
Posts: 11
Joined: Sat Jan 26, 2013 7:31 pm

Re: Wave Shield + RGB LCD + Switches

by adafruit_support_bill on Sun Jan 27, 2013 2:10 pm

EDIT: I didn't use any additional hardware (i.e. resistors).

But you did enable the internal pullup:
Code: Select all | TOGGLE FULL SIZE
  digitalWrite(SwitchPin, HIGH); // turn on pullup resistor for switch

In the OFF position, does the pin with the led symbol get connected to ground?
User avatar
adafruit_support_bill
 
Posts: 30820
Joined: Sat Feb 07, 2009 10:11 am

Re: Wave Shield + RGB LCD + Switches

by chickenparm42 on Sun Jan 27, 2013 2:38 pm

adafruit_support wrote:But you did enable the internal pullup:

I probably should have specified, I meant excluding the internal pullup.

adafruit_support wrote:In the OFF position, does the pin with the led symbol get connected to ground?

How would I determine this without tearing apart the switch?
chickenparm42
 
Posts: 11
Joined: Sat Jan 26, 2013 7:31 pm

Re: Wave Shield + RGB LCD + Switches

by adafruit_support_bill on Sun Jan 27, 2013 2:56 pm

Use a multimeter and measure the resistance.
User avatar
adafruit_support_bill
 
Posts: 30820
Joined: Sat Feb 07, 2009 10:11 am

Re: Wave Shield + RGB LCD + Switches

by chickenparm42 on Sun Jan 27, 2013 3:36 pm

I'm getting 0L when I measure (led) and (ground) (or anything else besides the (+) and (led) terminals with the switch open). There is also the chance that I am doing something wrong, as its a new multimeter.
chickenparm42
 
Posts: 11
Joined: Sat Jan 26, 2013 7:31 pm

Re: Wave Shield + RGB LCD + Switches

by adafruit_support_bill on Sun Jan 27, 2013 4:40 pm

0L means no connection. I'm not sure how the circuit works with a pullup then.
User avatar
adafruit_support_bill
 
Posts: 30820
Joined: Sat Feb 07, 2009 10:11 am

Re: Wave Shield + RGB LCD + Switches

by chickenparm42 on Sun Jan 27, 2013 4:46 pm

I have a bunch of resistors, so I can try pull down resistors later today. I've never done pull down before, how would I proceed? Or do you know of any good resources that might apply to this situation?
chickenparm42
 
Posts: 11
Joined: Sat Jan 26, 2013 7:31 pm