Linear moving switch, decade counter, chaser

In summary: You could drive them directly with a microcontroller, maybe through an LCD interface register.They would be an ok choice for me as switches, the only problem besides that their...price is that they are not programmable.
  • #1
artis
1,481
976
I need a row of switches, about 30 to be exact and the idea I need is to have a "moving OFF position" much the same way a "LED chaser" works where you have a moving ON position.

Only unlike in a LED chaser where one diode comes ON at any given time and the positions changes continually to resemble a running light, in my case I need for all the switches to be ON continually while some 2 to 3 switches are OFF and this position changes the same way the ON position would change in a "running light".

Now the simplest running LED light circuit I see is a decade counter IC 4017 coupled with a "clock" frequency supplied from a 555 chip.
This circuit would be fine as I can parallel more than one 4017 IC to get more outputs but the 4017 "pulls up" one output at a time only.
This means that I only get one switch at a time action.

Ideally I would need at least one switch to always be OFF while the next one turns OFF and only after that the last one turns back ON.
So 3 switches involved at any time.

My idea is this, I could use the 4017 IC and 555 counter , I would have to use P mosfets because the 4017 pulls the active output to +ve so that would correspond to switching OFF, while the inactive outputs are at ground so for P mosfet they would be ON.

I am thinking of adding some delay to the gate in order to accomplish that more than 1 switch is OFF at any given time. Say the 4017 pulls the next mosfet OFF but the previous one is also still OFF and only comes back On after the 4017 has moved one position ahead.

I am not sure how this would translate to frequency but the linear OFF position should ideally travel across the switch row at some 1000 km/h or bit more.

Sound a lot but shouldn't be anything particular for the speeds at which semiconductors can be switched, although i am not sure how to calculate the position moving speed into actual frequency of the moving OFF/ON position, can someone help with that?
 
Engineering news on Phys.org
  • #2
Drive each LED with an N-chan MOSFET. Drive each MOSFET gate with a 3-input NOR gate.
Connect the three inputs of each NOR gate to three adjacent outputs from the 4017 ring counter. That will give you three "off" LEDs, following together.
 
  • #3
Baluncore said:
Drive each LED with an N-chan MOSFET. Drive each MOSFET gate with a 3-input NOR gate.
Connect the three inputs of each NOR gate to three adjacent outputs from the 4017 ring counter. That will give you three "off" LEDs, following together.
Well to be clear this is not a LED chaser that I'm building , I just used it for reference.
It's a test I'm doing for my hobby and it has to fit on a rather small diameter (about 8cm) rotor so I am trying to use as little parts as possible.
The current and voltage involved will be minimal (I'm talking milivolts) so I am going for the smallest size parts also.
Your advice sounds good but I would prefer an easier , less parts solution.

I would ideally want to find an IC that can directly drive the mosfets in question.
I was at one point thinking of connecting two mosfets per each 4017 output , the outputs supply a max of 10ma which I think should suffice for low switching speeds and small mosfet gate capacitances.
Then by adding some minimal delay to the gate discharge path I could end up with 4 to 6 switches being OFF at any given time.
 
  • #4
I think you should specify the design requirements.
What are the MOSFETs driving, and how much current must they sink, or source ?
What voltage is only millivolts ?
What supply voltage is available ?
 
  • #5
There will be few mA of current for the mosfets to carry , milivolts is as measured from actual zero volts in this case. I'm talking about 10 to 20 mV in total (supply voltage in the mosfet D-S chain) , so for any "open" mosfets that would be the drop across it's drain to source in theory, but given it's neighboring mosfets will be conducting at all times therefore the real drop across any switch would be close to 0.
Supply for the driver IC to drive the gates will most likely be a battery.
 
  • #6
Take a look at these miniature, low voltage logic level gate MOSFETs, priced at less than 5 cents each.
Vishay Si2301DS, SOT-23, P-Chan MOSFET, 20V, 1.9A, 0.2R, 1.25W.
Vishay Si2302DS, SOT-23, N-Chan MOSFET, 20V, 2.4A, 0.1R, 1.25W.

You could drive them directly with a microcontroller, maybe through an LCD interface register.
 
  • Like
Likes pbuk
  • #7
They would be an ok choice for me as switches, the only problem besides that their smd size, is the pinout arrangement, the side with the two pins ideally for me should have been with D and S while the side with the single pin should be gate , for geometry reasons in the place I'm putting them.
Do smd package type mosfets come in this pinout configuration?
 
  • #8
artis said:
Do smd package type mosfets come in this pinout configuration?
The drain of a MOSFET is where the heat appears, so that is close to the heatsink tab, or in the middle of the SMD. It is unlikely you will find a similar device with a different pinout.
 
  • #9
I think I'd use NeoPixels. [Edit] or maybe 7 segment display drivers.
 
  • #10
pbuk said:
I think I'd use NeoPixels.
They are LEDs and this project does not use LEDs, that was a red herring.
 
  • Like
Likes pbuk
  • #11
Baluncore said:
They are LEDs and this project does not use LEDs, that was a red herring.
That's quite some herring, more of a blue whale!

Whatever, I agree with your microcontroller suggestion and then you can do whatever you want with appropriate drivers, via a DMUXer if necessary.
 
  • #12
I am very amateur in terms of MCU's and such but do you guys think an MCU could be programmed to do this and have enough outputs for such purposes to be arranged?
I thought this was more of an FPGA territory was it not?

I guess I need to look more into this although as said previously space is limited and given an MCU does not operate alone but instead needs a board with auxiliary devices like clock crystal etc, I doubt the final form factor will be small enough for me to fit any market available product into a space that is about 8cm in diameter.
 
  • #13
artis said:
I am very amateur in terms of MCU's and such but do you guys think an MCU could be programmed to do this
Easily.

artis said:
and have enough outputs for such purposes to be arranged?
For 30 independent switches you'll need some kind of multiplexing.

artis said:
I guess I need to look more into this although as said previously space is limited and given an MCU does not operate alone but instead needs a board with auxiliary devices like clock crystal etc, I doubt the final form factor will be small enough for me to fit any market available product into a space that is about 8cm in diameter.
I use Adafruit Feathers for all my projects: I usually use a 9cm x 7cm board but could go smaller. For this project I might use a Seeed XIAO RP2040.
 
Last edited:
  • #14
I would make a 32 bit parallel output shift register from four 8-bit chips. Connect the 30th output back to the input, load it with a simple pattern, then clock it at a regular rate to circulate the pattern.
 
  • Like
Likes hutchphd, Tom.G and pbuk
  • #15
Baluncore said:
I would make a 32 bit parallel output shift register from four 8-bit chips. Connect the 30th output back to the input, load it with a simple pattern, then clock it at a regular rate to circulate the pattern.
My alternative solution, assuming the switches can be commoned: 4 x 74HC4351 8-channel latching demultiplexers using 4 + 3 outputs of the aforementioned Seeed XIAO RP2040 (although I'd probably use an ESP32 and drive it via a web app :cool:)
 
Last edited:
  • #16
pbuk said:
My alternative solution, assuming the switches can be commoned: 4 x 74HC4351 8-channel latching demultiplexers using 4 + 3 outputs of the aforementioned Seeed XIAO RP2040 (although I'd probably use an ESP32 and drive it via a web app :D)
I would avoid the MCU by parallel loading the shift register when it was powered up. The number of bits in the running block would be programmed by half a dozen solder bridges on the parallel register inputs.
 
  • #17
Baluncore said:
I would make a 32 bit parallel output shift register from four 8-bit chips. Connect the 30th output back to the input, load it with a simple pattern, then clock it at a regular rate to circulate the pattern.
pbuk said:
My alternative solution, assuming the switches can be commoned: 4 x 74HC4351 8-channel latching demultiplexers using 4 + 3 outputs of the aforementioned Seeed XIAO RP2040 (although I'd probably use an ESP32 and drive it via a web app :D)
So I went around the "www" to search for some easy but working tricks and it seems I found a possible solution that uses the 74HC family IC but not the one you mentioned @pbuk but instead the 74HC 595
Please see this interesting approach in the video below , turn to 5:36 if you wish to see the schematic.


The interesting part is that the video author seems to use just a single 595 IC, and in order to drive the 32 LED's he puts them in pairs by 8 , each 8 LED's are connected in parallel but due to the layout as the shift register IC turns a few outputs OFF and changes that OFF position the actual OFF position within the circle happens at two places and moves around, smart isn't it?

What do you think?
PS. Is this anywhere close to what you meant @Baluncore by your parallel loading a shift register?
 
  • Like
Likes dlgoff
  • #18
artis said:
PS. Is this anywhere close to what you meant @Baluncore by your parallel loading a shift register?
Not the same, and I don't think it does what you want.
I would use several shift registers to make a 32 bit register to drive the MOSFETs.
If I was using four 8 bit SIPO registers, I would use 74HC164 which is simpler and probably cheaper than the 74HC595. It could be initialised by an MCU.
Without an MCU, a PIPO shift register would be easier to load with a pattern.
 
  • #19
Baluncore said:
Not the same, and I don't think it does what you want.
I would use several shift registers to make a 32 bit register to drive the MOSFETs.
If I was using four 8 bit SIPO registers, I would use 74HC164 which is simpler and probably cheaper than the 74HC595. It could be initialised by an MCU.
Without an MCU, a PIPO shift register would be easier to load with a pattern.
Well I like the minimal parts count in this approach. And the main sequence that is shown in the video actually suits me well, two simultaneous sides "walking" around with a 3 to 4 diodes split (the ones being off) between each one.
The one thing that i realize is that I would need to incorporate small LED's in my design either way because otherwise I couldn't know the exact pattern that is working, because I would otherwise need a scope with multiple inputs to probe and see whether the waveforms match what I need.
The good news is that the mosfets I will need have small gate capacitance and low gate Vgs voltage so I could in theory simply add a LED with a series resistor in parallel to the gate to source and the circuit would both have a visual part as well as a switching action.There is one thing I don't understand though about the circuit seen in the video I posted. How can he drive the LED's in parallel from each row when two rows have +- swapped places, so a single 595 output simultaneously applies +ve to a row that has ground on the opposite side as well as to a row that has the same +ve to the other side?
 
Last edited:
  • #20
Baluncore said:
Take a look at these miniature, low voltage logic level gate MOSFETs, priced at less than 5 cents each.
Vishay Si2301DS, SOT-23, P-Chan MOSFET, 20V, 1.9A, 0.2R, 1.25W.
Vishay Si2302DS, SOT-23, N-Chan MOSFET, 20V, 2.4A, 0.1R, 1.25W.

You could drive them directly with a microcontroller, maybe through an LCD interface register.
One more thing , I searched for the parts you mentioned in farnell since I will be shipping from there but sadly the N mos is out of production or at least not available, either way , what would be the typical needed gate voltage to reliably drive these small fets?
I'm just thinking of where to add the gate connection in the output of my shift register since I also plan to use the LED's for visual confirmation of the selected pattern.
I think the output will be like this - shift reg. IC - LED - resistor to ground. I could in theory put the gate connection after the LED so that it is between the LED and the current resistor to ground, given the resistor value there should be about 2 volts above ground or more.

Another option is to put the gate directly to the shift reg IC output, between the LED and the IC. But then I would probably need a resistor directly to ground as I doubt the gate would discharge reliable through the LED given it's voltage drop.
 
  • #21
This is a great example of why Silicon Valley invented programmable logic 30 years ago or so. I can assure you that virtually no one in industry would design this with discrete logic ICs today. Take your pick CPLD, FPGA, uC, etc. All can be simple programmable solutions to digital design.
 
  • Like
Likes pbuk
  • #22
artis said:
One more thing , I searched for the parts you mentioned in farnell since I will be shipping from there but sadly the N mos is out of production or at least not available, either way , what would be the typical needed gate voltage to reliably drive these small fets?
Try eBay or Aliexpress.
Their gates switch between zero and 2.5 volts. But you need to look at the region with Isd = 10 mA, so you might get away with less.

You wrote that you did not want a LED chaser, but now you do.
Save power by lighting the minimum number of LEDs.
 
  • #23
DaveE said:
This is a great example of why Silicon Valley invented programmable logic 30 years ago or so. I can assure you that virtually no one in industry would design this with discrete logic ICs today. Take your pick CPLD, FPGA, uC, etc. All can be simple programmable solutions to digital design.
That is all true, I can drive such shift register IC's from a simple arduino just using 3 pins, my case though is different I have a 8cm diameter board that has to fit onto a rotor that will rotate. This excludes all complicated circuits and many parts and also excludes data cables etc.
I will be making a simple circuit with a small Lithium battery reused from a "throw away" E cigarette (God I hate those idiotic things...)It's 3.7v just about right for me. My friend smokes them so I collect them and give them to recycling when my bags are full of E waste, but sometimes I get some spares too.

Baluncore said:
You wrote that you did not want a LED chaser, but now you do.
Save power by lighting the minimum number of LEDs.
No Baluncore I haven't changed my mind I still don't need a LED chaser, but since probing the switching sequence of so many fets at once would be rather difficult I imagine just having the LED's as a visual confirmation of my sequence before I tweak the rheostat to make them switch so fast my eyes won't be able to see them anymore.
 
  • #24
DaveE said:
This is a great example of why Silicon Valley invented programmable logic 30 years ago or so. I can assure you that virtually no one in industry would design this with discrete logic ICs today.
And nor would any hobbyist (except to prove a point).
artis said:
This excludes all complicated circuits and many parts and also excludes data cables etc.
Here is a picture of a microcontroller module. No complicated circuits or data cables (once you have programmed it). Count the holes and see how much of your 8cm diameter it will take up compared to the 30 FETs, 4 x 8bit shift registers, 60 wires to whatever you are switching, 30 indicator LEDs and 30 resistors you are going to need however you control them. And what are you switching?
1667339232812.png
 
Last edited:
  • Like
Likes anorlunda
  • #25
artis said:
That is all true, I can drive such shift register IC's from a simple arduino just using 3 pins, my case though is different I have a 8cm diameter board that has to fit onto a rotor that will rotate. This excludes all complicated circuits and many parts and also excludes data cables etc.
I think you've missed my point. Programmable logic is smaller and simpler for the designer. It often works better too. It's neither hard to do or very expensive. But you do have to get over a learning curve. Once you are familiar with a product family and know the development tools (some of which aren't too expensive), your next design becomes really easy. For example, you wouldn't need LEDs to debug if you had a simple simulator, most of that can be done before you even program the device. I think this would be a great design to do with a CPLD and VHDL or Verilog as a learning experience, but that betrays the product family I am/was most familiar with. Their are a bunch of good choices.

Also, have you looked into ICs dedicated to scanning keyboards? I don't know much about them, but that sounds like what you are doing. Of course they will all be old tech and may be hard to buy now, the more special purpose ICs go away soonest.
 
  • Like
Likes pbuk
  • #26
Just a thought. A small, SPI or I2C capable microcontroller with some IO expanders?
Quite an overkill and no elegance to speak of, but around the fastest to build, with low component count.
 
Last edited:
  • Like
Likes DaveE
  • #27
Well I currently went for a TLC555CP and 4x 74HC595 chips to get a combined output of 32.
the most complicated thing so far I've found to be the designing of a proper PCB and routing of the 4 shift register IC's , the 555 timer circuit is very simple and requires only few components.
I would need the 4 shift registers also if I used a MCU I think, after all they "expand" the few IO outputs to many more.

The thing that would be easier though is to control the sequence as @DaveE and others already said.

I'm designing a small Kicad PCB now, let's see how it goes for me, if anyone does care I might come back and post my results.
 
  • Like
Likes Averagesupernova
  • #28
You could try this approach if you need to build only one, or perhaps as a prototype.

If you are using thru-hole parts and are real handy with a soldering iron and fine wire, you don't need an actual PC Board.

For fine-gauge wire you can use a single strand from stranded hookup wire.

The component pins can be inserted thru the holes in a prototyping board and bent over.
(https://www.google.com/search?hl=en...0...1ac.1.34.heirloom-hp..0.8.512.8J3M-NDbjtw)

Doing the board layout is still a good start -- it's often a lot easier to get the component placement right.

Cheers,
Tom
 
  • #29
Tom.G said:
If you are using thru-hole parts and are real handy with a soldering iron and fine wire, you don't need an actual PC Board.

For fine-gauge wire you can use a single strand from stranded hookup wire.

The component pins can be inserted thru the holes in a prototyping board and bent over.
You can glue components on their back, to any surface, then join the legs that are in the air, with fine wire. That is called "dead bug style".
 
  • Like
Likes Tom.G
  • #30
Baluncore said:
You can glue components on their back, to any surface, then join the legs that are in the air, with fine wire. That is called "dead bug style".
And after such an approach I'm sure one has to debug the hell out of that dead bug... :D
 
  • #31
Especially after you lose track of where Pin 1 is!
 
  • #32
So I made the 32 bit chaser. It uses a 555 timer in astable mode and 4 74hc595N chips.

Just one tiny problem, I have connected my N mosfets directly to the 595 outputs, for whatever reason I cannot get hem to shut off when the outputs go low.
I measured that each 595 output when OFF measures about 18 ohm to ground.

So either I need pulldown resistors for each gate or I have managed to thermally damage one of my 32 fets while soldering. These are the small TO-251AA devices where you solder the backplate - drain.
I was careful but who knows.
So I guess I'm asking whether a 595 output can effectively drive a fet without a pulldown resistor or does it need one?
 
  • #33
What is the part number of the MOSFETs you are using?
What are the supply voltages to the 555 and 74hc595?
What is power supply to the LEDs?
What limits LED current?
 
  • #34
Baluncore said:
What is the part number of the MOSFETs you are using?
What are the supply voltages to the 555 and 74hc595?
What is power supply to the LEDs?
What limits LED current?
Fet's are IRLR8256TRPBF - TO-252AA type package

The supply voltage given that the 595 max is 6 volts is about 5.7v from a 6v battery , same voltage goes to 555 timer. When 595 output goes high I observe around 5.5v on gate which is sufficient for these small fets to turn on and they are ON the problem is - all the time...

Each LED connected to each 595 output is in series with 750ohm to ground.

So it's 595 output ---LED---resistor----GND.
The gate is attached between the 595 output and LED , so directly to the 595 output which should discharge the gate charge to ground when it goes LOW.
Or so I thought.
 
  • #35
artis said:
I'm asking whether a 595 output can effectively drive a fet without a pulldown resistor
Yes. HC logic can pull hard to ground with it's MOS output.
 

Similar threads

Back
Top