creating 1x16 logic or 2x8 logic and combining them

Go To Last Post
42 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi

I am working in a project where I will have two inputs (clock & reset pin) which is used to trigger a group of relays (lets say around 16) sequentially.

RESET is used to turn the system ON & CLOCK is used to toggle through the outouts.

I also want to have a dip switch which will let me trigger these relays in two different combination logic.

  1. Sequential turning ON each relay one at a time (eg: 1x16 combo)
  2. Sequential turning ON each  relay two at a time (eg: 2x8 combo)

 

So far I have two designs 

1. D flip flop & serial-parallel ic (Static shift register) 4015 to create a 1x16 logic

 

2. same component as above but slight modifying the wiring to create 2x8 logic instead. But here the output wires are changed alternating between each of the individual shift registers so cannot be easily reused with the above circuit. :(

 

3.slightly different approach using D flip-flop, binary counter & 4-to-16 Line Decoder for 1x16 logic

 

My questions:

  1. what is the best way to approach this problem? Maybe there are other ICs that can achieve this more easily?
  2. Basically the same as above, how do I combine the 1x16 logic & 2x8 logic circuits in the simplest way? I want to use my design 1 & 2 (the one with shift registers ) if possible but I just can't figure out the way to combine these two and make it select-able with something like a DIP switch?

 

BTW i haven't shown any relays in the attached schematics for simplicity. FYI I will be combining these outputs with darlington transistor array IC to drive the relays.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Shall we ignore Ciricuit-3 because it isn't functionally identical to the shift register designs? (The shift register designs can energise multiple relays whereas the binary decoder can only energise one at a time.)

 

To combine Ciricuit-1 & Ciricuit-2 into a single "dual function" circuit is fairly straightforward in that you need some steering logic to direct either the ShiftReg Data input (you labelled it 5V) or U7,Q3 onto U7B,D.

 

I might hand draw something later. No I won't. It's as trivial as a 2-input MUX.

 

Last Edited: Sun. Jun 12, 2022 - 08:59 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I can not help you because of U9A. May I ask you WHY this D-flop is installed, please. Remove them, and we can discuss the rest.

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi

I can create a steering logic to change the shift register data pin from Circuit 1 to Circuit 2 . However there is also the difference between the output pins order in circuit 1 & 2 .

Circuit 1 output order Q0,Q1,Q2,Q3 (from 1st shift register) Q0,Q1,Q2,Q3 (from 2nd shift register),... and so on

Circuit 2:Output order: Q0,Q0,Q1,Q1,Q2,Q2,Q3,Q3.... and so on (i.q. Q0 form first, Q0 from 2nd etc..)

 

I hope this was clear???

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

HI grohote

I am using the D flip flop to make sure that the first serial data input D for the shift register is one '1' bit at first clock cycle and then stays zero after the first clock cycle. This causes the output to only have one 1 that cycles through its output channels.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

 Maybe there are other ICs that can achieve this more easily?

It's called an AVR. 

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

eaterbugs wrote:
one at a time

 

Well, if one at time, then a natural solution is to use HC138, perhaps HC238, or CD4051, or CD4067.

 

Using them, you will have no problems 'with a first relay choice'.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

grohote wrote:
May I ask you WHY this D-flop is installed

I also missed the U9 purpose, though did wonder why the !Q output was used.

eaterbugs wrote:
However there is also the difference between the output pins order in circuit 1 & 2 .

In that case let's work on Circuit3.

  • U4 4514, 4-to-16 line decoder, it has an inhibit control line.
  • Add two 3-to-8 line decoder, also with inhibit control line in parallel. Combine the Q outputs as desired on the connector.
  • Add control signal to enable either U4 or the two extra decoders. (The 3-to-8 line decoders are enabled together)
  • Never enable both U4 and any 3-to-8 line decoder together.

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Don't write ambiguously: Sequential turning ON each relay one at a time

 

Do you mean #1 or #2

1) After each clock only one output is on, sequentially from chan 0 to chan 15

2) After each clock one additional output is on, sequentially from chan 0 to chan 15

 

Either of these match your description!!

 

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Once you've added up the cost for all this logic you may well have just bought a micro-controller. It would be cheaper.

You can keep the RESET and CLK inputs if you wish; or upgrade to a simple communications channel (over UART) with basic commands for selecting 8/16 channel operating mode & relay output combinations.

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

N.Winterbottom wrote:
4514

 

This, and I remember also CD4017 counter-demux which was very popular for LED project, back in times before of AVR.

 

Use Tiny88 board with 26 I/O pins which is sell under a name Nano3 for a total of $2.5, see my post here.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

avrcandies wrote:

 Maybe there are other ICs that can achieve this more easily?

It's called an AVR. 

If I used Attiny Then 595 Is the first choice.

www.tokopedia.com/madagang .Buy and Donated cheap electronics and manuscripts.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Minor question about your relays.  Do they drive nice from the 5V supply through a CD or LS chip?  Usually I'd put in a relay driver chip between the logic and the relay, although there are chips that do both:  See TI's DRV8860* chips - serial interface, parallel output drivers (and I mean DRIVERS - these things have some hefty power clout to throw around relay coils.  You will want that, unless we're talking solid state relays or something).

 

You'll want an AVR to drive the serial interface.  blush  S.

 

* And, wonder of wonders, they're actually in stock at Digikey, for less than $5 a pop!

https://www.digikey.com/en/produ...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I would just use an avr as well.
 

The clock goes into the avr, and then it can drive 16 outputs in whatever sequence you want.

 

You could connect some dip switches to some other inputs to cause different sequences to be selected. 
 

Whatever solution you go for….. good luck sourcing parts!

regards
Greg

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

N.Winterbottom wrote:

grohote wrote:

May I ask you WHY this D-flop is installed

 

I also missed the U9 purpose, though did wonder why the !Q output was used.

 

eaterbugs wrote:

However there is also the difference between the output pins order in circuit 1 & 2 .

 

In that case let's work on Circuit3.

  • U4 4514, 4-to-16 line decoder, it has an inhibit control line.
  • Add two 3-to-8 line decoder, also with inhibit control line in parallel. Combine the Q outputs as desired on the connector.
  • Add control signal to enable either U4 or the two extra decoders. (The 3-to-8 line decoders are enabled together)
  • Never enable both U4 and any 3-to-8 line decoder together.

 

I am also thinking of combining the two separate logics and enabling only one logic circuit at at time depending on which logic circuit I choose. However my worry if if these circuit cannot be put on high impedance state won't it affect the ics which will have an input in their output pins. Do I need to find the ICS which specify 3-state modes OR is it not required?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yes, you will need outputs that can be tri-stated.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

In other words: an AVR.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

grohote wrote:

In other words: an AVR.

PIC became AVR owner.

www.tokopedia.com/madagang .Buy and Donated cheap electronics and manuscripts.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

     PIC became AVR owner.

 

Did we experience anything bad? Au contraire...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thank you for phrasing that way instead of "PIC owns AVR"smiley

Verb | own - Wiktionary

3. (transitive) To defeat or embarrass; to overwhelm.

I will own my enemies.

If he wins, he will own you.

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I am also thinking of combining the two separate logics and...

WHY?  Just use an AVR with 16 or more IO. Don't you use AVRs (this is the AVR forum)

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

avrcandies wrote:

I am also thinking of combining the two separate logics and...

WHY?  Just use an AVR with 16 or more IO. Don't you use AVRs (this is the AVR forum)

2 reasons:

  1. Difficult to source microcontrollers in the current market, found these logic gates IC easily stocked. Main reason
  2. not sure the best way to implement the incoming clock rising pulse to trigger shifting of the bits (by 1 OR by 2) of the PORT output pins? Use external interrupt for clock? Check the Reset Input is high before shifting the bits or do nothing??Just found these logic gates simpler to implement.
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0



  1. Difficult to source microcontrollers in the current market, found these logic gates IC easily stocked. Main reason

That is barely a reason, you can always order some chips off ebay...otherwise you create a mess of gates

 

You could use an EPROM as a decoder (need 16 bit type) 

You could use a GAL22V10 -type solution (with 16 output sized chip).  This would prob be much more $$ than just using an AVR (even gates would be more $$ than an AVR)

 

plenty avail...now no excuse

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

eaterbugs wrote:

2 reasons:

  1. Difficult to source microcontrollers in the current market, found these logic gates IC easily stocked. Main reason
  2. not sure the best way to implement the incoming clock rising pulse to trigger shifting of the bits (by 1 OR by 2) of the PORT output pins? Use external interrupt for clock? Check the Reset Input is high before shifting the bits or do nothing??

 

Just found these logic gates simpler to implement.

Logic can be simpler for simple easily defined tasks, but you have already found your dual use / mode change spec complicated things and exploded the BOM.

When that happens, you may be better to sketch what you want in logic, but implement it in a microcontroller.

 

How many of these do you need ?  An alternative to roll your own PCB, is to use a low cost eval module.

 

 

eaterbugs wrote:
BTW i haven't shown any relays in the attached schematics for simplicity. FYI I will be combining these outputs with darlington transistor array IC to drive the relays.

Keep in mind there are shift register families that can drive relays.

 

addit:

 

eaterbugs wrote:

I am also thinking of combining the two separate logics and enabling only one logic circuit at at time depending on which logic circuit I choose. However my worry if if these circuit cannot be put on high impedance state won't it affect the ics which will have an input in their output pins. Do I need to find the ICS which specify 3-state modes OR is it not required? 

 

Rather than duplicate things and merge the outputs, you could use a shift register approach, and change the D pattern to what your modes need,  eg from 1-hi to 2-hi

 

 

Last Edited: Thu. Jun 23, 2022 - 05:19 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

trigger a group of relays

Why do you need relays? Sounds like there will be a lot of flipping. Relays wear out, so use mosfets if possible (of course, for AC relays are helpful). 

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0


I've managed to get the Logic gates IC circuit working (in simulator at least) using two decoders and triggering either/both depending on the mode from a D flip flop. I can include a simulator schematic later if anyone want to look at it.

However, since everyone suggested using a avr, I am trying to create same project on avr. For simulating and testing I've started to work on ATMEGA328p, ideally later i'll port it out on ATTINY when the programmig logic is finalised.

 

 

I've also added CLOCK & RESET Outputs so that this can be used to cascade multiple units.

My concept is below:

  • CLOCK input (5V nominal): it needs to be min. 1ms long to (needs to be even longer to actuate relay contacts around 5-10ms, but just for advancing channels to select particular relay maybe 1ms is okay). R15 & C7 as low pass filter (cutoff 1.061KHz). Also R15 series resistor provides some protection if the clock is driven when the circuit is powered off?? R17 pulldown resistor to ensure CLK is always LOW. It goes through Schmitt trigger U23 to Uc.
  • RESET IN (5V, active HIGH): R16 is pulldown resistor. R15 & C7 low pass filter. RESET needs to be high for the circuit to work for longer time so just increased R16 to 100K with cutoff freq of 160Hz. Again hoping R16 also provides protection if reset is driven when the circuit is powered off??
  • SW2 is a dip switch which selects the relay logic mode (1x16 OR 2x8 mode) after the reset is HIGH and the uC is running.It goes through Schmitt trigger U23 to Uc.
  • CLK out & RESET Out are cascading outputs (uC C4 & C5 PIN outputs for CLOCK & RESET pin when the relays have clocked through to the end. So the user can add another unit and use these for outputs as CLOCK & RESET inputs for the second unit. Used R13 & R14 as series resistors for protection if they are accidentally driven LOW/HIGH unintentionally. These outputs are cascaded by the Cascade Enable pins through a Schmitt trigger AND gate U23.

 

Program logic

  • when RESET pin is HIGH, uC starts up.
  • INT0 is interrupt on rising edge to detect the incoming CLOCK pulse.
  • Mode Selector input D3 pin is check to determine the mode (2x8 OR 1x16).
  • each CLOCK input pulse increases the counter which advances the relay based on the mode selection.
  • Once the last relays have been reached, the next clock advance makes all relays OFF and sends the RESET & CLOCK outputs to he RESET & CLOCK OUT pins for adding another unit if required. Disables the interrupt INT0.
  • Whenever the RESET is driven low at the end (or anytime)), everything resets.All relays are OFF. uC is supposed to sleep. I know this just makes the uC enter high impedance state and probably not the best option for minimal current consumption/protected?? Ideas/suggestions?

 

Below is my code:

#include<avr/io.h>
#include<avr/interrupt.h>
#include<util/delay.h>

volatile int x=0;

unsigned int SNG[16]={0b00000001,0b00000010,0b00010000,0b00100000,0b01000000,0b10000000,0b00000001,0b00000010,0b00000100,0b00001000,0b00010000,0b00100000,0b00000001,0b00000010,0b00000100,0b00001000};
unsigned int DBL[8]={0b00000011,0b00110000,0b11000000,0b00000011,0b00001100,0b00110000,0b00000011,0b00001100};


ISR (INT0_vect)          //External interrupt_zero ISR
{
	//cnt_zero++;
	x=x+1;
  
}


int main()
{
	DDRD=0b11110011;
	DDRB=0b00111111;
	DDRC=0b00111111;
	
		
	EIMSK=0b00000001;	 //enable INT0 INT1 interrupt
	EICRA=0b00000011; //INT0 on rising edge, INT 1 any logical change

	PORTD |= 0b00001000;	//Pull ups on INT 1 (PD3)
	sei();     // Enable global interrupts by setting global interrupt enable bit in SREG
	
	while(1)
	{
		if ((PIND & 0b00001000)==0) 	// Check for switching mode, LOW= 1x16 mode
		{
		switch (x)
		{
			case 1 ... 6:
			PORTB=0x00;
			PORTC=0x00;
			PORTD=0x00;				//not sure this is needed to ensure that relays are off before advancing another channel
			PORTD=SNG[x-1];
			break;
			case 7 ... 12:
			PORTB=0x00;
			PORTC=0x00;
			PORTD=0x00;
			PORTB=SNG[x-1];
			break;
			case 13 ... 16:
			PORTB=0x00;
			PORTC=0x00;
			PORTD=0x00;
			PORTC=SNG[x-1];
			break;
			case 17:
			PORTB=0x00;
			PORTC=0x00;
			PORTD=0x00;
			PORTC=0b00110000;		// Enable RESET & CLOCK out
			cli();
			
		}
		}
		else 			// Check for switching mode, HIGH= 2x8 mode
		{
			switch (x)
		{
			case 1 ... 3:
			PORTB=0x00;
			PORTC=0x00;
			PORTD=0x00;
			PORTD=DBL[x-1];
			break;
			case 4 ... 6:
			PORTB=0x00;
			PORTC=0x00;
			PORTD=0x00;
			PORTB=DBL[x-1];
			break;
			case 7 ... 8:
			PORTB=0x00;
			PORTC=0x00;
			PORTD=0x00;
			PORTC=DBL[x-1];
			break;
			case 9:
			PORTB=0x00;
			PORTC=0x00;
			PORTD=0x00;
			PORTC=0b00110000;		// Enable RESET & CLOCK out
			cli();
		}
		}
	}

}

Any ideas/advice is highly appreciated.

Also I am thinking of using protection diodes ( transzorbs) limiting clock & reset & 12V & GND  to 16V as the system will get external 12V inputs and will use a 5V LDO to supply 5V VCC.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Why do you need relays---why can' t you use FETs, which will never wear out?

 

You don't need all of that gummy reset haywire, just 2 signals going from one AVR to the next one: A reset request signal (prob not the processor reset pin) and a "tick"/advance signal

Remember, 328pb has a few extra IO pins for your pleasure.

 

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

Last Edited: Fri. Jul 1, 2022 - 01:12 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

avrcandies wrote:

Why do you need relays---why can' t you use FETs, which will never wear out?

mainly due to Low contact resistance for sensitive measurements. I can look into the semiconductor optorelays OR FETs but that's for later, once everything else is sorted.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

for sensitive measurements. 

Oh, you never mentioned measuring anything...sounded like you are building a light sequencer...some lights turning on from end to end or split into two halves---lots of wear & tear.   

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

...and you could have saved a truckload of money by inverting the logic for the "mode selector" and use the internal pull up resistor of the AVR instead of R19...... cheeky

John Samperi

Ampertronics Pty. Ltd.

https://www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

avrcandies wrote:

You don't need all of that gummy reset haywire, just 2 signals going from one AVR to the next one: A reset request signal (prob not the processor reset pin) and a "tick"/advance signal

Remember, 328pb has a few extra IO pins for your pleasure.

My logic for using U23(Schmitt trigger AND gate IC) was 3 fold. In the order of priority:

  • Schmitt trigger for CLK & RESET inputs/outputs.
  • Easy to send the CLK & RESET out (using the AND gate logic) once the clocking has reached the end. Just made the programming simpler in uC. Less chances of things failing when uC is looking at interrupts and such. I am not confident enough to code the uC to pass the CLK pulse through the uC acting as passthrough at at the end. So just bypassing the same CLOCK out using the AND logic seemed to make more sense. RESET part was simpler, just used similar logic as CLOCK as one extra AND gate was spare. Any ideas/suggestions highly appreciated.
  • Some sort of isolation between uC & Input/Output pins. Maybe a lame thought on my part but dunno, it just felt like U23 was some sort of extra protection buffer. :)

 

regarding having the RESET pin not attached to actual RESET of uC, I thought about it, but this approach again made things look simpler (fully understand that it may cause more chaos, higher power drain, lot more issues. So ideas please).

 

But I am not sure about the best approach to make sure that the uC go to standy mode (kinda like resetting everything ) when RESET input is low. Thought about using one input pin of uC and attach it to interrupt at logic low. Making sure all outputs are zero and INT0 interrupt is OFF . But what happens when this is HIGH, how do I make sure that the uC starts from beginning?? I hope this clears up my confusions.

Last Edited: Fri. Jul 1, 2022 - 01:42 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

js wrote:

...and you could have saved a truckload of money by inverting the logic for the "mode selector" and use the internal pull up resistor of the AVR instead of R19...... cheeky

truckloads indeed.. cheeky

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I am not confident enough to code the uC to pass the CLK pulse through the uC acting as passthrough at at the end.

Why?  Are you worried about 10 microseconds delay??? Even 10ms or maybe even 50ms would be fine. These are relays, not GHz radar transistors.

 

What is the voltage level of the signals you need to switch?  microvolts? mv? Relays are good if you need the high isolation from external influences.   16 seems like a lot of relays.  

Can you use quad (or octal) analog switches instead? They won't have quite the same chan-chan isolatiion, but may suffice.

https://www.onsemi.com/pdf/datas...

 

What relays?  Relays for sensitive, low signals, have different contacts than relays for a motor or powering something (which can fail from too little current flowing).  Take a look at reed relays for signals.  

 

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

Last Edited: Fri. Jul 1, 2022 - 03:02 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

avrcandies wrote:

I am not confident enough to code the uC to pass the CLK pulse through the uC acting as passthrough at at the end.

Why?  Are you worried about 10 microseconds delay??? Even 10ms or maybe even 50ms would be fine. These are relays, not GHz radar transistors.

 

What is the voltage level of the signals you need to switch?  microvolts? mv? Relays are good if you need the high isolation from external influences.   16 seems like a lot of relays.  

Can you use quad (or octal) analog switches instead? They won't have quite the same chan-chan isolatiion, but may suffice.

https://www.onsemi.com/pdf/datas...

 

What relays?  Relays for sensitive, low signals, have different contacts than relays for a motor or powering something (which can fail from too little current flowing).  Take a look at reed relays for signals.  

 

I am thinking of using a signal relay (something like this).

TXS2SA-L-4.5V-1

 

eDIT: Its meant to be TXS2SA-4.5V-1

Last Edited: Fri. Jul 1, 2022 - 04:53 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

eaterbugs wrote:

regarding having the RESET pin not attached to actual RESET of uC, I thought about it, but this approach again made things look simpler (fully understand that it may cause more chaos, higher power drain, lot more issues. So ideas please).

 

But I am not sure about the best approach to make sure that the uC go to standy mode (kinda like resetting everything ) when RESET input is low. Thought about using one input pin of uC and attach it to interrupt at logic low. Making sure all outputs are zero and INT0 interrupt is OFF . But what happens when this is HIGH, how do I make sure that the uC starts from beginning?? I hope this clears up my confusions.

 

You should read the docs about what the mcu RESET pin does, as for a simple design like this, you may be able to use the MCU reset to do exactly what you need.

Failing that, you can code a pin-RST into your logic, by simply testing it in many wait places and exit when low. That allows you to terminate any partly-done action, and then you restart from a known point what Pin-RST is released.

 

eaterbugs wrote:

I am thinking of using a signal relay (something like this).

TXS2SA-L-4.5V-1

That's a latching relay - is that what you meant to use ? They are lower power, as they can be impulse driven, but they are more complex to drive needing separate close and release impulses.

Some use 3 terminals and some reverse the coil voltage.

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

TXS2SA-L-4.5V-1

 

1 coil latching type   ---'EH??   you say you  want to keep it locked forever???  I believe it requires reverse polarity to open (I didn't find the details)  ...use nonlatching 

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

avrcandies wrote:

TXS2SA-L-4.5V-1

 

1 coil latching type   ---'EH??   you say you  want to keep it locked forever???  I believe it requires reverse polarity to open (I didn't find the details)  ...use nonlatching 

MY BAD! surprise Carelessness got the best of me! :D

It was meant to be Non latching type : TXS2SA-4.5V-1

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi

just wondering if anyone had any improvements ideas/comments on my above approach (circuit &code). Especially:

  1. Input/output  CLK & RESET pin protections
  2. alternate way to implement RESET while keeping the system responsive enough to detect the change in RESET input (when not connecting it to uC RESET pin)
  3. As it stands can i make it so that the RESET input can be higher than 5V ( between 3-8v) ?
  4. i am thinking of using internal oscillator. What is the minimum oscillator speed that i can apply in my code to ensure that i can detect and process a 1ms ling clock . I definitely will not be needing to detect anything smaller than 1ms.
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

What is the minimum oscillator speed 

Why do you need some super slow AVR clock speed??...use 8 MHz, 10 MHz 16MHz, whatever.

 

You seem rather mixed up.   

1ms ling clock 

Are you talking about only 1 KHz  signal?   Be clear when you are talking about the AVR processor clock and when you are talking about your own signal.

Clock is preferably given in freq , pulse width (or clock pulse width, or clock pulse) is given in time.

 

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

Last Edited: Sat. Jul 2, 2022 - 06:18 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

avrcandies wrote:

What is the minimum oscillator speed 

Why do you need some super slow AVR clock speed??...use 8 MHz, 10 MHz 16MHz, whatever.

 

You seem rather mixed up.   

1ms ling clock 

Are you talking about only 1 KHz  signal?   Be clear when you are talking about the AVR processor clock and when you are talking about your own signal.

Clock is preferably given in freq , pulse width (or clock pulse width, or clock pulse) is given in time.

 

 

sorry for confusions. My idea is the minimum CLOCK pulse width should be no smaller than 1ms long. So, i should be able to at least detect and action (count the advances of relay) on this pulse.
I do not want to use external oscillator as i don’t think its needed for my project( size, cost etc),  also maybe use ATTINY instead of atmega328p. So i was wondering what speed oscillator is needed in my project scenario while  making sure that the executed code is quick enough to work smoothly.

reason for wanting to optimise on oscillator freq. is to try and minimise power drain of the microcontroller as i assume lower freq. oscillator uses lower power??

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

reason for wanting to optimise on oscillator freq. is to try and minimise power drain of the microcontroller as i assume lower freq. oscillator uses lower power

Run it maybe at 1 MHz, even 8 MHz..you are driving 16 relays...the AVR power is miniscule.  

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Maybe one of these (PDIP, SOIC, SSOP, QFN), available on ebay as individual IC or mounted on breakout boards?

 

16-Bit I/O Expander

• MCP23016 – I2C interface

• MCP23017 – I2C interface
• MCP23S17 – SPI interface

 

16-Bit I/O Expander with Open-Drain Outputs

• MCP23018 – I2C interface
• MCP23S18 – SPI interface