420 Magazine Background

Arduinos In The Grow Room: My Project

odam2k

Well-Known Member
All the module has to do is issue this query every minute, and set the relay pin either high or low depending on whether the light is supposed to be on or off. It only needs to concern itself with "right now", not worry about how long until it changes although it is capable of reporting the time remaining... ...
I suppose this is one time where performing a query WILL be mission critical, at least withing a certain time frame... A few minutes won't hurt, but what if the network is down, the MySql Server is down, perhaps for hours.... You would hate to wake up and find that your lights are still on from the day before...

I may need a configurable "time limit" where it becomes critical, ie, if after 30 minutes it still can't get a response, do what? I suppose that would also be configurable...


I'll keep this one in the back of my head and come back to it....
 

odam2k

Well-Known Member
Sheesh, I'm still working on fixing the fallout of changing PlotId to Location/Row/Column...

I moved a few plants from Veg into Flower this morning, and lets just say I discovered a couple nasty problems when I tried to move them in the database using the new web pages... I'm pretty sure I have it working properly now. I have a few more plants to move so I can test it...

If your "grid" is nearly full for a location, and you wanted to just shuffle some plants around, it's a bit like playing one of those slider puzzles. There is a drop down list to pick the new location, and for obvious reasons, only empty locations are listed, so just swapping two plants becomes a puzzle game. There has to be some kind of creative solution for this... Perhaps it will come to me during my next nap.... or bowl... :roorrip: lol...

Speaking of...

More Coffee....
 
Last edited:

drummer69

Active Member
Couldn't you just run a redundant relay to control the 5v WW so if during the reboot the wallwart provides your coil power then after reboot the audrino shuts that relay down and you remain on your automated relay call the A & B (audrino and backup ) or something , then it should stay illuminated throughout your reboot during a lights on condition and also if you reboot during the lights off condition you wont flash it , it will remain off till you are calling for it again at start of the next on cycle :):):)
This of course needs to be done with DPDT relays though
Ive created circuits like this for Estops and safety gate circuits on industrial machines and injection molding machines
 

odam2k

Well-Known Member
Interesting idea, thanks... My intention was to use the 5v WW power to hold the Signal Pin HIGH on the Relay Control line, not the coil power. Would that be better? No resistors needed, just 5v to hold the relay closed.

DPDT? Why? Sorry, just woke from a nap, bit slow...
 

odam2k

Well-Known Member
Yep, use what you have... I'm glad I've been hoarding useful stuff away for years...
It's always great to have not only the right tools, but the right parts on hand....
 

odam2k

Well-Known Member
A bit of a change of pace here...

I've made so many changes, I kind of want to let things run for a bit,make sure it still works :)

I'm going to attempt something I haven't yet attempted, at least not seriously. I'm going to play with Android Studio and see if I can gain some understanding of how to write an app for android. Oh I've got nearly 40 years of programming experience under my belt, but this involves a new language, java, I've never learned java, and a new architecture. The programs don't flow or behave like they do on a PC or Arduino...

All I want to do is a proof of concept type thing, just to see what I can do, perhaps just display some web pages to start...

Anyhow, I just spent 2 days basically laid up, sleeping more than usual... Feeling better now, see how today goes.
 

odam2k

Well-Known Member
Well, not bad for a few hours exploring...

Capture.JPG

Android now blocks all non https clear text traffic, this is a problem because the ESP8266 isn't using https. I've seen some hints of it in the example code, I suppose I should look into that. Anyhow, Android allows you to disable that feature for the program, which I've done, just until I fix the WebServer.

I may do some custom pages to fit the phone screen better.

I was searching google to find out how to do MySql queries from Android, and the consensus seems to be having the Android system call WebServices written in php running on linux web servers... I'm still not ready to go that far....

But it got me thinking... If the ESP8266 has both WebServer and MySQL Connectivity, why can't I just create some basic "services" to do the same thing? The nice thing is I only need it to do a few specific things, it does not have to be generic or support any minimum standards other than my own :)
 

Latitude17

Well-Known Member
@odam2k Have you looked in to Blynk? Point of entry is pretty low and allows you to focus on your hardware/Arduino. They have a local-install version as well, if you have any concerns about privacy.

@Skybound turned me on to it, and it makes prototyping client apps WAY faster/easier. Love what you've done so far!
 

odam2k

Well-Known Member
@odam2k Have you looked in to Blynk? Point of entry is pretty low and allows you to focus on your hardware/Arduino. They have a local-install version as well, if you have any concerns about privacy.

@Skybound turned me on to it, and it makes prototyping client apps WAY faster/easier. Love what you've done so far!
I've heard of this before but never explored it, so I had a look. It looks perfect for the task at hand doesn't it? I'll keep reading, but I think something more generic like java in Android Studio, while more difficult to learn, will allow more flexibility in the types of programs I can write. Who knows, perhaps even learn both!

Back to the Blynk documentation....
 

odam2k

Well-Known Member
Ok, I read some documentation, and even got a couple hours sleep...

I'm going to give this a go (Blynk) even though the way it works is not what I'm looking for.

Blynk, if I understand correctly, is really meant to control your arduino like a sketch would, by directly manipulating pins, both read and write. I don't want this, I'm already taking care of that, I just want a way to display some data, and allow some input...

However, Blynk does offer a workaround for me, Virtual Pins. Basically, again, if I understand this so far, a Virtual Pin is something I emulate in software on the Arduino, so I can for example, set a Virtual Pin to have any value I like, even send text.... and Blynk will read that data and display it how you like.

This means I can have a Blynk Client that displays, say any notifications sent by the system, all I need to do is write code on the Arduino to read my database table of notifications, and send that data to a Virtual Pin. Blynk will pick up that info from the Virtual Pin, and provide a mechanism for alerting me on the phone. I call this a workaround because I'll have to write a "virtual Blynk Server" that does this.

I would be able to not only report on the data already logged, but I can also give Blynk REALTIME access to some of these sensors, a real plus.

Simplistic view, I haven't even installed it yet, but if my assumptions are correct, then this is good :)

Thanks again @Latitude17
 

odam2k

Well-Known Member
Ooops, alarm bells!

I installed the Blynk app on my phone, and suddenly I'm finding out it's NOT free?
They have some convoluted model where every time you try a widget, you get dinged "energy charges"? and if you run out of "energy" you can go to the "energy store" and buy more? So why didn't they explain this up front? If you decide you don't want to use that widget, you only get 80% of your energy back... I'll go broke just deciding which widgets to use :(

Sadly, I'm not going to invest my time to learn a technology only to be held ransom by it's creators... I'd rather go back to Android Studio and java, where I don't need to be concerned with that.
 

odam2k

Well-Known Member
The worst part is, I have no idea how often they will want money, or how much... I'm hoping someone can tell me, because it sure does look interesting :)
 

odam2k

Well-Known Member
Getting errors trying to run the server on my laptop. It says something is already bound to port 8080, but I can't find anything. Perhaps I'll try another machine, I'd like to confirm how this works before I spend much time playing with it.
 

drummer69

Active Member
I am now glued to this post as I myself have been wondering about Blynk. I am swamp'd at work right now so been a little slow on here last few days .
 

odam2k

Well-Known Member
I got it to run finally, changed the port to something else, and its ok., Now I'm trying to get a self signed certificate working...

and I can confirm that it's on the server that you allocate this "energy" so it appears there is no reason to pay for anything unless you use their server. Perhaps once your happy with your choice of widgets, you can switch to their server when you go live...
 
Top Bottom