LCD on I2C with switches on GPIO?

Moderators: adafruit_support_bill, adafruit

Forum rules
Talk about Adafruit Raspberry Pi® accessories! Please do not ask for Linux support, this is for Adafruit products only! For Raspberry Pi help please visit: http://www.raspberrypi.org/phpBB3/
Locked
User avatar
whatamidoing
 
Posts: 26
Joined: Wed Jan 30, 2013 4:49 pm

LCD on I2C with switches on GPIO?

Post by whatamidoing »

Hi everyone.

I am getting into the Raspberry Pi. I have one, and I've used it quite sucessfully as a media player, and as a desktop computer. But now I want to make something a little more challenging, but I don't have much electronics experience.

I want to make an Internet Radio, and eventually add code to it so that it can also play playlists off network storage. I've found a couple of tutorials, including this excellent one on Youtube (http://youtu.be/KM4n2OtwGl0), but it's limited to 2 buttons. This isn't really enough for me. I want to have a 20x4 screen and 4-6 buttons so I can have a little more control of the system(for example play / stop, volume). So as far as I can tell the GPIO isn't going to be enough. So I will need to use the SPI or I2C bus.

The plan is to have up to 7 buttons on the GPIO. Each is simply a connected between the GPIO pin and the ground.

The 8th GPIO pin is for an IR Reciever. This is based on the info from here (http://forum.stmlabs.com/showthread.php?tid=5549). The data sheet for the IR sensor says that it's output voltage is the same as it's input+0.3max, so is that OK to run off the 3v line without resistors?

For the LCD I wanted to follow the info from Adafruit here. But this is for an Aridano(http://learn.adafruit.com/character-lcds) which is 5v. Will the controls be OK with the RPi's 3.3v? The LCD will still be powered off the 5v line.

I've attached a pic of what I am thinking of.Can anyone clarify if these are the parts will work together as intended?


Standard LCD 20x4 + extras - white on blue (https://www.adafruit.com/products/198)
i2c / SPI character LCD backpack (https://www.adafruit.com/products/292)
IR sensor - TSOP38238 (https://www.adafruit.com/products/157)
Premium Female/Female Jumper Wires - 40 x 6" (https://www.adafruit.com/products/266)
Single pole panel mount momentary switches (Adafruit doesn't have any I like)

Thanks.
Attachments
Radio Wiring.jpg
Radio Wiring.jpg (91.76 KiB) Viewed 999 times

User avatar
whatamidoing
 
Posts: 26
Joined: Wed Jan 30, 2013 4:49 pm

Re: LCD on I2C with switches on GPIO?

Post by whatamidoing »

And having looked into it a little more, I will be adding resistors to the switches, to make sure I don't fry my pi. Bit annoying as it would be good not to have to use a breadboard or have resistors suspended off the switches.

tldr
 
Posts: 466
Joined: Thu Aug 30, 2012 1:34 am

Re: LCD on I2C with switches on GPIO?

Post by tldr »

have you considered the lcd pi plate? includes 5 buttons and there is an unused pin on the mcp23017(?) to which you could add another button. it only uses the i2c pins on the pi, so it will free up a lot of i/o.

i think you may have trouble with the i/r sensor, since the pi does not have a real time kernel, you may not be able to resolve the timing. i would look around for information about lirc for the pi. here's one page i found.

User avatar
whatamidoing
 
Posts: 26
Joined: Wed Jan 30, 2013 4:49 pm

Re: LCD on I2C with switches on GPIO?

Post by whatamidoing »

It's not a bad option and I'm am already on the mailing list waiting for them to get back in stock, so I can work on the code while I figure out the hardware. My issue with the board is it doesn't really suit the way I want to mount it. Also a larger screen would be nice.

It looks like I'll end up going for a more complex solution where I use the same MCP23017chip as that board, but adding my own buttons so I can mount all the electronics on a board, then just have headers that I can plug switches and the LCD itself into.

tldr
 
Posts: 466
Joined: Thu Aug 30, 2012 1:34 am

Re: LCD on I2C with switches on GPIO?

Post by tldr »

it occurs to me that with a monochrome backlight on your lcd you would free up another two pins on the mcp23017.

you might want to look into the mcp23017's ability to generate pin change interrupts so you don't have to continuously poll for input.

have you seen jeff keyzer's internet radio project? he used an arduino for the user interface, a router running linux and a usb sound card. an atmega328 would cost probably twice what the mcp23017 would, but you could move the i/o off the pi to the arduino and talk to it over your choice of i2c, spi or uart. the uart might be nice since it's asynchronous. and an mega328 would give you the option of pwm control of the lcd backlight.

User avatar
whatamidoing
 
Posts: 26
Joined: Wed Jan 30, 2013 4:49 pm

Re: LCD on I2C with switches on GPIO?

Post by whatamidoing »

Well, you have pretty much lost me. Most of what you said is beyond me :)

But I like your monochrome LCD idea. I can just power the backlight for the color I want and not change it. 3 extra switches would be enough.

Wi-fi isn't of interest. I have Ethernet where the radio will be going so hacking a router isn't really needed. I2C is probably the way I want to go, as there is lots of code around on how to use it, esp on the guides here, so I'll just copy and change that.

tldr
 
Posts: 466
Joined: Thu Aug 30, 2012 1:34 am

Re: LCD on I2C with switches on GPIO?

Post by tldr »

sorry. i wasn't clear. jeff used a router because at the timeof his build it was the cheapest board, ($25), he could get that would run linux. although there were no gpio pins available, it did have a header to connect to a uart on the board and he connected an arduino to that to handle i/o to an lcd, some buttons and a rotary encoder.

i didn't link to his project yesterday because when i went looking for it it appeared to be down, but today it's back so here you are ... http://mightyohm.com/blog/2008/10/build ... roduction/

just a second, here, while i type the capcha.

Locked
Forum rules
Talk about Adafruit Raspberry Pi® accessories! Please do not ask for Linux support, this is for Adafruit products only! For Raspberry Pi help please visit: http://www.raspberrypi.org/phpBB3/

Return to “Adafruit Raspberry Pi® accessories”