4051 Multiplexer with Propeller
axeon
Posts: 7
Hello,
I was wondering if anyone might be able to point me in the right direction for info on using a 4051 analog mux with the Prop. I need info on connections and coding. (Couldn't seem to find schematic or code examples in the forum archive, or google).
I'd like to experiment with adding various resistive components (pots, fsr, photocells, etc.) via analog mux.
Thanks for any help or references.
Tony
I was wondering if anyone might be able to point me in the right direction for info on using a 4051 analog mux with the Prop. I need info on connections and coding. (Couldn't seem to find schematic or code examples in the forum archive, or google).
I'd like to experiment with adding various resistive components (pots, fsr, photocells, etc.) via analog mux.
Thanks for any help or references.
Tony
Comments
Now, if you described your project in a little more detail and made it more interesting then maybe.....
welcome to the propeller-forum!
The members in this forum are really friendly and patient even with the
most basic questions. I often think the propeller-chip is a microcontroller
that is attractive to people that are very open-minded and therefore patient.
Please do the "medium-neewbees" a big favor and ask really basic questions that can be answered by "medium-newbees".
If you look through the threads of this forum you will find basic questions
and high advanced questions and threads. So this is a place for everyone.
From beginners learning how to code for the first time up to assembler-tweaking-freakin-freaks
doing things that make the brains of other assembler-tweaking-freaks SPIN in twisted-circles ;-)
Parallax and the members of this forum always like to improve the
"feel-at-home-factor" as much as possible.
You wil NEVER get a "RTFM" (read that f... manual) as an answer.
You will get good will and direct help or a detailed hints WHERE in the manual more detailed information can be found.
So just start write a 10-20 lines description what you want to do and how far you did come and a question.
In most cases it is good to add your code or datasheets as attachment.
If others can see that you have tried even a little bit on your own and now have questions you will get answers.
Start using the mentioned sources and come back as soon as you have a question.
As a first simple start: Do you think you can connect some Propeller-IO-Pins to the 4051 and two voltage-dividers which produce different voltages then let a test-code switch the 4051 between
the two analog inputs and measuring the voltage at the 4051-output to check if the switching is working?
If this is "way above your head" please tell us your experience in coding and in electronics. We (the other forum-members) have to adapt our suggestions to your knowledge-level.
Keep the questions coming
best regards
Stefan
Thanks very much. At first I was just thinking of using the Prop's RCTIME to read values from a few pots. However, I don't have enough pins left on my prop. So I looked around for something like the 4021 piso shift register, since I have previously used those to increase digital inputs. I thought the 4051 analog multiplexer is what I need to accomplish this for use with analog inputs?
I know that using the 4051 mux to read analog inputs would preclude using RCTIME. I've attached a .gif of a schematic of what I would like to accomplish, however using pots instead of switches.
The schematic image comes from a blog I found last night: http://electronihack.blogspot.com/.
The author also provides demo code for reading in the analog 4051 (using switches as inputs). Now, although this is helpful, I thought why would you use an anlog mux to read in digital values? (To me, a switch is a digital component, no?) Why not instead use a 4021 shift register in that case?
I thought the analog mux would be more suited for analog input readings, like pots, not switches?
So, I thought I would use the example there and just replace those switches in the schematic with pots and change the code a little.
Please let me know if I've got this all wrong.
Thanks again for your help,
Tony
You can use the '4051 to measure the RC time constant of all 8 channels if you have 4 prop pins available. I can post a schematic if you are interested.
PS - Not sure if RCtime can be used as is. It may need a small change to select the channel, or you may be able to select the channel just before calling RCtime.
please give us an overview about your project. The pots are not a self purpose. The pots are used as input-devices. What kind of input DATA does your code receive from the pots?
As soon as you give us an overview new ideas will drive in how the same purpose can be done in alternative (and often easier) ways.
best regards
Stefan
That would be great if you could post the schematic. That is what I'd like to do, use all 8 channels.
I would like to experiment with detecting "touch" by measuring the R/C time constant as was demonstrated here: http://gadgetgangster.com/news/56-jeffs-shop/541-bananaphone-a-touch-capacitance-synth.html. This demo uses "Touch Buttons.spin" The code that reads the R/C time constant is written mostly in PropASM, at least the part of the code that actually does the measuring (I think).
I'd like to exclude the bananas, and expand my pins through the use of the 4051 analog mux. I don't know how the prop would read input from the 4051. Would measuring R/C time still be the way to go here?
Thanks again. Yes, I'm thinking this might be a better way.
PS You can also use the Touch Buttons object with some minor changes to read the state of the buttons.
You can vary the capacitor and the variable resistors, the 1nF and 10kOhm are just possible values. With 100kOhm or 1MOhm the measured values will be higher. With a lower capacitor the values will be lower.
Copy and paste the code into the PropTool. The code is not full tested (only without a 4051).
The channels you use in the main code must have a resistor connected, otherwise the getPot methode will wait forever.
Andy
Sincere thanks,
Tony