HowTo address the PCF8574 - Netduino Plus 2 (and Netduino Plus 1) - Netduino Forums
   
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

HowTo address the PCF8574


  • Please log in to reply
13 replies to this topic

#1 JoopC

JoopC

    Advanced Member

  • Members
  • PipPipPip
  • 148 posts

Posted 21 July 2013 - 08:45 AM

Reading back all the posts on the Netduino forum , HowTo address the PCF8574 IC. There was no clear answer on this question.

 

But here it is, found on the GarageLab:

 

http://garagelab.com...er-with-pcf8574



#2 NooM

NooM

    Advanced Member

  • Members
  • PipPipPip
  • 490 posts
  • LocationAustria

Posted 21 July 2013 - 10:07 AM

netmftoolbox has a driver for it

also, if you read its datasheet, its a very simple ic (- but still a good one, i like its interrupt, thats makes it good for buttons and stuff)



#3 JoopC

JoopC

    Advanced Member

  • Members
  • PipPipPip
  • 148 posts

Posted 21 July 2013 - 05:54 PM

NooM, Yes, i had to look better on the IC too, there is a difference between the PCF8574P and  the PCF8574AP

 

The PCF8574P   = address  binair : 0100[A1][A2][A3]  where the A1 ~ A3 stands for the according pin on the IC Low or High.  (hex 0x20 ~ 0x27)

 

The PCF8574AP  = address binair : 0111[A1][A2][A3]  where the A1 ~ A3 stands for the according pin on the IC Low or High. (hex 0x38 ~ 0x3F)

 

For you it is simple to  tell your colleagues about programming IC's in shorthand writing ...... but you are a genius when you can transfer your knowledge to Netduino users who can barely plugin  there shaver in the electrical outlet, like me.



#4 NooM

NooM

    Advanced Member

  • Members
  • PipPipPip
  • 490 posts
  • LocationAustria

Posted 22 July 2013 - 10:36 AM

iam no teacher.

 

and there is so much info about this iC, i googled "pcf8574 netduino" and there are tons of helpfull samples/tutorials (the first is good, the second and 4th :D )

 

your adressing is correct.

its a very good and common iC for input (for output id use a 74hc595, cos its much much faster..)



#5 hanzibal

hanzibal

    Advanced Member

  • Members
  • PipPipPip
  • 1287 posts
  • LocationSweden

Posted 22 July 2013 - 02:39 PM

Here's a post containing a PCF8574 driver class and I2C bus manager that I've made: http://forums.netdui...-and-ir-remote/ Please let me know if you have any questions by posting in that thread.

#6 NooM

NooM

    Advanced Member

  • Members
  • PipPipPip
  • 490 posts
  • LocationAustria

Posted 23 July 2013 - 11:47 AM

hanzibal: hehe your driver looks like mine :D

 

but i have a suggestion: when you handly the interrupt like you do you get an odd number. filter it before

to get wich pin actually changed

 

 

Attached Files



#7 hanzibal

hanzibal

    Advanced Member

  • Members
  • PipPipPip
  • 1287 posts
  • LocationSweden

Posted 23 July 2013 - 08:07 PM

Well, I suppose there's not all that many ways to do it. I'll have a look at your code to see what you mean regarding pin numbering and interrupts.

#8 JoopC

JoopC

    Advanced Member

  • Members
  • PipPipPip
  • 148 posts

Posted 25 July 2013 - 08:40 AM

When sending a byte to the pcf8574 by example with the value 8 (for PIN 3), ......when PIN 3 is NOT connected (to a led)  I get with mybase.read() the value 8 returned. When I connect the PIN to a led, I get with mybase.read() 0 back.  Is this correct? I expected allways the value 8 .

 

 



#9 JoopC

JoopC

    Advanced Member

  • Members
  • PipPipPip
  • 148 posts

Posted 26 July 2013 - 06:36 AM

I can make my question a lot more simple:

 

What is the return .READ() value of the pcf8574  after sending a byte with the value 8 ?

 

Is there a difference in the return value when a led is connected to the corresponding p3 pin ?



#10 hanzibal

hanzibal

    Advanced Member

  • Members
  • PipPipPip
  • 1287 posts
  • LocationSweden

Posted 26 July 2013 - 10:24 AM

If I remember correctly, the PCF8574 is quasi bi-directional so by reading a pin you would effectively turn it into an input shutting down the output driver of that pin.

 

Since the pin is connected to ground via a LED (and presumably a resistor), you would get a logic low when reading the pin.



#11 JoopC

JoopC

    Advanced Member

  • Members
  • PipPipPip
  • 148 posts

Posted 26 July 2013 - 07:29 PM

Oké Hanzibal, we have implement the IC in the solar logging program (I am just a member of the team). As soon it is out of beta (with the release of 4.3 SDK) we will place the software on codeplex.  Another member of the team has made a CAD scheme of the hardware, maybe you can add some tips.

 

Posted Image



#12 hanzibal

hanzibal

    Advanced Member

  • Members
  • PipPipPip
  • 1287 posts
  • LocationSweden

Posted 26 July 2013 - 10:03 PM

You obviously think too highly of me, I can only understand part of the design without knowing more of the application. You could add more decoupling, having a 1uF in paralell with a 100nF to ground close to Vdd on ICs improves noise supression a lot. From my own sorry experience, I always pull down unused pins with some 100k. I see you use resistor networks for pull-ups which saves a lot of space. There seem to be quite a few loose joints here and there (no green ball). I'm not all that an experienced circuit designer but I'm sure your team is. What does solar logging mean in this context, are you following the sun as it travels across the sky or are you controlling a solar panel in some way? As for the quasi bidirectionality of the PCF8574, I remembered correctly according to section 7.4 on page 12 in the d/s: http://www.nxp.com/d...eet/PCF8574.pdf Note that you should drive an I/O pin high (and thus putting it into a high impedance state) before using the pin as an input by reading from it. In my opinion, this is what makes the IC so versatile.

#13 JoopC

JoopC

    Advanced Member

  • Members
  • PipPipPip
  • 148 posts

Posted 28 July 2013 - 08:55 AM

Hanzibal, with this simple program, you can log ( measure) and visualize everything (like energy consumption, water and gas, solar etc)  from a pulse meter or a smart meter utilized with a P1 poort. Also log the temperature with the onewire or tmp36 .

 

http://en.wikipedia....iki/Smart_meter

 

https://www.google.n...iw=1144&bih=646



#14 hanzibal

hanzibal

    Advanced Member

  • Members
  • PipPipPip
  • 1287 posts
  • LocationSweden

Posted 28 July 2013 - 01:25 PM

I don't have smart meter but I've made a light detector that detects pulses coming from a LED indicator on the meter fitted in the electricity central cabinet on the outside of my house. The LED pulses once for every half kW (or so) and my detector transfers the pulse via a 433Mhz radio link to a logger inside the house. I guess it's similar but only unidirectional and I suppose the meter with the LED indicator is a smart meter but it's owned by the electricity company.




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.