Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

I2C driven LCD panel and IR remote

LCD PCF8574A PWM IR hd44708 I2C

  • Please log in to reply
5 replies to this topic

#1 hanzibal

hanzibal

    Advanced Member

  • Members
  • PipPipPip
  • 1287 posts
  • LocationSweden

Posted 25 April 2013 - 01:37 AM

This probably does not qualify as a project but here goes anyway...

 

Earlier today I picked up a couple of PCF8574A I2C controlled 8 bit IO-expander ICs. They where actually meant for another project but I thought I'll get to know them first so I spent the evening with my dear Netduino mini and came up with this IR remote controlled hd44708 LCD panel with the word "brightness" misspelled and all:

 

Attached File  Mini_PCF8574A.JPG   59.44KB   108 downloads

 

The mini uses the I2C IO-expander IC to control a classic 2x16 character Hd44708 LCD which runs in 4 bit parallel mode thanks to the PCF8574A. The IC is used to create a 5 bit bus of which 4 are data (LCD pins d4..d7) while the 5th bit is used for clocking (LCD E pin). This makes the LCD run a lot faster compared to pure bit-banging.

 

The PCF8574A is what they call "quasi" bi-directional and actually does work in both directions. Basically it's a really simple and cheap way of getting another 8 fresh GPIOs and it's available in a breadboard friendly DIP16 package. It even has an interrupt pin that can be used to tell the micro that an input pin has toggled. When cranking up I2C to the IC's max of 100kHz, my Netduino mini can toggle the pins at ~1kHz.

 

Two PWM channels are used to control contrast and brightness respectively and the LCD backlight runs directly of the 3V3 PWM output since it only draws a sheer ~4.5mA.

 

I also recycled some code from another project to implement a NEC IR receiver using a 38kHz IR receiver and took a ridiculously cheap eBay remote control out of my junk box. Just stick the receiver down the breadboard, feed it 5V, connect the output to a digital input of the mini and you're good to go.

 

It all came out pretty mean and lean, the only passives are a couple of 4k7 I2C pull-up resistors and the whole thing runs off a 9V battery consuming ~30mA with the LCD in full bloom.

 

It doesn't really do much yet, it simply receives the IR commands and displays them on the LCD - power, next, prev, mute, vol and all that. Brightness can be adjusted on the remote though. The mini actually has quite a few pins available which can be used to control other stuff so I might put it to good use in some audio project to come.

 

Please let me know if anyone would like the code. I do have to check with Stefan first though, since I had to mess up his Toolbox hd44708 class. EDIT: Code is available below.

 

Tip of the day: Using an IR remote instead of push buttons and the like is just so much easier and more flexible plus it only takes a single pin to add 20+ buttons....and best of all, it's friggin' wireless!

 

EDIT: When come to think of it, I guess I have to publish the code because of Stefan's Apache 2 license, so here it is with misspelled word corrected and everything. It's quick and dirty and there are things started but unfinished so you have to take it for what it is. I guess I could write a nice and friendly wrapper class for the IC on popular demand but not now, because I really have to hit the sack :D

 

Attached File  PCF8574A_v2.zip   10.16KB   168 downloads



#2 hanzibal

hanzibal

    Advanced Member

  • Members
  • PipPipPip
  • 1287 posts
  • LocationSweden

Posted 30 April 2013 - 10:11 AM

I've updated the above post with a new version of the software.

 

Now all LCD pins are controlled by the PCF8574 IC (except VO and A which are controlled by PWM) which has made the LCD faster yet.

 

Also, there's now an I2C bus manager class and a more generalized PCF8574 wrapper class and I've cleaned up the code and added more comments and an enum for the IR commands which makes it easier for you to implement your own remote control which is likely to use different codes than mine.

 

EDIT: I would like to transfer a whole string at once to the LCD but for some reason I'm only able to transfer one byte (two nibbles) at a time. Maybe someone could help figure this out?



#3 piwi

piwi

    Advanced Member

  • Members
  • PipPipPip
  • 114 posts
  • LocationGermany

Posted 10 June 2013 - 07:24 PM

Hi Hanzibal,

 

thx for posting the code, I could use it for my humbug stuff.

 

Does the code run with netmf 4.1 as well ?

 

Cheers,

 

P.



#4 hanzibal

hanzibal

    Advanced Member

  • Members
  • PipPipPip
  • 1287 posts
  • LocationSweden

Posted 10 June 2013 - 10:23 PM

Hi Piwi, good to hear from you!

I'm pretty sure it will and I would love to see you confirm that. Other than the mini and the LCD (which I think you already have), you'll need these two:

PCF8574 8 bit IO expander with I2C Interface
http://www.nxp.com/d...74_PCF8574A.pdf

38kHz IR receiver with built in decoder and aplifier
http://www.electroki...e/download/2205

Or a pair with equivalent functionality (TI also makes a PCF8574). Personally, I love that IC, so versatile, uses only two pins (I2C), easy to use and simple to interface. The code above contains drivers for the IC, LCD (4-bit mode), IR reciver and a I2C bus manager.

Btw, I saw your monster DAC and it looks amazing! I must read more carefully before I can comment though.

EDIT: Did you see my CD player? Among other things, it uses the code in this post.
http://forums.netdui...now-with-video/

#5 piwi

piwi

    Advanced Member

  • Members
  • PipPipPip
  • 114 posts
  • LocationGermany

Posted 11 June 2013 - 09:20 PM

Hi Hanzibal,

 

I'm sorry I don't have a mini, a couple of cerb40s though. But I'll try my n+, I'll first have to get the other stuff you mentioned.

 

And yes, I've seen your CD. that's pretty cool .... makes me wonder if my very first region free dvd player from creative labs (+20) would be working as well, it does in my pc. I keep moving it around for sentimental reasons everytime I go and upgrade one of my PCs .... I won't tell you my age though ....   :)  :)

 

I still think back of the days I was tweeking around the c-64 with loader routines to speed up the serial connected diskdrive. I managed to figure out that the pet software was still active in the diskdrive's firmware and just needed to connect the parallel cable and load some sw to boost the load 20 times or so .... but that's a very long time ago ... oops again showing my age ... :D

 

very helpfull to see an appliance for the code .... i'll have a look at it when I get to it ...

 

As always, thx for all your efforts and keep the good thing going ....

 

Cheers,

 

P.

 

PS. The super regulators on the monster DAC come from Sweden as well http://sjostromaudio.com I had to choose between two and since I kind of knew someone (guess who) from that area I decided to get it from there.



#6 hanzibal

hanzibal

    Advanced Member

  • Members
  • PipPipPip
  • 1287 posts
  • LocationSweden

Posted 11 June 2013 - 09:38 PM

Code should work on any Netduino, just change the mini-specifics into the corresponding of your N/N+. As for age, the first computer I programmed was the ancient ABC80 from Luxor, then the Spectrum Sinclair, C64, Amiga, IBM PC with Intel 8088, PCs with 80286, 386, 486, Pentium. The Amiga 500 was the 1st computer I owned my self. Go figure ;-) I'll try and find the time to look more closely at your latest creation, it's been a busy week (new position with a new company since monday). And yes, I think your Creative drive will work with my Netduino mini CD player code (you need two more PCF8574). As you know, those drives have galvanic S/P dif out (5V ttl so you need to shift down the levels if connecting to a home stereo amp over coax) 16-bit stereo @ 44.1kHz that I was thinking of connecting to a Texas DIR9001 and make a PCB for it all.





Also tagged with one or more of these keywords: LCD, PCF8574A, PWM, IR, hd44708, I2C

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.