Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Robo-Tank Web App - Development
#81
Wow this is awesome!
Reply to top
#82
Really awesome! Glad to regain the previous Robo-tank screen…
Reply to top
#83
Thanks guys. Yeah Dom it's like we are going to the past.
Reply to top
#84
Well today was emotional.   K05163

Didn't get a lot done on software last week, was busy but it was also nice to clear the head of code a little longer. Now I'm ready for a good week on the app.

On Thursday night I happened to notice the dosing reservoirs on app were empty which shouldn't have been. So I hit the refill button and next day they were empty again, oh no!!!!!!! It seemed to be running fine for a few days.

I first thought it was an issue with the custom rules as it was still running the ones in the video. So I dig in, code looks fine sending me in circles then I realize the Pi was sensing a change on the GPIO pin for one of the floats on GPIO 27 so the custom rule was doing what it should have. Each pin is read about 200 per second so I slowed things down, it happened much less but still happened. Then I put controller on bench to see if something is up with the hardware causing a quick LOW HIGH pulse on the GPIO as that's what was happening but on it's own randomly. Sure enough I could see it on the scope.

It was a big change in voltage so I didn't think it could be related to hardware and felt it was more likely something fundamentally wrong with my app but what. I'm using wiringPi library to read and control the GPIO pins, when I started on the Pi I put a good effort into controlling GPIO's directly without a library but wasn't able to figure it out, wasn't as easy as I expected. The original author of wiringPi quit a couple years ago and it seems to be a dead project so I fear one day the Pi would update and it might stop working as it has limited support for Pi 4. I thought it was slim the library was at fault but because it needed changing some point I decided to do another search to control them directly and bam I actually figured it out, now I don't need to be dependent on the library, feeling good about this at least.

Then I setup a sketch to read GPIO 27 directly but I'm unable to, it reports an error saying system is busy. I could read other pins that I randomly tried. So I start searching and come across someone in a forum saying you can't read GPIO 27 directly because it's connected to the LED on the board and something needed to be uninstalled to get direct access to that pin. He also stated pins 0,6,14,15 and 29 couldn't be read directly so I test those and they all read expect 14. Well this didn't make sense as wiringPi has no issues with them and kind of throws a wrench into removing the wiringPi library as nothing I was trying worked. 

Because I read that pin is connected to the LED I started thinking the worst, all these controller out there and this is likely happening, the only silver lining I could think was reef-pi isn't monitoring them real time so good chance it would never know that happened as it would be instant, I only discovered this now because I only started monitoring sensors in real time, if a pin changes states within 5 milliseconds the rules will detect it.

So now what, not feeling so great at this moment. K05106

I decided I guess I need to go down the rabbit hole of uninstalling this particle feature the poster briefly mentioned. Eventually I found myself in the config.txt file and what do I see, GPIO 27 and 14 were assigned as a 1-wire bus for DS18B20 temp sensors. I completely forgot I added those Thursday as I was doing one last test one everything for the new controller. I was verifying again the sensor ports would work for them so I had to configure them as such. This is why it was working.

K05164 K05164  No more issues.  K05164 K05164

Ah the joys...  K05163

For today I'm leaving the wiringPi library, I'll switch over first thing after initial release. All this pain was worth it though, one less library to work with.

Next update should be more exciting.  K05178
[-] The following 2 users Like Rob F's post:
  • albinochicken89, Brooks
Reply to top
#85
Got an update system working, happy with how it went except for the last step, sometimes what I think will be the easiest turns out to be the hardest. 

A user can check manually for updates or use the auto update feature.

If using auto update it will check my website every hour, later I'll change it to check once a day or something. This is the web page it reads, you can see it only has a number on the page, this is the version.

https://www.robo-tank.ca/app/version.html

All I need to do is upload new files to my server, change the version number on that page and everyone will be alerted.

I put the setting on the System Settings page, if Auto Update is on the "Check for Update" button is hidden.

[Image: update.PNG]

If an update is available the button changes and a link shows up beside the date. That link in the header also appears when using auto update.

[Image: update2.PNG]

When you're ready to install you click that link and you'll get the popup below.

[Image: update3.PNG]

When it starts everything is done in the backend program, it will download a zip file from www.robo-tank.ca, extract the files to a temporary folder, copy them to their destinations, delete temp files and restarts the Raspberry Pi if necessary.

[Image: update4.PNG]

When it finishes it will prompt and this is the part that really sucks, browser cache. I expected there would be a simple javascript function to clear that but it's been depreciated in Chrome and Edge and only works on Firefox but probably not much longer. Without clearing the cache there's a good chance images won't update or style sheets. Of course there's a way around this but it's messy and will take time so I'll get to that another day.

[Image: update5.PNG]

If a user skips an update or more it will step through them all. There is no backup system yet, I think that will come after initial release.
[-] The following 2 users Like Rob F's post:
  • Brooks, Coloredrock
Reply to top
#86
Didn’t read through the whole reefpi thread yet but does it also take the RPI’s OS in consideration or is reefpi the OS on the RPI?
Reply to top
#87
(10-01-2021, 07:18 AM)fietsenrex Wrote: Didn’t read through the whole reefpi thread yet but does it also take the RPI’s OS in consideration or is reefpi the OS on the RPI?

Its just a program you run on the RPI OS.
[-] The following 2 users Like Brooks's post:
  • fietsenrex, Rob F
Reply to top
#88
Here's a manual showing which OS to install on the Pi. The initial install will be like this but for Robo-Tank.

https://docs.google.com/document/d/1t9ma...o3woZ/edit
Reply to top
#89
Last night I expanded on the updates, now I can push an update to any individual. I thought this would be handy if someone experiences a problem or is willing to test a new feature. With this I can fix any bugs quick and easy for everyone.

You can see a new column with a Support ID, this should be unique to everyone, it's just a random generated number. I don't know these ID's so you would send it to me and I can direct it accordingly.

The update system will also keep the Pi OS update.

[Image: update6.PNG]
[-] The following 1 user Likes Rob F's post:
  • fietsenrex
Reply to top
#90
Please stop making it even more tempting to buy a unit :p
Reply to top
#91
Haha, I'm trying my hardest.
Reply to top
#92
Haha I can tell.

But having the OS update automatically as well will reduce the risk of cyber attacks since everything will be up to date, or at least that is what everyone is telling about keeping stuff updated.
Reply to top
#93
I think the Pi is fairly secure, one day I'll have to look into how but I don't think it'll be a problem, haven't heard of it anyways but yeah updates should help. I'm trying to make it so after initial install the Pi terminal never needs to be used.
[-] The following 1 user Likes Rob F's post:
  • fietsenrex
Reply to top
#94
Well I think tomorrow is the big day, get your SD card ready.  K05164 

This is what I've done lately.
  • Added very basic emails to schedules and custom rules
  • Added the smart start feature, this goes through all schedules for AC outlets, DC ports and lights and checks the custom rules. It makes sure everything goes to the state it should be in at the time of startup. Today if you restart in the middle of a light mode it won't continue the fade but instead set the levels according to the end of the mode it would be fading on, later it'll continue in the middle of a fade. For outputs it first checks schedules and adjusts the outputs accordingly then it will check custom rules and readjust the outputs according to the sensor status. For example if you have a couple ATO custom rules and the sensors are saying ATO should run it will run as soon as controller starts. If the sensors say ATO shouldn't run it won't. The program is fully running in about 0.3 seconds however the program won't launch until a network connection is made to the Pi and the time is captured, that can take 10 seconds on my network. This is another reason I'm pushing the RTC, I'm hoping with that running the program can be up within 1 second once the Pi gets power. Remember get a real time clock (RTC), DS3231 or DS1307 for next release. I've been running this over a year and it's never crashed due to time, never really crashed period, but 100% it will if it's running and a connection is lost to network and it can't update the time, I know that will happen to someone sometime so please get an RTC if you use program long term. You use dupont jumpers to connect it to the external I2C port on controller so fairly easy to add.
  • Added "Restart Controller" button to system settings page.
  • Found a couple UI bugs for light modes page so that was good. Also added some instructions as there's a temporary feature that will likely confuse, this will be gone later.
  • This one was torcher, the program install process. As I've been building this I've been updating a script to install everything similar to the one I have for reef-pi. The problem for Robo-Tank was when PHPMyAdmin got installed it prompted a couple times for the user to select an option. This was horrible as someone's going to select the wrong option. After about 8 hours or so I actually got it, was a nightmare as I needed to reinstall Pi OS, update, install and repeat. 20 minute process every time I made the slightest change, so yeah you better appreciate the clean installation.  K05163
  • Added an enabled/disable feature for email alerts, forgot that was needed. 
  • Cleaned up installation wizard for new UI and added the "Auto Update" setting. 
  • Fixed various UI and program bugs, for next release I'll be tracking all the changes in the program.
Cleaned up the custom rules UI, now you can see the delay after it doses and things are spelled out clearer.

[Image: rules24.PNG]


When you create a custom rule the "No More Doses for X Minutes" will be filled with the default value given to each dosing pump. If you change this it will be used for the rule and the default delay will continue to be used for schedules. This is basically an override for this specific rule.

[Image: rules25.PNG]


Did more work on the configure ports screen. Now you can click on the DB9 connectors and it'll show all the ports for it and allow changing custom name, if it's enabled and the icon. Currently for function there's only AC power bar but later the extensions I offer will be there. These are all assigned as "AC Outlets" if you made something custom and want to change the function for each pin go to the "Advanced" tab.

I added this as I think I'll be adding it to the one time initial setup wizard. I was going to just assign all ports as controller is labeled and have all enabled but this is the first place a person needs to visit so I'll probably add it with some one time instructions. I think it's fairly straight forward, click any port and set the settings as you need. If you don't use that port disable it so it's hidden in program. If you have a dosing pump plugged into a DC port, select that port, set function to dosing pump, change name and save. Then when you're finished going through the ports the dashboard will be nicely populated with everything you use instead of just everything. This could take 10 - 30 minutes though as you need to click each port and enable/disable and assign custom names but I guess that needs to be done anyways. Just thinking later there could be a skip button and everything is enabled with default names.

[Image: configure_ports5.PNG]

So by tomorrow night I should be posting how to install it. I won't be sending an email or posting about it for a couple days, I want to make sure you guys can actually install and use it. Feeling good but a little nervous, if I've learned one things from all this it's real world use and bench testing are not the same. Still haven't tried installing on a Pi 4 or Zero W, may or may not do that. If it's a problem it could take a while to figure out why and delay release so I almost don't want to try even though I think it'll be ok.  K05106
Reply to top
#95
(10-08-2021, 10:48 AM)Rob F Wrote: Well I think tomorrow is the big day, get your SD card ready.  K05164 

This is what I've done lately.
  • Added very basic emails to schedules and custom rules
  • Added the smart start feature, this goes through all schedules for AC outlets, DC ports and lights and checks the custom rules. It makes sure everything goes to the state it should be in at the time of startup. Today if you restart in the middle of a light mode it won't continue the fade but instead set the levels according to the end of the mode it would be fading on, later it'll continue in the middle of a fade. For outputs it first checks schedules and adjusts the outputs accordingly then it will check custom rules and readjust the outputs according to the sensor status. For example if you have a couple ATO custom rules and the sensors are saying ATO should run it will run as soon as controller starts. If the sensors say ATO shouldn't run it won't. The program is fully running in about 0.3 seconds however the program won't launch until a network connection is made to the Pi and the time is captured, that can take 10 seconds on my network. This is another reason I'm pushing the RTC, I'm hoping with that running the program can be up within 1 second once the Pi gets power. Remember get a real time clock (RTC), DS3231 or DS1307 for next release. I've been running this over a year and it's never crashed due to time, never really crashed period, but 100% it will if it's running and a connection is lost to network and it can't update the time, I know that will happen to someone sometime so please get an RTC if you use program long term. You use dupont jumpers to connect it to the external I2C port on controller so fairly easy to add.
  • Added "Restart Controller" button to system settings page.
  • Found a couple UI bugs for light modes page so that was good. Also added some instructions as there's a temporary feature that will likely confuse, this will be gone later.
  • This one was torcher, the program install process. As I've been building this I've been updating a script to install everything similar to the one I have for reef-pi. The problem for Robo-Tank was when PHPMyAdmin got installed it prompted a couple times for the user to select an option. This was horrible as someone's going to select the wrong option. After about 8 hours or so I actually got it, was a nightmare as I needed to reinstall Pi OS, update, install and repeat. 20 minute process every time I made the slightest change, so yeah you better appreciate the clean installation.  K05163
  • Added an enabled/disable feature for email alerts, forgot that was needed. 
  • Cleaned up installation wizard for new UI and added the "Auto Update" setting. 
  • Fixed various UI and program bugs, for next release I'll be tracking all the changes in the program.
Cleaned up the custom rules UI, now you can see the delay after it doses and things are spelled out clearer.

[Image: rules24.PNG]


When you create a custom rule the "No More Doses for X Minutes" will be filled with the default value given to each dosing pump. If you change this it will be used for the rule and the default delay will continue to be used for schedules. This is basically an override for this specific rule.

[Image: rules25.PNG]


Did more work on the configure ports screen. Now you can click on the DB9 connectors and it'll show all the ports for it and allow changing custom name, if it's enabled and the icon. Currently for function there's only AC power bar but later the extensions I offer will be there. These are all assigned as "AC Outlets" if you made something custom and want to change the function for each pin go to the "Advanced" tab.

I added this as I think I'll be adding it to the one time initial setup wizard. I was going to just assign all ports as controller is labeled and have all enabled but this is the first place a person needs to visit so I'll probably add it with some one time instructions. I think it's fairly straight forward, click any port and set the settings as you need. If you don't use that port disable it so it's hidden in program. If you have a dosing pump plugged into a DC port, select that port, set function to dosing pump, change name and save. Then when you're finished going through the ports the dashboard will be nicely populated with everything you use instead of just everything. This could take 10 - 30 minutes though as you need to click each port and enable/disable and assign custom names but I guess that needs to be done anyways. Just thinking later there could be a skip button and everything is enabled with default names.

[Image: configure_ports5.PNG]

So by tomorrow night I should be posting how to install it. I won't be sending an email or posting about it for a couple days, I want to make sure you guys can actually install and use it. Feeling good but a little nervous, if I've learned one things from all this it's real world use and bench testing are not the same. Still haven't tried installing on a Pi 4 or Zero W, may or may not do that. If it's a problem it could take a while to figure out why and delay release so I almost don't want to try even though I think it'll be ok.  K05106
Rob this is great news! Can't wait to install it on Sunday and tinker around.
[-] The following 1 user Likes albinochicken89's post:
  • Rob F
Reply to top
#96
Sounds good, let me know how it goes.
Reply to top
#97
K05164 K05164
[-] The following 1 user Likes Dom59's post:
  • Rob F
Reply to top
#98
It's ready.  K0519

https://www.robo-tank.ca/forum/Thread-Ro...0-is-Ready

Looking forward to how it goes, let me know, fingers crossed.
Reply to top
#99
Rob,
I currently have Reefpi running on my main board with my tank. I loaded Robotank v6 On the second board which has any equipment plugged on it. This week end I will try to setup all my AC outlets schedules. After that, Can I simply take off the sdcard of that board and put it on my main one, and starting to use it?
Reply to top
Hey Dom, yeah that should work as long as the Pi's are the same. If you need to go back to reef-pi you can swap cards again so keep that card as is.
Reply to top


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to Install Robo-Tank App Rob F 8 2,499 02-04-2024, 06:44 PM
Last Post: Rob F

Forum Jump:

Current time: 04-24-2024, 11:17 PM