Alternative to AND gates as workaround? - Page 1
Forum section: electronics / beginners

author: noisebox
author_rank: Contributor
timestamp: January 03, 2014, 09:31:22 pm
content: Hi, I am wondering if anyone here could help me take the next step with my electronics and help me realise what i am missing with this circuit i am working on. I am building a "16 step sequencer" which outputs 16 control voltage levels in a sequence to drive an analogue synthesizer, there are numerous resources for this on the web, the most populour beginners version being the "baby 10 sequencer". This uses a 4017 decade counter to step through 10 different resistors in time with an incoming clock signal and will play notes on an analog synthesizer (the synth treats 1v as an octave over a span of 5v). Anyway to cut a long story short, the limitation of 8 or 10 steps has lead me to want to build a 16 step version (I bought a hardware unit for doing this last xmas, but at £400 GBP, I couldn't justify the xost as its just a hobby so I returned it to the store and have set upon building my own version for a mere fraction of that cost (and learning electronics in the process!).... the circuit below is not really how my circuit is now because I have discovered Arduino so have used Arduino to do a lot of the grunt work, it also gives me some great flexibility I couldn't get with the CMOS circuit (ie. the ability to move the sequence backwards, or randomly, which makes for a far more interesting device).However the Arduino I have (UNO) has a limited amount of outputs so creating the 16 step machine I want is still not entirely possible but I had a thought about using AND gates and a different counter which is reset after the 8 steps, then using logic determinig whether the 8 steps should be driving the 1st 8 steps or the 2nd 8 steps (9-16). I ended up having to use 4 Quad AND gates (I haven't actually built it yet...but have tested the theory with one QUAD and gate and doing a dual 4 step which 2 counters which only count to 2). I then realised i could do the same with CMOS so have the circuit built below, but my final will use Arduino.I just think there must be a better way of doing this however? I have read about shift registers and heard phrases like "Gate Array logic" I am thinking maybe that is the option I need to go down but I can't find anything that explains it in a way that makes sense to me. Can anyone tell from the diagram if I am doing it right or if there are easier ways? I really want to have physcial control of all 16 outputs, I have done things like using arrays in arduino and storing the value with an input pot and switching between the variables to set the output and using PWM through a filter to do a similar thing, but going through a menu to set each output value defeats the purpose of this instrument. The 5V output from the Arduino matches exactly the requirements for my synthesizer, but I need an LED indicator next to each pot so I know where the sequencer is. In this diagram I have just drawn the LED's coming off the gates but in reality this steals too much current and affects the output. With an eight step version I have used 8 NPN transistors and fed the base a tiny current through a 2M resistor after the GATE and driven the LED's with a 9V battery instead. It works real well but ideally I'd like the circuit to have just one power supply, I'm also worried that the 9v power could get into the arduino. I also would like to avoid having to use 16 transistors, are there alternatives here? What is the correct way to do this? Should I be using opto isolators? And can I do something like have multiple voltage regulators with one for powering the arduino and one for powering the LED's?Hope this post isn't too long winded! Appreciate any insights into how to design this better! (I know there are some completed circuits already kicking around on the web for this, but I'm determined to try learn how to do this myself!)ps. I have seen designs which slave two 4017's (ie. one enabling the other, but what I'm trying to simulate here is the limited outputs from the arduino!) Apologies if the diagram isn't very clear, I can explain it fuller if anyone is particularly interested in the function?

author: Unknown
author_rank: Unknown
timestamp: January 03, 2014, 09:33:46 pm
content: Shift registers. Simple to get going, loads of tutorials on arduino.cc.

author: Simon
author_rank: Unknown
timestamp: January 03, 2014, 09:44:40 pm
content: I got totally lost, but if i understand you need 16 voltage levels from 0-5V ? sure PWM output fed through a low pass filter that has a cutoff frequency much lower than the PWM frequency (498 Hz on the arduino), will give you the averaged DC voltage of the PWM duty.

author: sync
author_rank: Frequent Contributor
timestamp: January 03, 2014, 09:56:36 pm
content: Use CMOS analog multiplexer. Like here:http://studiomanus.com/Assets/Pictures/seku.gifUse an op amp to buffer the output. Instead of the 16 channel 4067 you can use also two 8 channel 4051 multiplexer and connect the outputs together. Enable one for the first 8 steps and the other for the last 8 steps.

author: noisebox
author_rank: Contributor
timestamp: January 03, 2014, 10:05:07 pm
content: More I need 16 lines of 5V which are fed sequentially to one output, and using potentiometers to vary the amount of voltage (the PWM method doesn't work great with analog synthesizers). So shift registers seem the way to go, but one quick question, am I likely to come across some sort of latency issues using shift registers? I think the AND gate logic may introduce some latency, but will it be more noticeable if needing to produce pulsed data to drive the shift register? Basically, the input clock will also be triggering a voltage controlled amplifier in the synthesizer, so it will produce a note for the duration of the clock pulse, and the Control Voltage needs to be playing a new note (based on the voltage level) at the same time as this pulse. (when using PWM and filtering the skew time was making the voltage "slide" to the next note, which can be a good effect but not what i want here).Also, any idea on powering the LED's, would shift registers reduce the need for so much transistors there also?I am wondering if maybe I should switch a higher voltage/current and calculate the voltage drop, but having the LED's wired that way seems to give unpredictable results (ie. I don't get the same voltage output across two pots with similar settings, but if I get rid of the LED's altogther its a much closer match)...

author: noisebox
author_rank: Contributor
timestamp: January 03, 2014, 10:11:38 pm
content: Quote from: sync on January 03, 2014, 09:56:36 pmThat looks cool I will need to look into that, although I am trying to get away from CMOS as Arduino gives me the flexibility of being able to have the sequence go forwards, backwards, pendulum, random etc. I have got it working really great with 8 steps but really interested in expanding this without going for more outputs!

author: Simon
author_rank: Unknown
timestamp: January 03, 2014, 10:31:23 pm
content: hang on can you explain exactly what output you want, never mind how you are trying to achieve it. if you really must do it 1880's style use a multiplexer to signal 16 transistors with a voltage divider after them, or even better use your opamp as a digital to analog converter that way for 16 levels you need 4 digital lines (2 to the power of 4 is 16) to switch power through 4 different value resistors (1 - 2 - 4 -and you get your 16 analogue voltage steps, but i still say that 498 Hz through a 50Hz cut off filter will work fine.

author: sync
author_rank: Frequent Contributor
timestamp: January 03, 2014, 10:38:19 pm
content: Quote from: noisebox on January 03, 2014, 10:11:38 pmDo you want an analog step sequencer with potentiometers to control the pitch? Then use analog multiplexer. It's the easiest. You can control the stepping/ timing with an micro controller, eg. a Arduino.

author: noisebox
author_rank: Contributor
timestamp: January 03, 2014, 11:03:36 pm
content: OK I think you've pointed me to the right direction here! I'm going to draw this up in my circuit simulator and try understand how it works! Cheers!!

author: noisebox
author_rank: Contributor
timestamp: January 06, 2014, 12:33:43 pm
content: Cheers again guys, de/multiplexing was deff the way to go. My simulator didn't have the 4067 but I was able to do what I want with two 4051's as suggested (with the 4520 I used the 4th bit as the clock inhibit (with an inverter before the second 4051) this seems to work well, although there is a slight glitch on power on and I get my 9th output HIGH for a split second, but as I will be using Ardunio as my clock and logic this isn't too much a worry for me (is there a better way of driving the two however from one 4520, I'm interested now!) Using 2 x 4051 also has the advantage that i can split between a 1-16 output, or 2x8, just the ticket! The next part of my puzzle was going to be how I coudl have some 2 way switches on each of the 16 steps as inputs, but again the 4051 looks to handle this exactly how I wanted. All the time i had wasted learning about shift registersit was the wrong thing in this situation.Out of interest, I was able to buy 4051's easily enough from my local Maplin but 4067 i can only find in ebay and it is pretty expensive (the 4051's were 80p from Maplin, but half that price at the usual place I buy components online). Cheapest I can see a 4067 is about £7, while I really want to keep the chip count low for this project (thats what lead me to trying to get away from the AND gates in the first place!) is there any benefit with the 4067 or would dual 4051's be considered a bad design? It looks like the 4051 can be chained up to provide all sorts of options, like 64 inputs/outputs is using 9 chips!! Is it the norm to have a few of these chips in a design?

author: FrankBuss
author_rank: Unknown
timestamp: January 06, 2014, 01:02:45 pm
content: Yes, this is the normal case to have a few of the old-style TTL or CMOS chips. In Germany we call it "TTL Grab" (TTL grave) :-)For 64 outputs nowadays you would use one CPLD chip, e.g. the XC9572.Regarding the 100 ohm resistors for you LEDs: that's way too much at 5V for modern LEDs. Usually they are already bright enough with 1-3 mA, so something from 400 to 1000 ohm would do it (good idea to test one before soldering the rest 15 resistors). No problem to connect it in parallel to your multiplexer outputs.

author: Hideki
author_rank: Frequent Contributor
timestamp: January 06, 2014, 02:08:10 pm
content: Farnell sells DIP 4067 at £1.01http://uk.farnell.com/texas-instruments/cd4067be/ic-switch-mux-demux-bus/dp/1470913You can also use 74HC4067 if you limit the voltage to 5 (or 6) volts.