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

Extending Analog Input using 4017 and 4066

Analog Input

  • Please log in to reply
7 replies to this topic

#1 Fahdil

Fahdil

    Advanced Member

  • Members
  • PipPipPip
  • 59 posts
  • LocationJakarta, Indonesia

Posted 17 February 2014 - 05:58 PM

My project Goal is "Netduino Read 9 or more Analog Sensor".

 

Here I'm using Netduino+, with RTC on A4 and A5. so I just have 4 left more analog pin, but I used to read 9 analog sensor continuously. So I come with 4017 and 4066 to drive Analog Reading alternately.

 

here my schema:

Posted Image

 

Q0 => Humidity Sensor

Q1 => Distinguish-er (not a sensor... just a voltage divider to return 2.2v )

Q2 => Temperature

Q3 => Air Pressure

Q4 => Reset if you don't attaching any  more sensors.

Q5 - Q9 (we can add more sensor) but in my case I just need to use 3 sensor in a single analog pin.

 

whenever we trigger 4017,  it will send a 3.3v logic consecutively from Q0 to Q9 (except you reset it on middle).

 

This is one block of 4017 and 4066 as switcher. we can trigger the 4017 clock by using a single digital pin as output port. here, every 15sec netduino trigger 4017 to switch the analog input.

if (_getDistinguisher){    Distinguisher.Read(); //read analog input    while (Distinguisher.value < 2000) //millivolts    {	Switcher.Switch(); //trigger 4017 to switch the channel (send positive triger 50ms)        Distinghuiser.Read();        Thread.Sleep(490);    }    if (Distinguisher.value > 2000) // if analog input reads 2v    { Switcher.Channel = 0; _getDistinguisher = false; } // then reset the chanel}if (_Second % 15 == 0) //do switch every 15 sec.{    if (_timeToSwitch)    {        Switcher.Switch();        if (Switcher.Channel == 0 || Switcher.Channel == 4) { Switcher.Channel = 0;         _getDistinguisher = true; }        _timeToSwitch = false;    }}else { _timeToSwitch = true; }

and we can read analog input alternately, here I use a simple code: (read 3 Analog sensor in asingle Analog Pin)

switch (Switcher.Channel) //these all Analog Read from Analog_GPIO_A0{   case 0:	Distinguisher.Read();        _currentReadValue = "Ch 0: " + Distinguisher.valueToString;//to display on Lcd        break;    case 1:        AirTemprature.Read();        AirTemprature.Collect(AirTemprature.value);        _currentReadValue = "Ch 1: " + AirTemprature.valueToString;        break;    case 2:        Humidity.Read();        HumidityContainer.Collect(Humidity.value);        _currentReadValue = "Ch 2: " + Humidity.valueToString;        break;    case 3:        AirPress.Read();        AirPressContainer.Collect(AirPress.value);        _currentReadValue = "Ch 3: " + AirPress.valueToString;        break;    default:	break;    }

Here's my note:

4017 is not always start with channel 0 on the start Up. That's why I do this (keep read and switch until we got the distinguish-er. 

    while (Distinguisher.value < 2000)    {	Switcher.Switch(); //trigger 4017 to switch the channel        Distinguisher.Read();        Thread.Sleep(490);    }

I'm still work with the code... so I cant attach it yet :P (sorry)... I will attach it soon.... :)

 

Cheers ^.^V



#2 Paul Newton

Paul Newton

    Advanced Member

  • Members
  • PipPipPip
  • 724 posts
  • LocationBerkshire, UK

Posted 17 February 2014 - 06:35 PM

Great circuit - Well done - Thanks for sharing.



#3 Fahdil

Fahdil

    Advanced Member

  • Members
  • PipPipPip
  • 59 posts
  • LocationJakarta, Indonesia

Posted 17 February 2014 - 07:42 PM

Great circuit - Well done - Thanks for sharing.

:D  your well come....



#4 Mario Vernari

Mario Vernari

    Advanced Member

  • Members
  • PipPipPip
  • 1768 posts
  • LocationVenezia, Italia

Posted 18 February 2014 - 04:36 AM

The idea is great, also because many users are asking for that.

Just two considerations, though...

 

First off, if you use plain "old" 4017/4066 (CMOS logic) instead of the more modern 74HC4017/74HC4066, I'd connect their supply to +3.3V rather to +5v. That's because their logic thresholds are less incline to be used in mixed voltages circuits.

(NOTE: I'd just wonder where were you able to find such a 30+ years old chips!)

 

Secondly, why didn't you choose a simple de/multiplexer such the 74HC4052? A couple of those chips yield you 16-to-4 analogs inputs. And they are explicitly addressable, without any needing of pulsing the 4017's clock.

http://www.nxp.com/d...4HC_HCT4052.pdf

 

Good luck!


Biggest fault of Netduino? It runs by electricity.

#5 Fahdil

Fahdil

    Advanced Member

  • Members
  • PipPipPip
  • 59 posts
  • LocationJakarta, Indonesia

Posted 19 February 2014 - 05:52 AM

Hi Mario,

I'm in Indonesia, there are so many of those chips here. hahaha I just know those chips are so old ages. :lol:

and thanks for your suggestion. It's really a great suggestion. I will look for 4052 in the market.....  :P

 

and I ask to forum how to extend digital input. hope you know the best IC I looking for. :D

http://forums.netdui...ame-controller/

 

cheers ^.^V



#6 Mario Vernari

Mario Vernari

    Advanced Member

  • Members
  • PipPipPip
  • 1768 posts
  • LocationVenezia, Italia

Posted 19 February 2014 - 06:36 AM

I'm in Indonesia, there are so many of those chips here. hahaha I just know those chips are so old ages.

 

 

I am in Italy, but I have a bunch of those chips as well!...It's just they looks so...ice-aged tech!

Just kidding!

I wanted to point that, just because the old CMOS were pretty different from the modern logic, and some user might have problems using them.

 

and I ask to forum how to extend digital input. hope you know the best IC I looking for.

 

 

You may use the same chip for the boolean I/O as well. As the 4066, the HC4052 is like a "rotary switch" (made of MOSFETs, of course), where you can set the "position" by the selection bits. Moreover, acts naturally as bidirectional routing for an I/O, thus you can use for both inputs and outputs, even mixed.

What else could be easier?

 

Cheers

 

PS: is it okay there about volcano dust? I've seen many people in troubles for the huge eruption yet heavy dust spread over villages...


Biggest fault of Netduino? It runs by electricity.

#7 Fahdil

Fahdil

    Advanced Member

  • Members
  • PipPipPip
  • 59 posts
  • LocationJakarta, Indonesia

Posted 20 February 2014 - 09:29 PM

dear Mario,

 

You may use the same chip for the boolean I/O as well. As the 4066, the HC4052 is like a "rotary switch" (made of MOSFETs, of course).

 

as you mention above, I get it. but I mean to hear digital inputs all together. In my windows app, I'm using USB game controller to get digital input to my pC. In example, if I press Button X, it will send to the app a byte 3, and if I press X and O together it will send 3 + 2 (byte 5). and so on. so I can hear all 16 button (which drove by digital signal) together, only by 1slot usb. 

 

I wish, i could do that on Netduino. btw I'm sorry if i'm not good enough :( . it's really a pleasure if someone can told me how to solve it. I do really glad you were suggested a cool way ^^ about my Analog input problem.

 

Cheers. :D

 

umm... about the volcano dust, I'm so far enough from it. but anyway thanks for your care. ^_^



#8 Fahdil

Fahdil

    Advanced Member

  • Members
  • PipPipPip
  • 59 posts
  • LocationJakarta, Indonesia

Posted 23 February 2014 - 10:21 PM

as you mention above, I get it. but I mean to hear digital inputs all together.

 

this is solve relate to this thread....

 

cheers







Also tagged with one or more of these keywords: Analog Input

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.