Dark sensor circuit using LM393 question.... unstable OFF/ON... flickering

Thread Starter

johnaustinkaty

Joined Jul 16, 2021
284
The programmer board uses the reset function for communications during programming.
So if you successfully set the fuse for the pin to "GPIO", the MCU won't be programmable anymore. You'll have to unplug it and plug it into a breadboard, apply power, and test the pin.
If your just using the ADC on pin1, then that is already set (along with reset function) without setting any other fuses.
Yes, it is the Sparkfun programmer. In your opinion, do I need to disable the reset pin #1? Or, would a 10k PU to 5v do the trick?
 

eetech00

Joined Jun 8, 2013
4,709
Yes, it is the Sparkfun programmer. In your opinion, do I need to disable the reset pin #1? Or, would a 10k PU to 5v do the trick?
Pin 1 is active as a reset pin. So, no, don't connect a pull-up. it can only be used as an analog pin until the fuse bit is set to GPIO,
But once it is set to GPIO, the ATtiny is no longer programmable. It will require a HV programmer to set the fuse bit back to enable programming.
 

eetech00

Joined Jun 8, 2013
4,709
Pin 1 is active as a reset pin. So, no, don't connect a pull-up. it can only be used as an analog pin until the fuse bit is set to GPIO,
But once it is set to GPIO, the ATtiny is no longer programmable. It will require a HV programmer to set the fuse bit back to enable programming.
Additionally, Pin 1 will require a pullup for the last schematic you've shown to work correctly. So that can't be tested until the fuse is set to GPIO, or, maybe temporarily use it as an analog pin for testing only.
 

Thread Starter

johnaustinkaty

Joined Jul 16, 2021
284
hi j,
No, if Pin1 is used as a logic input, any pulse input will Reset the MCU.
E
I spent several hours yesterday trying to figure out a way to disable the reset. I was entering commands in my command window (I don't call it "terminal"). I typically received an "access denied" message, but also got "wrong syntax" and other messages while trying many different command lines. I'm not sure how to get that reset disabled. I am very computer literate and this issue has me stumped.
 

eetech00

Joined Jun 8, 2013
4,709
I spent several hours yesterday trying to figure out a way to disable the reset. I was entering commands in my command window (I don't call it "terminal"). I typically received an "access denied" message, but also got "wrong syntax" and other messages while trying many different command lines. I'm not sure how to get that reset disabled. I am very computer literate and this issue has me stumped.
Close Arduino IDE to free up the USB com port. Then try to set fuse bits using a CMD prompt window.
 

Thread Starter

johnaustinkaty

Joined Jul 16, 2021
284
hi j,
Didn't this Reset problem show up in your development prototype build?
E

Please advise post number of this latest circuit
I didn't have a prototype build..... The issues I was having yesterday have simply disappeared. I know..... that doesn't make sense. I have assembled four additional units and all are functioning as designed. I will still work on disabling the reset pin as I understand that needs to be addressed.
 

ericgibbs

Joined Jan 29, 2010
21,467
hi j,
Checking post #367 circuit it shows pin #3 as being unused??
Is it possible to modify the sketch so that #3 is used instead on pin #1 for D2 low battery
then connect pin#1 as the Reset up to +5V visa 10k and 1 Cap to 0V, so that a Reset pulse is applied at Power Up.?

E
EG 2006.gif
 

eetech00

Joined Jun 8, 2013
4,709
hi j,
Checking post #367 circuit it shows pin #3 as being unused??
Is it possible to modify the sketch so that #3 is used instead on pin #1 for D2 low battery
then connect pin#1 as the Reset up to +5V visa 10k and 1 Cap to 0V, so that a Reset pulse is applied at Power Up.?

E
View attachment 363373
A POR reset pulse is not required. The chip will auto reset at power up. But a 10k resistor is a good idea to prevent spurious noise
from resetting the chip.
 

Thread Starter

johnaustinkaty

Joined Jul 16, 2021
284
A POR reset pulse is not required. The chip will auto reset at power up. But a 10k resistor is a good idea to prevent spurious noise
from resetting the chip.
Eric, in hindsight, I should have used pin 3 and could have avoided this reset issue altogether. I will connect a 10k to pin 1 and see if that helps.
With LDR uncovered, If I connect 12v to the light, it blinks 10 times and all LEDs stay off as expected. But, when I cover the LDR, instead of the red LEDs and main LED coming on dim, the initial 10 blinks repeat. That tells me that the attiny is resetting. However, when testing several lights outside in real world conditions, dusk arrives and the attiny does not reset... It illuminates the LEDs as the code dictates. I'm thinking that 10k would might allow that when bench testing..... Can I simply connect a 10k between pin 1 and pin 8? Opinions??
 
Last edited:

ericgibbs

Joined Jan 29, 2010
21,467
hi j,
clip:
The ATtiny85 reset pin (Pin 1) is active-low and requires an external pull-up resistor, typically 10k to prevent accidental, spontaneous resets due to noise. While an internal weak pull-up exists, an external resistor ensures stability. It is critical to keep this pin pulled high for stable operation unless using it as a reset button or reprogramming.

Add a 10K to pin #1 to pin#8 and transfer D2 to Pin #3 , edit sketch.
E
 

Thread Starter

johnaustinkaty

Joined Jul 16, 2021
284
Update:
I was finally able to disable the reset pin !! I reinstalled the attinjy85 in one of my lights and it didn't reset!
Here is the command I used and the results confirmed:

C:\>avrdude -p t85 -c usbtiny -P usb -b 19200 -v -U hfuse:w:0x57:m

avrdude: Version 5.10, compiled on Jan 19 2010 at 10:45:23
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2009 Joerg Wunsch

System wide configuration file is "C:\WinAVR-20100110\bin\avrdude.conf"

Using Port : usb
Using Programmer : usbtiny
Overriding Baud Rate : 19200
AVR Part : ATtiny85
Chip Erase delay : 4500 us
PAGEL : P00
BS2 : P00
RESET disposition : possible i/o
RETRY pulse : SCK
serial program mode : yes
parallel program mode : yes
Timeout : 200
StabDelay : 100
CmdexeDelay : 25
SyncLoops : 32
ByteDelay : 0
PollIndex : 3
PollValue : 0x53
Memory Detail :

Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
eeprom 65 6 4 0 no 512 4 0 4000 4500 0xff 0xff
flash 65 6 32 0 yes 8192 64 128 4500 4500 0xff 0xff
signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00
lock 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
lfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
hfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
efuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
calibration 0 0 0 0 no 2 0 0 0 0 0x00 0x00

Programmer Type : USBtiny
Description : USBtiny simple USB programmer, http://www.ladyada.net/make/usbtinyisp/
avrdude: programmer operation not supported

avrdude: Using SCK period of 10 usec
avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e930b
avrdude: safemode: lfuse reads as E2
avrdude: safemode: hfuse reads as DF
avrdude: safemode: efuse reads as FF
avrdude: reading input file "0x57"
avrdude: writing hfuse (1 bytes):

Writing | ################################################## | 100% 0.01s

avrdude: 1 bytes of hfuse written
avrdude: verifying hfuse memory against 0x57:
avrdude: load data hfuse data from input file 0x57:
avrdude: input file 0x57 contains 1 bytes
avrdude: reading on-chip hfuse data:

Reading | ################################################## | 100% 0.00s

avrdude: verifying ...
avrdude: 1 bytes of hfuse verified

avrdude: safemode: lfuse reads as E2
avrdude: safemode: hfuse reads as 57
avrdude: safemode: efuse reads as FF
avrdude: safemode: Fuses OK

avrdude done. Thank you.


C:\>
 

Thread Starter

johnaustinkaty

Joined Jul 16, 2021
284
My low battery signal is working perfectly also !!! I have ordered the 2.4k resistors so that the low battery signal will trigger at 11.7v.
Thx guys for all of your help.
 

eetech00

Joined Jun 8, 2013
4,709
A POR reset pulse is not required. The chip will auto reset at power up. But a 10k resistor is a good idea to prevent spurious noise
from resetting the chip.
I probably should qualify this...
If the pin is left as a reset function, but not used, then its a good idea to use the 10k resistor.
 

Thread Starter

johnaustinkaty

Joined Jul 16, 2021
284
I probably should qualify this...
If the pin is left as a reset function, but not used, then its a good idea to use the 10k resistor.
Thx for that. I still have the internal pull up set and have omitted the 10k resistor and all seems to be working great so far... I have 4 lights set up for real world conditions and will see the results shortly.
 
Top