Resistors in Serie/Parallel

My background is more Mechanics and educated to be a Toolmaker. After that, I did Installation Technology and for this, you need some basic understanding of electronics that manages the installation. But this is only very basic and crude, it doesn't dive very deep into the details and only serves the purpose of general troubleshooting if the installation fails to power up to know at which module to look. Then after that, I worked for 10 years in the IT branch as SysAdmin in the XP en W7 era also learning some Visual Basic Scripting to automate some administrative tasks, so I can kinda figure out what LUA basically does. So I tasted a bit of all these trades and I'm far from an expert in any of them, all that is generally not used on a daily basis got a bit rusty, but learned enough to get the most important part of the picture to build things and fix things affiliated.

This little project is born out of a completely different hobby of mine and that is building Aquariums and Terrariums. One is building Micro Terrariums like the one below.


This runs with 3 LEDs on the mains with a PSU en a timer switch. And a friend gave me the idea that it would be awesome to build one on battery power... I agreed and thought it would be a nice challenge to realize this. This friend gave me his Anker 30.000mAh power bank to do some experimenting. So on I quickly found Arduino and the ATTiny and the low-power consumption applications that can be built with it.

Anyway, in my research, I found out that to get the most out of this power bank I need to ditch all bells and whistles regarding relays, RTC modules, NTP and Wifi connections, etc. all requiring too much power. And simply use the ATTiny internal Millis time base to switch a couple of bright white LEDs on and off for 12 hours in a continuous loop. Time inaccuracy is rather irrelevant since it gets a hard reset about every +/- 30 days when replacing the battery with a freshly charged one.

But it wasn't as easy as I hoped it to be with the darn shut down feature in the power bank throwing salt in the soup. Making the circuit a tad more complex and requiring a tad more insight into the working of the components required.
That's where you guys came in, giving me a heads-up with some great answers to my question with a tad extra to make it running a bit more smoothly than it did... SO THANKS! A bunch for that...

Anyway, I simply used 2 Blink without delays using Millis example snippets I found on the net combined them into one and it seems to run pretty smooth. Already for 20 days now with the power bank still over 50% charged. I bet i can be done even more smoothly than this but for the noob I am, I'm pretty satisfied with the results for now... My ATTiny Terrarium will be shining on battery power next month... What's the purpose of all this? Whatever you can make out of it, placing it where ever you want without the need of a mains socket nearby. Take it for a walk or take it to bed and cuddle it, options are numerous. 8)

This is the code I used.

#define TWELVE_HRS 43200000UL
#define ONE_MIN_FIFTY 110000L
#define ONE_SEC 1000L

const int LEDpin = 1;
const long onDuration = ONE_SEC;
const long offDuration = ONE_MIN_FIFTY;
int LEDState =HIGH;

long rememberTime=0; 

unsigned long interval=TWELVE_HRS;
unsigned long previousMillis=0;
 
bool ledState = true;
 
void setup() {
  pinMode(3, OUTPUT);
  digitalWrite(3, ledState);
  pinMode(LEDpin,OUTPUT);
  digitalWrite(LEDpin,LEDState);
}
void loop() {
 unsigned long currentMillis = millis();
 
 if ((unsigned long)(currentMillis - previousMillis) >= interval) {
  
   ledState = !ledState;
   digitalWrite(3, ledState);
   
   previousMillis = millis();
 }
 {
 if( LEDState ==HIGH )
 {
    if( (millis()- rememberTime) >= onDuration){   
    LEDState = LOW;
    rememberTime=millis();
    }
 }
 else
 {   
    if( (millis()- rememberTime) >= offDuration){     
    LEDState =HIGH;
    rememberTime=millis();
    }
}
 }
 digitalWrite(LEDpin,LEDState);
}

Thanks again for the helping hand... I'll be building more of these ATTiny Terrariums in the future... Thus I might have some more questions by then... :wink:

Ahh, that's beautiful, wish I had that kind of talent. :confused:
BTW: You can now find power banks WITHOUT the auto-off, I have one, model YB1206000-USB:
https://www.amazon.com/s?k=talentcell&ref=nb_sb_noss_1

JCA34F:
Ahh, that's beautiful, wish I had that kind of talent. :confused:
BTW: You can now find power banks WITHOUT the auto-off, I have one, model YB1206000-USB:
https://www.amazon.com/s?k=talentcell&ref=nb_sb_noss_1

Dunno, if having crazy funny ideas is a talent... But thank you!. :slight_smile:

Good to know about the power banks without shut off... Most out there don't even mention if they have it or not. Even with the DIY charge modules, it's always a surprise what you get... I actually wonder why it's in there in the first place. Looks like a simple commercial strategy, made for charging mobile devices only, then if you want a battery then buy a battery.

panyvino:
Dunno, if having crazy funny ideas is a talent... But thank you!. :slight_smile:

People like me make the world work, people like you make it pleasant to live in. Don't underestimate your talent or the value of it!

PerryBebbington:
People like me make the world work, people like you make it pleasant to live in. Don't underestimate your talent or the value of it!

Haha, nicely said thank you... The same goes out to you all... It sometimes baffles me completely what you guys all build and make work... Mind-boggling that it works in the first place.

Btw I had an accidental odd observation, with one chip I used a Digispark development board to program the chip. And it's by default set to 16mHz. And it seems when the fuzes are set like this the internal timebase runs 16x faster. Thus I had to multiply all time entries x16. But then it gets very inaccurate and the 12 hours are extended by 8 minutes. Then I had to subtract 8 minutes worth of millis x 16 to get back on track again. Seems how faster the ATTiny runs the more inaccurate its internal timebase gets.

The chip I programmed at default 1mHz runs the time pretty accurately, not really noticeably off... If I divide this 8-minute inaccuracy by 16 to get back to the 1mHz inaccuracy it might be 15 minutes off in 30 days.

Clearly there is a market value for Micro Terrariums, especially in a pandemic.
You should start a business selling them online. (it is really cool !) Definitely a conversation starter.

If the MCU is in a fairly stable temperature environment and running 8 minutes slow in 12 hrs:
12 hrs = 720 min, 720 / 728 = 0.989010989011 * 43200000 = 42725274.7253, set
#define TWELVE_HRS to 42725274 or 42720000.

JCA34F:
If the MCU is in a fairly stable temperature environment and running 8 minutes slow in 12 hrs:
12 hrs = 720 min, 720 / 728 = 0.989010989011 * 43200000 = 42725274.7253, set
#define TWELVE_HRS to 42725274 or 42720000.

On the contrary and that is what's odd, it runs at 16mHz x 16 faster. But it goes 12 hours + 8 minutes instead of a minus.
And this actually is completely illogical, it runs much faster and takes longer to get there... :o The plot is thickening... :smiley:

raschemmel:
Clearly there is a market value for Micro Terrariums, especially in a pandemic.
You should start a business selling them online. (it is really cool !) Definitely a conversation starter.

Thank you! I find it cool too... And it's an interesting thought to make a business out of this... You're not the first who mentioned this to me...

But out of curiosity, how much would you be willing to spend on something like this? I wonder if we could break even on cost price only, without calculating the time spent to create it.

In my personal experience till now, it's comparable to restoring Old Timer Automobiles. Also, this is something you do for the love of it. But in almost all cases, you will always put more in it financially (with time spent) than you'll get in return if you ever want to sell it. This makes it a rather narrow market to make a decent profit.

And I'm not alone.

Ask someone who buys stuff like that.
I don't know the cost/price ratio but it is not something you see every day so it has that going for it.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.