Circuit to extend time between on/off - Page 1
Forum section: electronics / beginners

author: Gar
author_rank: Newbie
timestamp: September 22, 2018, 09:31:03 pm
content: 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.

author: rstofer
author_rank: Super Contributor
timestamp: September 22, 2018, 10:03:12 pm
content: 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/2377Once 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.

author: ocset
author_rank: Super Contributor
timestamp: September 23, 2018, 08:33:08 am
content: 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/0859343944If 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.

author: Ian.M
author_rank: Super Contributor
timestamp: September 23, 2018, 08:56:29 am
content: 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 athttps://www.gooligum.com.au/PIC-tutorialsThey 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.pdfhttps://www.gooligum.com.au/devboards/base-mid/Motor-control_parts.pdfYou will also need a PIC programmer - a PICkit 3 is probably still the best compromise between price and range of parts supported.

author: Zero999
author_rank: Super Contributor
timestamp: September 23, 2018, 02:22:52 pm
content: 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 secondshttps://www.eevblog.com/forum/beginners/pulse-extender-circuit/msg1090005/#msg1090005EDIT: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

author: rstofer
author_rank: Super Contributor
timestamp: September 23, 2018, 05:09:58 pm
content: 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

author: Zero999
author_rank: Super Contributor
timestamp: September 23, 2018, 05:28:00 pm
content: Quote from: rstofer on September 23, 2018, 05:09:58 pmIt 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.