Badcaps.net Forum
Go Back   Badcaps Forums > Electronics Theory and Troubleshooting > General Electronics Technical Discussion
Register FAQ Calendar Search Today's Posts Mark Forums Read

 
Thread Tools Display Modes
Old 12-06-2017, 10:56 AM   #121
stj
Great Sage 齊天大聖
 
stj's Avatar
 
Join Date: Dec 2009
City & State: Europe
My Country: some shithole run by Israeli agents
I'm a: Professional Tech
Posts: 16,839
Default Re: 555 countdown timer design question

btw, the ch341 adapters/chips are the best IMO, so tell your m8 to fuckoff!
stj is offline   Reply With Quote
Old 12-06-2017, 11:03 AM   #122
Dannyx
Badcaps Veteran
 
Dannyx's Avatar
 
Join Date: Aug 2016
City & State: Constanta
My Country: Romania
Line Voltage: 230VAC 50Hz
I'm a: Hardcore Geek
Posts: 910
Thumbs up Re: 555 countdown timer design question

Quote:
Originally Posted by stj View Post
isp needs a dedicated programmer - preferably a USBasp
Dumb question, but if they don't work for the purpose of programming the arduino, what are the MISO/MOSI etc pins on the CH341 adapter for ?

Caps ? Yeah I do (that would be 0.1uF right ? I suck at these )...I knew it from the start there's something fishy about that reset pin and even read something along those lines....

Yes, no question about it - that CH341 "crap" helped me a lot in the past years, ever since I became more confident in using it and discovered it can do many other things besides programming SPI chips (which might actually answer my first question right there), so I too didn't agree with him.
__________________
Wattevah...
Dannyx is offline   Reply With Quote
Old 12-06-2017, 11:05 AM   #123
Dannyx
Badcaps Veteran
 
Dannyx's Avatar
 
Join Date: Aug 2016
City & State: Constanta
My Country: Romania
Line Voltage: 230VAC 50Hz
I'm a: Hardcore Geek
Posts: 910
Default Re: 555 countdown timer design question

The schematic you posted also confirms I got the pinning right: TX to RX and vice versa, instead of RX to RX etc.
Dannyx is offline   Reply With Quote
Old 12-06-2017, 12:57 PM   #124
stj
Great Sage 齊天大聖
 
stj's Avatar
 
Join Date: Dec 2009
City & State: Europe
My Country: some shithole run by Israeli agents
I'm a: Professional Tech
Posts: 16,839
Default Re: 555 countdown timer design question

Quote:
Originally Posted by Dannyx View Post
Dumb question, but if they don't work for the purpose of programming the arduino, what are the MISO/MOSI etc pins on the CH341 adapter for ?
oh, you have the black eeprom programmer?
yes, that can do isp - if you use the right software.
(or maybe avrdude does that hardware - never looked!)
stj is offline   Reply With Quote
Old 12-06-2017, 01:00 PM   #125
Dannyx
Badcaps Veteran
 
Dannyx's Avatar
 
Join Date: Aug 2016
City & State: Constanta
My Country: Romania
Line Voltage: 230VAC 50Hz
I'm a: Hardcore Geek
Posts: 910
Talking Re: 555 countdown timer design question

Well it's not really black, but sure It's this. Still, I wanted to keep it as simple as possible, so I'll push on with the serial method since ISP seems tough to achieve with the arduino IDE...or at least I THINK so.

Back to that cap you asked about: should it go between RST and GND or something ? This programmer doesn't have a RST pin so I'm guessing that's the issue....
Dannyx is offline   Reply With Quote
Old 12-06-2017, 03:09 PM   #126
stj
Great Sage 齊天大聖
 
stj's Avatar
 
Join Date: Dec 2009
City & State: Europe
My Country: some shithole run by Israeli agents
I'm a: Professional Tech
Posts: 16,839
Default Re: 555 countdown timer design question

on the serial adapter it goes to one of the handshake lines.
your adapter is a bit lacking so you may need to solder to the chip pin.

what's the exact part number of the chip on that adapter?
Attached Files
File Type: pdf CH341DS1.pdf (187.5 KB, 1 views)
stj is offline   Reply With Quote
Old 12-06-2017, 03:59 PM   #127
Dannyx
Badcaps Veteran
 
Dannyx's Avatar
 
Join Date: Aug 2016
City & State: Constanta
My Country: Romania
Line Voltage: 230VAC 50Hz
I'm a: Hardcore Geek
Posts: 910
Default Re: 555 countdown timer design question

Quote:
Originally Posted by stj View Post
on the serial adapter it goes to one of the handshake lines.
your adapter is a bit lacking so you may need to solder to the chip pin.

what's the exact part number of the chip on that adapter?
I'll have a look...soldering won't be a problem, but can I continue to use it like normal like I have been so far even with that "cap hack" in place ? I don't want to "commit" the programmer solely for programming the arduino. I understand where you're going with this and I'm sure it'll eventually work, but I don't claim I 100% know what to do
Dannyx is offline   Reply With Quote
Old 12-06-2017, 06:28 PM   #128
stj
Great Sage 齊天大聖
 
stj's Avatar
 
Join Date: Dec 2009
City & State: Europe
My Country: some shithole run by Israeli agents
I'm a: Professional Tech
Posts: 16,839
Default Re: 555 countdown timer design question

no answers till i know what chip it uses - some dont have the extra signals
stj is offline   Reply With Quote
Old 12-07-2017, 03:15 AM   #129
Dannyx
Badcaps Veteran
 
Dannyx's Avatar
 
Join Date: Aug 2016
City & State: Constanta
My Country: Romania
Line Voltage: 230VAC 50Hz
I'm a: Hardcore Geek
Posts: 910
Red face Re: 555 countdown timer design question

It is a CH341A and here are some pics up close...damn I need a macro lens for my DSLR >_>
Attached Images
File Type: jpg 20171207_105106.jpg (387.4 KB, 5 views)
File Type: jpg 20171207_105041.jpg (394.8 KB, 5 views)
Dannyx is offline   Reply With Quote
Old 12-07-2017, 03:21 AM   #130
stj
Great Sage 齊天大聖
 
stj's Avatar
 
Join Date: Dec 2009
City & State: Europe
My Country: some shithole run by Israeli agents
I'm a: Professional Tech
Posts: 16,839
Default Re: 555 countdown timer design question

you need to connect the 100n cap between your programmer pin20 which usefully appears to connect to the green socket, to the reset pin on the arduino.
stj is offline   Reply With Quote
Old 12-07-2017, 03:24 AM   #131
stj
Great Sage 齊天大聖
 
stj's Avatar
 
Join Date: Dec 2009
City & State: Europe
My Country: some shithole run by Israeli agents
I'm a: Professional Tech
Posts: 16,839
Default Re: 555 countdown timer design question

btw, second picture, lower left.
5.1ohm resistor looks burned - did you try to power something big through the programmer, or short something??
stj is offline   Reply With Quote
Old 12-07-2017, 03:38 AM   #132
Dannyx
Badcaps Veteran
 
Dannyx's Avatar
 
Join Date: Aug 2016
City & State: Constanta
My Country: Romania
Line Voltage: 230VAC 50Hz
I'm a: Hardcore Geek
Posts: 910
Default Re: 555 countdown timer design question

Quote:
Originally Posted by stj View Post
btw, second picture, lower left.
5.1ohm resistor looks burned - did you try to power something big through the programmer, or short something??
Yes it does look like sh!t, I agree....never even noticed now that you mention it. No, I don't believe it got overloaded in any way and the resistor checks fine on my meter, so it's not faulty, plus the programmer works.

So I should place the cap between pin 20 and the reset pin ? Dumb question again, but what does the cap actually do ? Why not a piece of wire for instance ? Is a ceramic capacitor with 104 on it the right one ? I suck at these, I told you that

Last edited by Dannyx; 12-07-2017 at 03:46 AM..
Dannyx is offline   Reply With Quote
Old 12-07-2017, 04:10 AM   #133
Dannyx
Badcaps Veteran
 
Dannyx's Avatar
 
Join Date: Aug 2016
City & State: Constanta
My Country: Romania
Line Voltage: 230VAC 50Hz
I'm a: Hardcore Geek
Posts: 910
Thumbs up Re: 555 countdown timer design question

Ok, works perfectly now: that cap between pin 20 and the reset pin did the trick. Big shoutout to STJ for the help...here's the setup: the gray piece of wire stuck into the ZIF socket corresponding to pin 20 of the CH341 on the bottom goes to the cap and then the other end of the cap has another piece of wire stuck into the breadboard on the RST pin. A CD ROM audio cable came in very handy for fashioning a "programming cable" because I could just insert it straight into the TX/RX male headers on the CH341 without having to run individual jumpers and make a mess of wires everywhere
Attached Images
File Type: jpg 20171207_120334.jpg (403.4 KB, 2 views)
File Type: jpg 20171207_120327.jpg (408.2 KB, 1 views)
Dannyx is offline   Reply With Quote
Old 12-07-2017, 05:13 AM   #134
stj
Great Sage 齊天大聖
 
stj's Avatar
 
Join Date: Dec 2009
City & State: Europe
My Country: some shithole run by Israeli agents
I'm a: Professional Tech
Posts: 16,839
Default Re: 555 countdown timer design question

the real question is why you got this:
https://www.ebay.co.uk/itm/181894982202

instead of this:
https://www.ebay.co.uk/itm/191773759569
?????
it's worth the extra 60c for the onboard programmer!
stj is offline   Reply With Quote
Old 12-07-2017, 05:29 AM   #135
Dannyx
Badcaps Veteran
 
Dannyx's Avatar
 
Join Date: Aug 2016
City & State: Constanta
My Country: Romania
Line Voltage: 230VAC 50Hz
I'm a: Hardcore Geek
Posts: 910
Default Re: 555 countdown timer design question

Space is at a premium and I'm trying to keep the whole project as small as possible, even if it meant a more complicated setup...there's actually something satisfying about having a functional mess of wires on your worktop
Dannyx is offline   Reply With Quote
Old 12-07-2017, 07:27 AM   #136
Dannyx
Badcaps Veteran
 
Dannyx's Avatar
 
Join Date: Aug 2016
City & State: Constanta
My Country: Romania
Line Voltage: 230VAC 50Hz
I'm a: Hardcore Geek
Posts: 910
Question Re: 555 countdown timer design question

Started messing around with the code and adapting it to my needs, but I'm only able to follow up to a point. Just a quick question: whenever an IF.....ELSE statement occurs, I'm having trouble following which "else" belongs to which "if", for instance here:

if (digitalRead(button) == HIGH) {if (buttonActive == false) {buttonActive = true; buttonTimer = millis();}

if ((millis() - buttonTimer > longPressTime) && (longPressActive == false)) {
longPressActive = true;
relayState = !relayState;
digitalWrite(relayOUT, relayState);} }

else {if (buttonActive == true) {if (longPressActive == true) {longPressActive = false;}

else {LED2State = !LED2State; digitalWrite(LED2, LED2State);} buttonActive = false; } } }

The two elseS at the bottom: which one belongs to which of the IF statements above...if that makes any sense ? Sorry for posting a wall of text

My idea is the following: If the press is longer than "longPressTime", the code does one thing (turn on the light permanently) and if it's shorter, the Else should take over and do something else (in my case activate the 60s timer which I haven't implemented yet because I don't know where to drop it), so my guess is that the second Else belongs to the IF statement which checks the press time.
Dannyx is offline   Reply With Quote
Old 12-07-2017, 10:04 AM   #137
stj
Great Sage 齊天大聖
 
stj's Avatar
 
Join Date: Dec 2009
City & State: Europe
My Country: some shithole run by Israeli agents
I'm a: Professional Tech
Posts: 16,839
Default Re: 555 countdown timer design question

the shortest distance is the first pair.
if that makes sense.

and the first "if" and last "else" are the second pair.
stj is offline   Reply With Quote
Old 12-07-2017, 11:09 AM   #138
Dannyx
Badcaps Veteran
 
Dannyx's Avatar
 
Join Date: Aug 2016
City & State: Constanta
My Country: Romania
Line Voltage: 230VAC 50Hz
I'm a: Hardcore Geek
Posts: 910
Default Re: 555 countdown timer design question

Quote:
Originally Posted by stj View Post
the shortest distance is the first pair.
if that makes sense.

and the first "if" and last "else" are the second pair.
Ok, but I believe the very first IF, the one that checks the button being pressed, doesn't have an else, since it doesn't expect to do something else if the button ISN'T pressed.
Dannyx is offline   Reply With Quote
Old 12-08-2017, 12:57 AM   #139
Curious.George
Member
 
Join Date: Nov 2011
Posts: 52
Default Re: 555 countdown timer design question

Quote:
Originally Posted by Dannyx View Post
WAY overkill for what this thing needs to do
But you've really not indicated exactly what it must do.

What does "60 seconds" mean? 60 +/- 0.5 sec? 60.0000 sec? "About a minute"?

Will it always be "60" or will you later decide that you'd like it to be 70? Or 120?

Getting reliable, repeatable long delays from an RC delay is tricky. What are teh tolerances on your components? Operating temperature range? etc. Do you plan on "select at test" -- or, worse, adding a trim pot? -- to tweek the delay to the desired accuracy?

While a < $1 MCU might seem like overkill, it can give you the benefit of a highly repeatable and alterable design. What if you want to inhibit the light from being retriggered within 37 seconds of extinguishing? What if you want to start your 60 second interval when a button is released instead of when it is initially depressed (or vice versa)? Or, if you want to adjust the duration of the period based on how long the button is held depressed? etc.
Curious.George is offline   Reply With Quote
Old 12-08-2017, 01:01 AM   #140
Curious.George
Member
 
Join Date: Nov 2011
Posts: 52
Default Re: 555 countdown timer design question

Quote:
Originally Posted by eccerr0r View Post
And another reason why microcontrollers are preferred, if you're using a crystal oscillator, it can be accurate down to parts per million, and even using the onboard oscillators in some even newer microcontrollers they have errors of only 1% or so. Using 5% resistors and +80-20% electrolytics, know knows what your real time constant will be
You don't need a crystal (adds cost). Use the AC mains as your timebase. Crudely rectify it and count 50 cycles for each second of delay that you want. In this way, you don't care how "fast" the processor clock happens to be.
Curious.George is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Badcaps.net Technical Forums 2003 - 2017
Powered by vBulletin ®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
All times are GMT -6. The time now is 10:07 PM.

Did you find this forum helpful?