Making a few pins many

AllanBertelsen

Senior Member
Hi -
I've been looking for a way to get as much out off tree pins on a 08M as possible. Without to much complexity.
The first idea was to read with to input pins and address with a third output pin. If output is low I can read sensor 1 and 2 and when output is high I can read sensor 3 and 4.
Then I got the idea to use a BCD to decimal decoder (fx. 74HC42). Now I use output 2 pins for addressing and one input for reading sensors. That will only give me four reading as in the firs approach.
The third idea is to us a Johnson decade counter with 10 decoded outputs 74HC4017. Here one output pin is use for resetting the counter. A second output pin is used as clock. And the third input pin is use for reading sensor. Now after reset the first output pin on 74HC4017 will be high and all other 9 pins low. This pin feed the first sensor witch can be read by the picaxe input pin. Then we lower and raise the second picaxe output pin (our clock). Now the second sensor is on the line. This can be done for 10 sensors. I think I saw that 74HC4017 has a carry output making it possible to connect several 74HC4017 in series. Then you can read 20, 30 or more sensors with only 3 pins.

Any experience with such approaches?
 

Jeremy Leach

Senior Member
Does each sensor have a digital output?

How does each sensor get enabled? Is it by pulling it's power line high by the output from the clocked chip, then diode ORing the result before feeding into the PICAXE?

Why do you need a reset line to the chip, doesn't it just cycle round making the outputs high ?
 

AllanBertelsen

Senior Member
If I only want to use 7 sensors I don’t want to wait for the last 3 ticks of the clock. I could also have a couple of sensors I want to read every second and others that only has to be read once every minute. The high priority sensors get first in line.
Every output has to be connected via a diode to the sensor. The sensor can be read as a digital or as analogue. If 4017 is fed with 5v then the output will also give 5v but only one at a time (as I understand it).
If this is true, it's up to me to decide what to use the outputs and the one input for. But I could surly need some help specifying the circuitry. I don’t really know much about the subject.
 

Jeremy Leach

Senior Member
So , what are your sensors exactly? I don't think this solution will work for analogue sensors.

I personally still think you don't need to use a reset line. I don't see that it matters if you have to skip over the last 3. You could clock these very fast in code.

Edited by - Jeremy Leach on 07/04/2006 12:44:53
 

Michael 2727

Senior Member
How many inputs do you need/would like exactly ?
e.g. inputs 1 - 4, or 1 - 7
And how many outputs are needed/wanted ?


 

jodicalhon

New Member
If you are, for instance, using 7 sensors, connect the 8th 4017 output to the reset, and it will reset automatically.
 

AllanBertelsen

Senior Member
The sensor could be a LDR, a termistor or anything that give about 0v to about 5v.
You are right about the reset line. A reset would make me sure about witch output is high. Its just me being silly.
I just found this on the net. <A href='http://sxlist.com/techref/io/rotarysw.htm[/]
If I understand this text this guy uses 4017 and only one pin. ' Target=_Blank>External Web Link</a>
 

AllanBertelsen

Senior Member
Of course Jo C &#8211; that&#8217;s brilliant. I don&#8217;t know how many input I might need. As I see it this could be a way to never get short of inputs. I wonder if I could make a lot of output to now I don&#8217;t need the reset line anymore.
Heres the link again. <A href='http://sxlist.com/techref/io/rotarysw.htm' Target=_Blank>External Web Link</a> If I understand this text this guy uses 4017 and only one pin.
 

Fowkc

Senior Member
So what is your plan for your 4017? To provide power to your sensors in sequence? If you you still need a strategy to read them, so some way to isolate them from each other at the PICAXE ADC end (as Jeremy suggested, diode OR would be a possible solution).
 

AllanBertelsen

Senior Member
This isolating ting might be my weak spot. If a LDR is connected in serie with a resistor then you should be able to read the voltage between these two.

<code><pre><font size=2 face='Courier'>
|\ | _____ _____
4017out1---| &gt;|---|_____|-.-|_____|----- 0v
|/ | LDR1 |
|
PICAXE IN
|
|\ | _____ |
4017out2---| &gt;|---|_____|-.
|/ | LDR2

</font></pre></code>
If out1 is on and out2 is of. LDR1 should be isolated. There's no potential.
But - I'm not clever at this. I hope some can help me se the problems and solutions.


Edited by - AllanBertelsen on 07/04/2006 16:36:17
 

Jeremy Leach

Senior Member
Hi Allan. Tip for ASCII art ....use notepad with a suitable font first. Then paste it in the posting enclosed by the code /code (see protocol tab).

Also, can edit posts rather than post again and again (press the magnifier button on the original post).

I think the LDR solution would work - BUT you only need one resistor to ground, not one for each LDR.
 

Snowface

New Member
If you need more inputs or outputs you can expand 3 output pins on your picaxe to give 14 or more outputs by using shift registers and latches (74xx595). Same for inputs using 74xx165 series.
 

AllanBertelsen

Senior Member
Thank you Jeremy for the tips. I wondered how everybody else got the ASCII art right. Snowface - thank you to. I will investigate 74xx165 series right away. I'm new to this. Of course there must be a lot of well established techniques and best practices. For a newcomer it's easy to lose one's way.
 

rfs

Member
Allan

I have just read two articles which describe a possible solution.
Both are by David Lincoln.

1. His book &quot;Programming and customising
the PICAXE microcontroller&quot; Page 209

2. His article in Silicon Chip June 2003 No.177
siliconchip.com.au

Both contain circuit diagrams and code.

rfs

Edited by - rfs on 07/04/2006 17:12:07
 

Jeremy Leach

Senior Member
Hi Allan - Actually I thought your 74HC4017 idea was a good one. Only one pin to select the sensor you want, and you can quickly skip sensors you're not interested in - great.

There's often more to it than the theory though. For instance - what current are the output pins of the 74HC4017 capable of driving? Also, diode characteristics are temp sensitive and there will be a diode forward voltage drop etc etc. All these things need to be taken into account, but don't let them put you off !
 

AllanBertelsen

Senior Member
You are just right Jeremy. I got a lot to learn. How do you calculate witch resistors, diodes and capacitors to use and where to use them? Only reading, experimenting and thinking brings you further. Yes and then a forum like this!!!
I found a couple of sites with loads of information for people at the same level as I. Play-Hookey is one. <A href='http://www.play-hookey.com/' Target=_Blank>External Web Link</a> The Electronics Club is another site <A href='http://www.kpsec.freeuk.com/index.htm' Target=_Blank>External Web Link</a>. If anybody knows good sites to learn from then please...
When to sink and when to source? What's diode logic?
Don't answer here. But a link or two for that kind of information would be appreciated.


Edited by - AllanBertelsen on 07/04/2006 19:10:25
 

Michael 2727

Senior Member
Or the 4514 4 pins to 16.
The Sink/Source will depend on the chip itself.
That's why you need to read data sheets.
Most of those type chips can only sink/source
a few mA at a time, then you also should
read the total package data disipation data
as sometimes this can be exceeded if all the
outputs are used to full capacity.
A lot of the time they are measured in mW not mA
so some calulating may be involved.
just Ohms law simple stuff fortunately.
 

AllanBertelsen

Senior Member
CD4051 and 4514 looks good to. They just cost too many pins. But then it should be possible to put a 7493 (4-bit counter) between picaxe and the wanted chip. Then 2 pins will be enough.
 

AllanBertelsen

Senior Member
Hi flyingnunrt &#8211;
Yep &#8211; it's absolutely silly of me to look for one or two additional IC to put on my board to extend a 08M when an 18X could do the job. The explanation is that I'm trying to learn. There might also come a day where its 18X or 40X that has to be extended. The next thing for me to look at is using more than one PICAXE at one solution. There must be a lot of ways to make them talk together. Hippy site tells a lot about this subject.
It's by solving the technically challenges that I learn.
 
Top