• You are viewing the forum as a Guest, please login (you can use your Facebook, Twitter, Google or Microsoft account to login) or register using this link: Log in or Sign Up

Arduino experts around?

Hi! I have also started to mess around with arduino and I was wondering if there's a reason you don't use real time clock (RTC)?

Just to add, yes agree with zozo, it's another overhead that you have to manage with power, both processer and energy. For most simple delay projects, the internal timer suffices.

The moment the microcontroller gets turned on it turns on the LEDs and it starts counting down and does this with the very same milliseconds and clock speed as it would run the RTC. There would be no difference, in this case, an RTC has no added value. If there would be a 15-minute time shift in a month time then a hard reset would be enough to start over again with a fresh count. This actually will happen anyway since it runs on battery and this will need to be replaced. If my calculations are correct about every 45 days
If you use an external crystal on the ATTINY microcontroller (most arduino's have these built in) rather than the internal clock, you might find it keeps time better.
 
Ah ok, I thought RTC had its own battery and using it with sleep function or AutoPower could save overall energy. Mind I’m very much a noob so following this with interest.

I was planning on dabbling with some kind stripped down Reef Pi style system but it’s so complex that I think doing something simple with LEDs could be good first step
 
If you use an external crystal on the ATTINY microcontroller (most arduino's have these built in) rather than the internal clock, you might find it keeps time better.
Thanks for the tip, I have to do some research on that... :) For now, i did run the sketch on an ESP and it runs pretty accurately. The time shift is neglectable, yet no idea about the ATTiny performance with this. Haven't received the order yet.
 
Ah ok, I thought RTC had its own battery
It does and it can run pretty long a button cell, the clock is not the issue... But to set it, it needs a lot more to it than the RTC module only. You would need a display and a timer function to set and control the relays on/off time. And to keep track of time and sync it real-time, as said, it needs an NTP server connection. All that added is quite a power-hungry application... :)

That's why I first thought I could do it with NodeMCU or maybe an ESP only. this can also run an internal RTC... But again very power hungry.

Another thing I also aim for is to make it in the smallest footprint possible...
 
It does and it can run pretty long a button cell, the clock is not the issue... But to set it, it needs a lot more to it than the RTC module only. You would need a display and a timer function to set and control the relays on/off time. And to keep track of time and sync it real-time, as said, it needs an NTP server connection. All that added is quite a power-hungry application... :)

Other thing i also aim for is to make it in the smallest footprint possible...
Agree with you that just using the internal timebase / millis is all you need if you have got to change the battery /reset it every month or so. surely adding or loosing a few minutes over 45 days is not going to be important for this project.
 
Ah ok, I thought RTC had its own battery and using it with sleep function or AutoPower could save overall energy. Mind I’m very much a noob so following this with interest.

I was planning on dabbling with some kind stripped down Reef Pi style system but it’s so complex that I think doing something simple with LEDs could be good first step

Yes the RTC's do, sorry was a little confusing, my reply.

I too was looking at reef-pi, but was far too overkill for what I needed. I created my own setup (aquasca-pi :)), which was a cut down version with web interface <Here>. If you want anymore info, pm me, don't want to hijack the thread!
 
Ah ok, I thought RTC had its own battery and using it with sleep function or AutoPower could save overall energy. Mind I’m very much a noob so following this with interest.

I was planning on dabbling with some kind stripped down Reef Pi style system but it’s so complex that I think doing something simple with LEDs could be good first step

Thats a good way to learn, try doing a timer to switch your leds on and off at a specific time, using your RTC module.
Also look into using logic level Mosfets to control you DC devices, a lot less noisey than Relays, electrically speaking.
Save that module as it could form the basis for other timers such as a doser etc

Then you could adapt your timer module to included a sunrise and sunset routine to control the leds using the PWM function, though doubt it makes any difference to the fish or plants, it does make things more natural to us.:)
 
Still amazed by that little reactor! :eek:
Haha... :D It is indeed a great little toy that Stirling Engine... I actually bought it as an educative present for my nephew but couldn't help playing with it myself for a couple of days...

 
Thanks guys! I probably should start some Arduino for idiots thread. I was wondering is there a reason why any LED light can’t be dimmed with PWM? I have little Aquael LED with my shrimp tank and I was pondering hacking that but it says something about having spare LEDs that come on when others dim to keep equal brightness.
 
Thanks guys! I probably should start some Arduino for idiots thread. I was wondering is there a reason why any LED light can’t be dimmed with PWM? I have little Aquael LED with my shrimp tank and I was pondering hacking that but it says something about having spare LEDs that come on when others dim to keep equal brightness.

You can use PWM to dim any LED, the arduino PWM will only handle mA, so you would need a transistor that is controlled by the PWM signal, which controls the larger load of multiple LED's. That's what I do on my nano tank to get a sunrise/sunset type lighting profile. Sounds as if the Aquael may already have a controller in it, that dims 90% of the LED's, whilst the others are on all the time? You'd have to open it up and try and trace the circuit to see how the LEDs are controlled. You would have to bypass any controller already there if you wanted to use your own PWM LED controller.
 
I was wondering is there a reason why any LED light can’t be dimmed with PWM?
The LED in itself as the Light Emitting Diode it is can be dimmed with PWM it might only need the proper current sensing resistor... If it concerns a factory-made light containing LEDs than it might be a different story. This because a LED is current driven, it might contain a constant current driver then the driver chip needs to be dimmable over a PWM pin. Some dimmable constant current drivers can be dimmed over PWM directly over the mains without the pin on the driver chip, but this is a rather crude solution that could cause the driver making a faint beep noise. Then it's more constructed for a phase dimmer or a variac.

For the rest is PWM a rather complicated and not so easy to explain matter (At least for me that is)... In principle, it's a 3-volt analogue signal that gives an On/Off pulse, in Arduino, this is stated from 0 (low) to 255 (high). For a single 3 volt LED it can be driven over and Arduino etc. PWM pin directly depending on the pins max output current it might require the correct current sensing resistor.

Do you want this with an array of LED's then you need to drive them again over a driver chip with a PWM/DIM pin connected to the Arduino PWM pin. (Or via a capable Mosfet I think.) There are many of those LED driver chips out there in development.
 
I might add, in laymen terms PWM as the abbreviation stands for Pulse Width Modulation is a 3-volt pulsing signal.
Anything a LED or a Motor than runs on a higher voltage than 3 volt needs an extra driver hooked to an adequate PSU that can interpret the PWM signal and so on the driver is a PWM driven voltage regulator. For example a 12-volt input PWM dimmer or Motorspeed regulator connected to a 12-volt PSU. Gives 0 volts output at PWM pulse 0 and increases the output voltage towards 12-volt max accordingly in 255 steps. :)

Why some seemingly dimmable LED drivers make a beeping noise when hooked to such a dimmer is a complete mystery to me... It kinda makes no sense actually and makes me think the drivers are crappy or that the above isn't fully correct.
 
Last edited:
Finally,:cool: I got it to work.

IMG_20210216_143644189.jpg

And it was quite a runaround to get this far... Yet i didn't have a programmer... Now it seems the NodeMCU ESP8266 can function as one but only as Wifi-AVR-ISP as can be found here. So i did set it up as seen in the pic top right.

Thus this means we need to send a package from the PC over the network TCP port to the Nodemcu so it can program the chip. And it can only program via CMD console AVRDude. Arduino IDE crashes this process.

That's where the fun starts because AVRDude and Windows do not support this function it drops the package along the way and the programmer times out. In windows Arduino programmers only can communicate over serial COM port it seems. After 2 days of searching, I find a little tool <Netburner NNDK> and this allows you to make a virtual COM port hooked to an IP/TCP Port... Than AVRDude does its job perfectly fine and programs the chip flawlessly.

For now, it works a charm, my circuit is running as should now up to the next stage... Testing ho long this runs on a desent power bank. If that meets the expectations I will solder it to a PCB to be built into the project.

:thumbup:
 
Wow looking good, looks like you have learnt loads in a very short amount of time, lots of progression in this thread! Are you planning a PCB design for it, or using proto/vero board?
 
Wow looking good, looks like you have learnt loads in a very short amount of time, lots of progression in this thread! Are you planning a PCB design for it, or using proto/vero board?

Yes, thank you... :) I did learn quite a bit the past few days... It was a hell of a search to make things work. Once you know it's simple but before, it was a pain in the neck to find it out... Searching for the errors I encountered, I found that a lot of people using Windows ran into the same problem and complained about the ESP8266 AVR-ISP not working. Took me 2 full days searching and reading to find out about the virtual com port, this information was very well hidden in an Arduino blog in Chez language I had to translate. I guess very little people know about this workaround and even the author of the program fails to mention it in his Github documentation.

I already have bought a couple of small proto/vero boards. :) That's a lot more convenient for such a tiny project.
 
Wow, well that one way to program a chip !! :clap:

We used to take the simpler route with one of these little USB programmers, they do most AVR chips including the ATTiny.

What you can also do is burn a bootloader into the chip so you should then be able to simply reprogram from the Arduion IDE afterwards.

How to Program and Bootload ATtiny85 With USBasp
 

Attachments

  • 000460.jpg
    000460.jpg
    51.9 KB · Views: 126
Wow, well that one way to program a chip !! :clap:

We used to take the simpler route with one of these little USB programmers, they do most AVR chips including the ATTiny.

What you can also do is burn a bootloader into the chip so you should then be able to simply reprogram from the Arduion IDE afterwards.

How to Program and Bootload ATtiny85 With USBasp

Thank you!... :)

So I found out but didn't have it yet. In all my frustration I did order a USBasp yesterday...And this afternoon I found the fix...
Well no loss anyway, it still might be easier to use than the ESP so it has some future use.

I have a couple of those small development board programmers (spark fun clones) I ordered and thought would do. But these are an absolute useless Chinese scam. I got ripped off for € 4,50. :mad: When it is plugged in it says unknown USB device, then I read indeed the chip needs a bootloader first to make this board function. Then what good are they? Thus it needs a programmer first to burn the bootloader and then program with this board while you are already at it with another programmer?

The good thing about it is, I learned how to make the SPE work and still program my chip. :p I have a couple extra Attiny's and did burn 2 different bootloaders to each of them and the above development boards still don't work... :dead: And those darn Chinese tell you zip only sell it... It might need another bootloader? But I don't care anymore actually I wrote a bad review and throw them in the trash. :thumbup:
 
Back
Top