• 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?

zozo

Member
Joined
16 Apr 2015
Messages
8,643
Location
Netherlands
It's rather new for me but I like to play with it to automate a simple 3 volt LED for a mini terrarium setup... Now I already ordered me a NodeMCU ESP8266 WiFi development board I know that can do it... I'm not totally unfamiliar with program scripting did some VBS in the past so in a way, I can make some sense of it, but it's more than a bit rusty... Already found a valid sketch that automates the LED on/off over WIFI internet Time Server.

This bellow should work, but if I would need to change the time I need to re-upload another edited script.

Now I've also seen that HTML can be corporated to access the NodeMCU as webserver via port 80 to edit the values web-based via button tags etc. Would like have buttons to switch LED port off and on, on-demand and be able to edit the time on and time off values. Seeing examples it all looks much too easy, but still, this is where I run into complete noobilities. I actually wouldn't now where to start HTML scripting with Arduino IDE is completely unfamiliar to me... I'm more of a copy/paste script kiddie (more to say old fart) but i can't find the examples i need and how to incorporate it.

Are there people around that know this stuff? Any assistance would be hugely appreciated... 😍
 
Last edited:
No have not seen it thanks I'll give it a read... Tho I do not have the Arduino Uno but will get the NodeMCU wifi shortly.
No idea if it can handle all that as the Uno does...

I actually came to the idea with looking at this NodeMCU getting started tut.


What he shows here does for a part what i want relatively simple, switch the LED port on/ff via Web... The part i'm missing is how to create the possibility to edit and save the time parameters and where to put this correctly in the script.. :)

It actually shouldn't be too difficult for someone who knows how to incorporate the correct HTML tags and parameters to get it done... It looks like it needs a few more lines... But at the moment I'm running around like a chicken without ahead.
 
Last edited:
I was typing out code, but this does a much better job: A Beginner's Guide to the ESP8266

You're basically trying to build an http server with the NodeMCU to control some LEDs, yep simple, see how the above helps :)
 
I was typing out code, but this does a much better job: A Beginner's Guide to the ESP8266

You're basically trying to build an http server with the NodeMCU to control some LEDs, yep simple, see how the above helps :)

Thank you! I have some reading and digging to do now... This is indeed what I basically want... I can edit the existing sketch i posted above to say LED on at 08:00 and off at 20:00 that ain't rocket science. And i guess it simply wrks and loops this day in day out till told otherwise.

But it would indeed be fancy that if needed that I can edit the time period over the HTTP server on the NodeMCU without editing the script and upload it again.

It actually is for this little bugger :) A friend asked me to also build one for him but he wants it mobile and wireless on battery power, no power cords to mains. It only contains 3 x 3.3 volt 200mA LEDs parallel...
IMG_20210108_102427854.jpg


So I thought intersting idea and experiment, this I can only fix with using the NodeMCU hooked to a battery.

That's how the idea was born... :) But my scripting skills are more than a bit rusty... Haven't touched it over a decade.
 
Last edited:
The ESP32 includes Bluetooth so that might be more suitable than wifi

That's a good one, made a new order to play with that too... It's too cheap not too, funny stuff... :)
 
That's a good one, made a new order to play with that too... It's too cheap not too, funny stuff...

If you have the time and brain power its an interesting hobby, though its our young ones who do all the work on them, they were equally overjoyed when finding that RN tutorial, it really got them into those wifi /bt things; ( it all baffles us oldies !:) )
They say log on to that site with an email address to get their latest updates, all free, though they have not joined up to the paid for lessons etc as most of it can be found for free.
They also suggest you look at this free site ( one of several similar) which allows you to build your own mobile App to control your ESP etc etc.

MIT App Inventor | Explore MIT App Inventor
 
I think I found what I'm looking for, almost completely ready to roll.


This would be the web-based portal to set and update the ESP timer
GitHub.png

Only need 1 timer (A) and since it likely is designed to switch relais I need to fiddle a bit with the Pin settings to make it switch a small Mosfet instead... It only needs to switch 3 LEDs 3.3.V - 60mA total

Thanks, Guys for the inspiration... I let you know how it runs when all is tested...

Now the hunt is on to find something similar for the ESP32 via bluetooth...
 
let you know how it runs when all is tested...

Now the hunt is on to find something similar for the ESP32 via bluetooth...
Yes, please do let us know how it works, as all that wifi stuff is a mystery to us, I do occasionally see the younger ones doing such stuff, but they go at such a pace I'm lost after 5 mins ! :drowning:

Re the ESP32 and Bluetooth, seems it working in two ways, BT Classic and the newer BLE Low Energy.
Apparently BLE is complex to set up and run so they suggest sticking with BT Classic , when you load the files for the ESP32 ( see the RN tutorials) into the Ardunio IDE it installs an Example folder which include wifi and BT test programs.
You should also find a similar ESP8266 Examples folder.

Re the Mosefet, you can drive them directly ( or via a simple resistor) from the micro if you use the Logic Level Types , most supplier list them as such.
However for your current needs any simple transistor should be fine eg BC337. BC547
 

Attachments

  • 000355.jpg
    000355.jpg
    9.3 KB · Views: 156
I think I changed my mind again... :) After reading some documentation it seems I didn't think of the obvious. The more fancy features requiring regular updates the more power consumption... Since it needs to run on battery power I need a lite setup to have to longest fun for my buck. But I ordered 3 boards so still room enough to play and see where it ends.

Thanks!...
Re the Mosefet, you can drive them directly ( or via a simple resistor) from the micro if you use the Logic Level Types , most supplier list them as such.
However for your current needs any simple transistor should be fine eg BC337. BC547

Regarding lite, I indeed ordered a few BJT NPN 2N3904 transistors that should do the job perfectly with a 1.5V gate and a 27k resistor to the 3.3V IO pin to switch the 60mA source/base load.

That GitHub site I previously linked to is a gift from heaven... It contains quite a few alternative timer switch programs that are ready to use with minor editing. Enough stuff to learn...
 
Small update on my research... Since i want to run my project for considerable time on battery power I found out that ESP modules are actually very power hungry devices. The more code is put into it the more it consumes and it gets even worse if it needs a Wi-Fi connection, run a RTC in the background and run a web server at the same time. It would flatten the largest battery out there in hours time...

Thus i had to throw this whole idea overboard and go a different route...

index.jpg

This chip can be programmed with Arduino IDE LUA script.

And it is actually not this difficult at all... All i need is to run a few LEDs for a period of time and since its for a mini terrarium a 12 hour on//off light cycle is perfect. For this i don't even need a real time clock. I found an easy LED blink interval code that simply goes 12hours On and 12 hours Off in a constant loop as long there is power. The code starts at power up or reset... Thus the hour i want the lights to come on i switch on the circuit and it starts, 12 hours later the light goes off and 12 hours later on again. The controller simply counts down in milliseconds in a loop... Even if there is a slight time shift over a certain period it will be a few seconds per day maybe. That will be no more than a few minutes per moth and a reset/power down brings it back on track if needed.

The micro controller consumes few μAh the LED lets :) say i take 2 consume 40mAh then i'll be generous with calculating 50mAh total... This on a 26800mAh power bank it should run 26800/50= 536 hours = 22 days x 2 = 44 days at 12 h/d.

For now this is theory... Currently testing the code on the ESP on a breadboard...
WhatsApp Image 2021-01-27 at 11.03.15.jpeg

When this is confirmed running stable I'll start building the microcontroller... :)
 
Last edited:
That was my main concern, I gace a talk recently in Cambridge where one of the other speakers went deep into low power battery operated arduino devices. I'll try and find it on Youtube
 
That was my main concern, I gace a talk recently in Cambridge where one of the other speakers went deep into low power battery operated arduino devices. I'll try and find it on Youtube

Yes i did already read a few articles on that... And they all pul the device into deep sleep, but than still it seems to be a power hog... Only running days on a battery... :) Even running the LED only actually exceeds the controllers power consumption.
There for i need a massive power bank, simple batteries wont cut it long enough.
 
Seems like a lot of work to turn a light on and off! Or am I missing something? :rolleyes::rolleyes:

Well to do this battery powered it has some issues if you like it on a real time clock like a timer switch....
It isn't the clock spoiling the fun, but more the lights and the eventual needed relays that consume the most. But both added are too much for general batteries to run a significant time.

The microcontroller is the only way around this... And it's not ready made for this use, so the rest should be DIY build around it.

Instead of relays i use a low current BJT as electronic switch, since analog relays are power hogs again.

In the end once known how and what it actually isn't that much work at all.
 
Seems like a lot of work to turn a light on and off! Or am I missing something? :rolleyes::rolleyes:

Unsure, with a birds view down, there's a few things: You need to programming in a low level language (C, ideally). You need to be able to write logic to work with a wifi chip, you'll need to write more logic to handle communications. This assumed you know these technologies, communication is a pig, the wifi stuff could be a challenge, ihopefully we just need to send an http GET; does the creator know about udp or tcp? it might be needed. What about packet loss, connection loss? Hopeflly the chip doesn't involve us needing to write anything more for ISO layer below - but maybe we need to for resource saving. We additionally need an interface to send these messages to the board (use postman @zozo ). I haven't even got to the electronics; if you don't know anything about circuits, control loops, resistnace, voltage (I can go on here) electronics is a pain point too.

Such a simple task as switching on an LED, requires exposure to so many pieces of technology :)
 
Could you get something like this:

Amazon product ASIN B07G734Q53
And just connect it to a power bank?

Edit: just noticed the timer on it is not adequate
 
Could you get something like this:

Amazon product ASIN B07G734Q53
And just connect it to a power bank?

No the challenge given is to make a copy of this bellow running on batteries as is, with the light build in... As requested by a friend who wants me to build it for him.

4803.jpg


And i though, this on battery power without the need of a mains socket close would be awesome... Put it where ever you like,maybe he wants to take it to bed... I don't know... But i just thought i'll give it a try, at least if it all fails miserably I learn something new again.

But as above in theory if calculated correctly it might be not that difficult at all... But we need to try first to know. :)
 
Back
Top