Author Topic: Circuit to extend time between on/off  (Read 1163 times)

0 Members and 1 Guest are viewing this topic.

Offline GarTopic starter

  • Newbie
  • Posts: 2
Circuit to extend time between on/off
« on: September 22, 2018, 09:31:03 pm »
Hi.
Hoping someone can point me to an IC for the following.
I need a simple 3v I/O circuit that will do the following:
I have a simple switch that is time based . When it switches on,
It will stay on anywhere between one second to 12 seconds (or more) until it shuts off.
I need to output , simultaneously, an on to off time interval based on that length of time plus x seconds.
For example, lets say the Input switch On to Off time interval is 6 seconds.  I may want to run the Output switch on to off time interval an additional  6 seconds for a total time of 12 seconds. I would like to set that time extension via a pot. The next "run" may be a 7 second input and the output would either double that time or run a constant set time extension of 6 seconds. 14 seconds or 13 seconds total interval time respectively.

I hope this makes sense.
If not please ask for clarification and any help will be very much appreciated.
 

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 9890
  • Country: us
Re: Circuit to extend time between on/off
« Reply #1 on: September 22, 2018, 10:03:12 pm »
You have a digital input, an analog input and a digital output from your black box.  I would use a microcontroller if for no other reason than to accommodate 'feature creep'.  I would not waste my time trying to develop some analog setup using 555 timers and such.

So, given that Arduino is the easiest microcontroller to get started with and given that this system probably wants to work on 3.3V, I might pick the Arduino Pro Mini 328 and the required USB->Serial adapter.

https://www.adafruit.com/product/2377

Once I had it working, I could dump the prepackaged board and design something that just used the chip.  Or not, I have been known to mount these stamp boards right on top of a daughter board that handled or provided the peripherals.

Basically, your code would look for the input going true and, as quickly as possible, set the output.  Now would be a good time to read the analog port and figure out how much time to add.  Then continue to look for the input to go false and then start a count-down timer.  When it times out, clear the output.

There is a millis() function for timing to milliseconds using an internal system timer or you can set up one of the hardware timers.

For the analog bit, you need to read the pot voltage and use some equation to convert volts to time.

I am sure there are analog solutions for this.  I tend to focus on digital solutions and I'm really fond of the Arduinos, particularly for new users.
 

Offline ocset

  • Super Contributor
  • ***
  • Posts: 1516
  • Country: 00
Re: Circuit to extend time between on/off
« Reply #2 on: September 23, 2018, 08:33:08 am »
Yes, its a job for a micro, either Arduino, which i confess is very good, or a PIC...if you dont know PICs then the book by Babani on microcontrollers is a great starter for learning microcontrollers. Its only a small book.
You can use microchips free c compiler....or just use assembler code.

https://www.amazon.co.uk/Introduction-PIC-Microcontrollers-BP/dp/0859343944

If you do use a PIC, then microchips web forum will sometimes help you if the code doesnt work and you want some advice...you can post your code there.
« Last Edit: September 23, 2018, 08:35:32 am by treez »
 

Offline Ian.M

  • Super Contributor
  • ***
  • Posts: 12860
Re: Circuit to extend time between on/off
« Reply #3 on: September 23, 2018, 08:56:29 am »
Microchip's forums suck - there are lots of knowledgeable and helpful people there, but the forum engine itself is a reeking turd + it interacts badly with Microchip's corporate firewall, so your post can get rejected for no apparent reason.   

Its generally worth asking novice to intermediate level PIC questions here, just to avoid the pain of using the Microchip forum.

To get started with low-end PICs I recommend the tutorials at https://www.gooligum.com.au/PIC-tutorials
They are payware, but about 50% of the course, starting from the beginning is available as free samples. (registration required)
Its easier to follow the course with the Gooligum training board, but the whole course can be done on a large solderless breadboard + these parts: https://www.gooligum.com.au/devboards/base-mid/Base-mid_dev_parts.pdf
https://www.gooligum.com.au/devboards/base-mid/Motor-control_parts.pdf

You will also need a PIC programmer - a PICkit 3 is probably still the best compromise between price and range of parts supported. 
 
« Last Edit: September 23, 2018, 08:58:14 am by Ian.M »
 

Online Zero999

  • Super Contributor
  • ***
  • Posts: 19522
  • Country: gb
  • 0999
Re: Circuit to extend time between on/off
« Reply #4 on: September 23, 2018, 02:22:52 pm »
One of the the old ways is to use a comparator IC such as the LM393. The time delay is equal to about 1.1*R5*C1.

Changing C1 to 68µF would give a delay of about 7.5 seconds

https://www.eevblog.com/forum/beginners/pulse-extender-circuit/msg1090005/#msg1090005

EDIT:
Don't use the LM393 for a supply voltage of 3.3V, the common mode range is insufficient. Use the LMV393.
http://www.ti.com/lit/ds/snos018h/snos018h.pdf
« Last Edit: September 23, 2018, 02:57:21 pm by Hero999 »
 

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 9890
  • Country: us
Re: Circuit to extend time between on/off
« Reply #5 on: September 23, 2018, 05:09:58 pm »
I wonder how U1 is going to react to sinking the current from the capacitor with no limiting resistor?  According to the block diagram, the output stage is a simple open collector NPN transistor.

http://www.ti.com/lit/ds/snos018h/snos018h.pdf

 

Online Zero999

  • Super Contributor
  • ***
  • Posts: 19522
  • Country: gb
  • 0999
Re: Circuit to extend time between on/off
« Reply #6 on: September 23, 2018, 05:28:00 pm »
I wonder how U1 is going to react to sinking the current from the capacitor with no limiting resistor?  According to the block diagram, the output stage is a simple open collector NPN transistor.

http://www.ti.com/lit/ds/snos018h/snos018h.pdf
It will most likely go into the linear region and act like a constant current sink, causing the capacitor to rapidly discharge. The short circuit current of the output isn't specified but it'll probably be in the region of 100mA tops, the energy stored in the capacitor with a 3.3V supply is tiny E = 1/2CV2 = 0.5*68×10-6*3.32 = 370×10-6J and R5 severely limits the power, so nothing bad will happen.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf