Home | Community | Message Board

MagicBag Grow Bags
This site includes paid links. Please support our sponsors.


Welcome to the Shroomery Message Board! You are experiencing a small sample of what the site has to offer. Please login or register to post messages and view our exclusive members-only content. You'll gain access to additional forums, file attachments, board customizations, encrypted private messages, and much more!

Shop: Left Coast Kratom Buy Kratom Extract   Myyco.com Golden Teacher Liquid Culture For Sale   North Spore North Spore Mushroom Grow Kits & Cultivation Supplies   Original Sensible Seeds Autoflowering Cannabis Seeds   Bridgetown Botanicals Bridgetown Botanicals   Kraken Kratom Kratom Capsules for Sale   PhytoExtractum Buy Bali Kratom Powder   MagicBag.co All-In-One Bags That Don't Suck

Jump to first unread post Pages: 1
OfflineRyeJar
StrangerDanger


Registered: 04/16/15
Posts: 523
Last seen: 1 year, 3 days
open source IoT agriculture automation (Taraxacum) * 2
    #27769228 - 05/08/22 10:42 PM (1 year, 10 months ago)

********************

    Introduction   

********************


Long story short…
I’m in my mid 30s having a mid life crisis.  College computer science dropout who ended up becoming a chef now almost 20 years later I have finally burned myself out in the food industry beyond repair after covid.  Told my employer that I am only available 3 days a week for now on.  Bought a fifth wheel, rented a cheap space out in the middle of nowhere and started taking classes online again. 

I wanted to start a project/hobby to break up the monotony of school so I picked out an old project I never finished but still had some parts for. 

It was a little IoT smart greenhouse controller to help me grow my cannabis, but I mainly started it because it was the very first Arduino projects a lot of pot heads like me work on when picking up coding again.  Well I am hitting the project hard starting this week and wanted to mostly write up a record of sorts for my personal use and maybe a sort of instructional to anyone interested.

Now this is to be a fully fleshed out production quality solution by the end.  Here are my goals for this solution…

Create an open source IoT solution to fully control 8 particular environmental conditions for up to 32 different zones using up to 254 sensors and smart plugs connected to a cloud service and have it operate smooth and look professional and nice. 

I am going to code name this project in its current state  Taraxacum


The 8 environmental conditions are [airTemp, humidity, co2, lights, pH, eC, rootMoisture, resevoirTemp]

It sounds so simple but I know this is gonna give me a run for my money so sit tight or build along and give some advice.  I’ll have all code that I use on a git hub repository for anyone to use or change as they see fit. 

Here is the diagram of how its all connected.




I am going to reserve 4 more posts below to edit the instructions into
If you have a few esp chips, a few sensors and an internet connection feel free to build along!

I am NO expert on anything I do here.  Just an old student who needs a project to work on.

Edited by RyeJar (05/09/22 07:38 AM)

Extras: Filter Print Post Top
OfflineRyeJar
StrangerDanger


Registered: 04/16/15
Posts: 523
Last seen: 1 year, 3 days
Re: open source IoT agriculture automation (Taraxacum) [Re: RyeJar]
    #27769230 - 05/08/22 10:43 PM (1 year, 10 months ago)

*********************************************

    Server Side (back end services)   

*********************************************




Back in the day, back end development was hard and you spent most of your time developing a project in that area and it was proud work.  Now days amazon, microsoft and google have effectively abstracted most of the backend out of our lives and now we spend most of our days with front end development.

Here I will show how to setup a virtual server on amazon web services.  It is free for the first 3 months, and only 3.50 per month past that.  Its a great learning experience and quite easy if you are a beginner.  Setting up our server only takes 15 minutes and opens your projects up to wondrous things. 

If a cloud computing platform doesnt interest you, then you can set up a local server at your house using a raspberryPi or an old computer.  I have my own reasons for doing it in the cloud, so that is how I will show you.

Our server is going to serve a restAPI or two, an MQTT broker to revice all the data from our sensors, host a web server for the user interface of our web app and maybe a few other things.

IMPORTANT!  Grab a piece of scratch paper and keep it safe

First go to www.aws.com, create an account and go through the rounds.  FYI they will expect a valid email, a valid phone number and a valid credit card.  When finished click on the link “Go to the AWS Management Console”  where you will be prompted to log in again.


In the upper left hand corner click on "services" and from the dropdown click on "compute" and finally choose "lightsail" option from the menu that appears on the right.

There will be a big orange button that is predominant on the screen that says "Create Instance," click it.


At the top, choose your region.  You want to choose the region that is closest to your physical location.  Then for a blueprint choose the LAMP option


Then choose the free for three months 3.50 after that option and give your server a name.  I named it "webAppServer" then finish up and create the instance.  It takes a minutes to image the server and reboot so in the meantime lets go grab a static IP for the server so we can communicate with it. 


There are tabs labeled "instance, containers, database, networking etc near the top.  Click on the networking tab and click "create static ip"


Make sure you are in the correct region at the top, attach it to your new server from the dropdown and click create. 

WRITE THIS IP ADDRESS DOWN ON YOUR SCRATCH PAPER ON LINE 1


Now click on the "Instances" tab then click on the name of your instance and finally click on the "Networking" tab


We need to open up a few ports.  Click "add rule" and under "Port or range" enter the following ports one by one and click create each time.
-4000 (use in our API on our get, post, delete requests)
-3306 (mySQL)
-1883 (mqtt)
-8000 (phpmyadmin)

Good now we have a server up and running and a dependable address to reach it by.  Easy right? We set up an "ubuntu" linux server with a full LAMP stack.  LAMP stands for Linux, Apache, Mysql and PHP.  It is slowly becoming outdated but its super easy to work with and has decades of support and people that can help out through issues.  So I will say again, we initialized a linux machine with a web service (apache2), a database (mysql) and have that static ip in just TWO MINUTES. Quite cheeky.

That was the easy part.  The next few minutes are a little tougher to digest especially if linux is quite foreign to you.  If you are familiar with linux terminal than this is just basic everyday life.

I want to mention first, that it is preferable to create a key and use a third party ssh terminal to configure and work on the server, but I dont want to spend the time on how to do such on different operating systems for different software.  AWS allows us to SSH into our server from the browser on the lightsail web page and is very secure as long as your account is secure (good password and multi factor authentication is a must so google how to set up multi factor auth MFA)

We are just going to get all (or at least most) of the terminal stuff out of the way up front right now.  If you dont know linux, just copy and paste line by line.  Trust me, if you follow me down below line by line this will work and you never have to really worry about what you have done here.  If you truly want to know whats going on ask, and ill point you out to good references online.


So lets not delay.  Open up the terminal by clicking the button on your server (instance) you created.  Its the button in the green circle in the picture.

--------------------------------------------------------------------------------------
--  UPDATE SYSTEM AND CREATE AN ADMIN ACCOUNT

basic update for the system
Code:
sudo apt update && sudo apt upgrade



create account named admin
Code:
sudo adduser admin


choose a password and re-enter it
press enter 5 times and then type y and press enter


add user to the sudo “administrator” group
Code:
sudo usermod -aG sudo admin



switch user
Code:
su admin



------------------------------------------------------------------------------
--  SECURE YOUR WEBSITE DIRECTORY

Code:
sudo chmod 664 htdocs


------------------------------------------------------------------------------
--  INSTALL NODE JS AND REQUIRED MODULES
node js is a backend service that runs in C but you can write javascript code for your applications.  We will make a restAPI or two that allows the client to use or modify the database in the user interface.

install node package manager
Code:
sudo apt install npm -y



install node version manager
Code:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash



source the bash file
Code:
source ~/.bashrc



install current LTS version of node js
Code:
nvm install v16.15.0



create a directory to store your node projects in
Code:
sudo mkdir taraxAPI


Code:
sudo chmod 777 taraxAPI



install required node js modules
Code:
npm install express --save


Code:
npm install mysql --save


Code:
npm install cors --save


Code:
npm install body-parser --save


Code:
npm install https --save


Code:
npm install fs --save


Code:
npm install mqtt --save


Code:
npm install pm2 --save



generate self signed cert for https in the API
Code:
openssl genrsa -out key.pem


Code:
openssl req -new -key key.pem -out csr.pem


Code:
openssl x509 -req -days 9999 -in csr.pem -signkey key.pem -out cert.pem



create json files for the API
Code:
npm init



clone repository
Code:
(coming soon)



generate the startup script
Code:
pm2 startup


Code:
sudo env PATH=$PATH:/home/bitnami/.nvm/versions/node/v16.15.0/bin /home/bitnami/.nvm/versions/node/v16.15.0/lib/node_modules/pm2/bin/pm2 startup systemd -u bitnami --hp /home/bitnami



create a pm2 ecosystem so we can run multiple scripts in parallel
Code:
sudo nano ecosystem.config.js



copy the line below and paste it in the file

module.exports = {apps: [{name  : "restAPI", script: "./restAPI.js"}, {name: "mqttAPI", script: "./mqttAPI.js"}]}

press ctrl-x
press y then enter

start our scripts in pm2's production mode
Code:
pm2 start ecosystem.config.js



secure director
Code:
sudo chmod 755 /home/bitnami/taraxAPI



reboot for good measure (its a personal habbit)
Code:
sudo reboot now




------------------------------------------------------------------------------
--  INSTALL A MQTT BROKER AND SECURE IT

mqtt is a service for transmitting simple data in the form of strings across networks.  The broker authenticates and deals with published data from a device, then sends it to where it needs to go.  There is never a p2p connection to the end target.  Its such a great and simple service and supports encryption.  We will set up a password for the mqtt clients to use.  Use a secure password and write it down on line 2 of our scratch paper when we get there.

install the mqtt broker
Code:
sudo apt install mosquitto -y



Here we need to not allow anonymous connections and point mosquitto to the password file

Create a conf file and populate it with two settings
Code:
sudo nano /etc/mosquitto/conf.d/default.conf



copy and paste the two lines below into the new text file we created


allow_anonymous false
password_file etc/mosquitto/passwd


press ctrl-x
press y then enter

create a file that contains our usernames and password
Code:
sudo nano /etc/mosquitto/passwd


in this file we need to specify a username and password separated by a colon.  Keep the username "device" but replace the password with your own and write it down on line 2 of our scratch paper (IMPORTANT)


device: <choose your own password>

press ctrl-x
press y then enter

encrypt the password file
Code:
sudo mosquitto_passwd -U /etc/mosquitto/passwd



restart the mqtt service
Code:
sudo systemctl restart mosquitto




--------------------------------------------------------------------------------------
--  SETTING UP OUR SQL DATABASE AND CREATE AN ADMIN ACCOUNT

we need to find the root user password that was randomly generated when the instance was created
Code:
sudo cat bitnami_application_password



now log in to the sql server
Code:
mysql -uroot -p



now enter the password that spit out from above

now you are prompted with the mariaDB terminal prompt "MariaDB [(none)]>"

Code:
CREATE DATABASE operation;



create an admin account and replace <choose a password> with one of your choosing
Code:
CREATE USER 'sqlAdmin'@'localhost' IDENTIFIED BY '<choose a password>';



grant admin account all privileges on "operation" database
Code:
GRANT ALL PRIVILEGES ON operation.* TO 'sqlAdmin'@'localhost';



flush privileges
Code:
FLUSH PRIVILEGES;



create an account for our API and replace <choose a password> with one of your choosing
IMPORTANT: WRITE YOUR USERNAME DOWN ON LINE 3 AND PASSWORD DOWN ON LINE 4 OF YOUR SCRATCH PAPER
Code:
CREATE USER 'api'@'127.0.0.1' IDENTIFIED BY '<choose a password>';



grant api account all privileges on the "operation" database
Code:
GRANT ALL PRIVILEGES ON operation.* TO 'api'@'127.0.0.1';



flush privileges
Code:
FLUSH PRIVILEGES;




create the tables our database will use
Code:

CREATE TABLE zoneInfo(zoneId INT NOT NULL PRIMARY KEY AUTO_INCREMENT, zoneName VARCHAR(20));



Code:
CREATE TABLE desiredConditions(zoneId INT NOT NULL PRIMARY KEY AUTO_INCREMENT, lDesiredAirTemp INT, uDesiredAirTemp INT, lDesiredHumid INT, uDesiredHumid INT, lDesiredCo2 INT, uDesiredCo2 INT, lDesiredLightSched TIME, uDesiredLightSched TIME, lDesiredPh FLOAT, uDesiredPh FLOAT, lDesiredEc FLOAT, uDesiredEc FLOAT, pumpDuration INT, pumpInterval INT, lDesiredResTemp INT, uDesiredResTemp INT);



Code:
CREATE TABLE currentConditions(zoneId INT NOT NULL PRIMARY KEY AUTO_INCREMENT, airTemp INT, humid INT, co2 INT, lux INT, ph FLOAT, ec FLOAT, moist INT, resTemp INT);



Code:
CREATE TABLE sensors(myZoneId INT, myName VARCHAR(20), myCode VARCHAR(2),myAddress INT, myValue FLOAT);



Code:
CREATE TABLE plugs(myZoneId INT, myName VARCHAR(20), myCode VARCHAR(2),myAddress INT, myStatus BOOLEAN);



quit mysql terminal
Code:
quit



clone the web app repository
Code:
(coming soon)




//////////////////////
// OPTIONAL phpmyadmin

ssh tunnel on your personal pc so you can use phpmyadmin (OPTIONAL) requires ssh keys
Code:
sudo ssh -i <ssh key> -L 8888:127.0.0.1:80 bitnami@<server ip>





OK! Now we have 95% set up our server and secured it well enough for now.  All we have to do is clone some github code onto our server when the time is right.

Edited by RyeJar (05/23/22 06:05 AM)

Extras: Filter Print Post Top
OfflineRyeJar
StrangerDanger


Registered: 04/16/15
Posts: 523
Last seen: 1 year, 3 days
Re: open source IoT agriculture automation (Taraxacum) [Re: RyeJar]
    #27769231 - 05/08/22 10:44 PM (1 year, 10 months ago)

********************************************************

    Embedded Side Prototyping (sensor devices)   

********************************************************


The embedded section of this project contains all of the sensors and smart plugs connected to the system known as devices as a whole.


The heart of the embedded devices is the ESP8266MOD IC.  Its a little outdated but is quite the little performer.  With
a.) a single core 80mhz, 4MB flash, built in WiFi 802.11 b/g/n and full TCP stack
b.) compatibility with i2c protocol and plenty of GPIOs,
c.) an operating voltage of 3.3V makes powering it off of a battery easy
d.) a cost of $1.30 and worldwide support of the ESP8266 makes this a perfect little chip.


I have 5 nodemcu12 development boards based off of the ESP8266MOD so I plan initially to put together a few sensors to start feeding the server some data, and then a special type of smart plug that we will see really soon when I finish putting it together.  So lets break out the breadboards….

----  Sensors ----

So my idea with these sensors is to make them as flexible as possible.  If the end user doesn’t care to measure the humidity of the zone they need not put one together and it wont matter in the end.  Maybe one greenhouse gathers a mold problem so then a humidity sensor can be put together and deployed for that greenhouse alone.  Sensors will also be able to seamlessly transfer from one room to another or be removed from the system completely (by initiating a factory reset)

Keeping in mind that most sensors will be run off of batteries, power management is key.  In sleep mode, a ESP8622 can consume as little as 21uA.  So the sensors will go through this loop…

1.) is there a configuration file stored in flash?
  a.) Yes, then we will connect to the server, gather our sensor data,
      publish the data along with a unique device identifier, 
      disconnect from the server and go to sleep for 1 -2 minutes.
  b.) No, then we go into access point mode and host a web page so as
      to get config information from the user.
2.) Repeat


-- Air Temp Sensor Device --


So this Air Temp Sensor’s heart is the cheap and accurate DS18B20. 
for temperature it can sense -55 - 125°C / with a resolution that can be set from 9 to 12 bits.  Plenty good if you ask me. The time it takes to receive a valid response can be up to 750ms at 12 bit resolution. 

Ive thrown some leds on for error codes.  I put the three leds on PWM pins for possible effects in the future. Also is a general push button to be used in the future possibly.  I don't have any push buttons so I used a jumper on my breadboard I can short with a screw driver.  Finally a 680 ohm resistor to connect GPIO16 (labeled D0) to the RST pin (labeled RST) to wake the MCU up after a predefined amount of time.

You will need…
1x nodemcu12 dev board
1x DS18B20 temperature sensor
1x push button
1x 3mm green led
1x 3mm yellow led
1x 3mm red led
2x 220 ohm resistor
1x 330 ohm resistor
1x 2.2k ohm resistor
1x 680 ohm resistor
1x 4.7k ohm resistor

Here is the schematic



Here it is built on a breadboard



current github repo (real link coming soon)
https://github.com
------------------------------------------------------------

-- Humidity Sensor Device --


So this device uses a fairly accurate humidity sensor known as the AM2302 sensor.  The AM2302 can sense humidity with temperature compensation.  They are a little spendy but to the point they can sense 0-100% ± 2% humidity, and for temperature it can sense -40 - 125°C / ± .5°C.  Other than that it is quite similar to the Air Temperature Sensor from above.

You will need…
1x nodemcu12 dev board
1x AM2302 humidity sensor
1x 3mm green led
1x 3mm yellow led
1x 3mm red led
2x 220 ohm resistor
1x 330 ohm resistor
1x 2.2k ohm resistor
1x 680 ohm resistor
1x 4.7k ohm resistor (if your sensor doesnt have one built in connect from Vcc to the data pin) mine has it so its not on the schematic

Here is the schematic



Here it is built on a breadboard


current github repo (real link coming soon)
https://github.com



------------------------------------------------------------
------------------------------------------------------------

-- Co2 Sensor Device --

(coming when i get money.  good co2 sensors arent cheap)

Here is the schematic
Here it is built on a breadboard
current github repo (real link coming soon)
https://github.com

------------------------------------------------------------
------------------------------------------------------------




-- Light Sensor(lux) Device --


Powering this sensor is the TSL2591 SOM.  For agricultural use, lux is pretty useless admittedly and a PAR sensor would be superior, but also magnitudes more expensive.  I figure more than anything, a cheaper lux meter would be handy to know if artificial lights are actually on (did a bulb blow out?) and how much light is in your room during the darkness cycle.  The TSL2591 uses .4mA when active and less than 5uA when in sleep mode.  It can sense a range from 188uLux up to 88,000 lux. The schematic as a whole looks pretty like the air temp sensor except for the sensor SOM being used

You will need…
1x nodemcu12 dev board
1x TSL2591 SOM sensor
1x push button
1x 3mm green led
1x 3mm yellow led
1x 3mm red led
2x 220 ohm resistor
1x 330 ohm resistor
1x 2.2k ohm resistor
1x 680 ohm resistor

Here is the schematic



Here it is built on a breadboard



current github repo (real link coming soon)
https://github.com
------------------------------------------------------------

-- Moisture Sensor Device --


For this device we are using an analog capacitive sensor.  This causes me an issue.  On any battery devices, I want to save the one and only analog pin for current battery voltage.  Plus I have no use for constant readings, so I put an arduino nano in between and when I need a reading, I’ll send a request to the arduino over i2c.  Over time the arduino will be replaced by a small attiny85 chip and will be integrated onto the capacitive sensor of my own making creating a i2c moisture sensor SOM.  This sensor isn’t necessary really at all unless you want to turn on a pump when the moisture gets down to a certain point which admittedly seems unsafe at best.  I do feel it would be nice to use it as an alarm service.  Maybe there is a pump failure on an NFT system and you can get alerted by text.  This can be a life saver on a hot day where your outside plants may not last 2 hours without a pump.

You will need…
1x nodemcu12 dev board
1x arduino nano dev board
1x capacitive moisture sensor from DRF-Robot
1x push button
1x 3mm green led
1x 3mm yellow led
1x 3mm red led
2x 220 ohm resistor
1x 330 ohm resistor
1x 2.2k ohm resistor
1x 680 ohm resistor


Here is the schematic




Here it is built on a breadboard



current github repo (real link coming soon)
https://github.com
------------------------------------------------------------

-- Reservoir Sensor Device --


This one is quite exciting.  Right now I am using a lot of parts from atlas scientific because I bought these SOCs a few years ago.  In the future I would like to create my own by adding a attiny85 to an existing high quality pH and eC analog sensor.  For now though I have both pH and eC circuits electrically isolated using atlas scientific’s inline isolator that features the ADM 3260 IC that has a max data rate of 1mhz.  According to the datasheets of the pH SOC and eC SOC, my breadboard usage is absolutely the wrong way to go for accurate readings for numerous reasons, but we don’t need accurate readings yet.  We just need a working product.  Also used on this sensor is a waterproof DS18B20 to read the reservoir temperature.  Handy for the user to know, but paramount to getting accurate compensated pH and eC readings.  You will also notice that we have three push buttons attached to the analog pin.  Since this sensor is not battery operated, I can use the analog pin to attach multiple buttons.  One button is for a pH calibration function, another for eC calibration and one more not decided on yet.


You will need…
1x nodemcu12 dev board
1x pH probe with bnc connector (diff types will be updated later)
1x eC probe with bnc connector (diff types will be updated later)
1x atlas scientific pH EZO SOC
1x atlas scientific eC EZO SOC
2x atlas scientific inline isolator EZO SOC
2x female PCB BNC connectors
3x push button
1x 3mm green led
1x 3mm yellow led
1x 3mm red led
6x 220 ohm resistor
1x 330 ohm resistor
1x 2.2k ohm resistor
1x 680 ohm resistor
1x 4.7k ohm resistor

Here is the schematic



Here it is built on a breadboard



current github repo (real link coming soon)
https://github.com
------------------------------------------------------------

Now that we have a sensor device for each of our 8 environmental conditions lets work on uploading the code and configuring our sensors to connect to our server we created in the section above.

Edited by RyeJar (05/18/22 10:52 PM)

Extras: Filter Print Post Top
OfflineRyeJar
StrangerDanger


Registered: 04/16/15
Posts: 523
Last seen: 1 year, 3 days
Re: open source IoT agriculture automation (Taraxacum) [Re: RyeJar]
    #27769233 - 05/08/22 10:44 PM (1 year, 10 months ago)

**************************************************************

    Embedded Side Prototyping (smart plug devices)   

**************************************************************


For my smart plug devices, we have 5 different types technically but really its just basically two devices as we will see.

1.) A smart plug device that is pretty much how you would imagine.  It plugs into your basic 110V US plug, and allows a 110V US plug device to be plugged into it and you can control what when and why it turns on or off.
2.) The second and third devices is pretty much the same as above but it connects to 110VAC via screw terminals and will supply 110V AC OR 12V/5V/3VDC so you can build and implement your own AC or low voltage appliances.
3.) The fourth device is a pH doser.  It will plug into a outlet, and control two peristaltic pumps to dose your reservoir with pH Up or pH Down solutions.
4.) The fifth device is a nutrient doser.  It is exactly the same as above, but will have three pumps for 3 part nutrient products. 

So all in all its basically just two different types of plugs each with a simple variation.
------------------------------------------------------------

-- Smart Plug --

WARNING:  This deals with mains voltage which is pretty stupid to be honest.  Do not build or follow this writeup unless you know what you are doing.  I DO NOT KNOW WHAT I AM DOING so therefore dont listen to me.

I wish I knew an electrical engineer to help me through most of my project when i go to finalize it, but I wish I knew one for these devices most.  Anyhow, lets get to the stupidity.




We've all seen them on the market.  A plug that is, well, smart i suppose.  This is the most versatile device my project would offer to the beginner.  Plug into the wall, plug say a heater into it, crank the heater to high and the server will tell the plug when to turn on or off depending on the airTemp of the room.

maybe a version that can be wired into the wall instead of plugged in would be interesting.

WARNING: This is just a proof of concept prototype for now.  This truly needs some kind of over current protection and possibly thermal shutdown protection before being left to work unsupervised.  A temperature sensor and a inline fuse will work its way to the "embedded finalized" section below.

To make this, I ripped a 5v rectifier out of an apple phone charger to power the esp8266 from the mains voltage (pictured in the first pic below on the white outlet panel) soldered it to the mains, wrapped it up heavy with electrical tape and shoved it inside the outlet box, made a pcb esp8266 prototype board and wired everything up best i could.  The plug cord is from a old PC power cord.


You wont be making this so you will not need…
1x nodemcu12 dev board
1x electrical box (a double gang preferred in hindsight)
1x electrical outlet
1x electrical box cover panel
1x 3.3V relay module
1x 110VAC to 5VDC rectifier
1x PCB 2"x 2"
1x scrap cord


Here is the schematic


Here it is built







current github repo (real link coming soon)
https://github.com

------------------------------------------------------------

-- Smart Plug with 110VAC Breakout --

(coming soon)

Here is the schematic

Here it is built

current github repo (real link coming soon)
https://github.com

------------------------------------------------------------

-- Smart Plug with 12/5/3VDC Breakout --

(coming soon)

Here is the schematic

Here it is built

current github repo (real link coming soon)
https://github.com

------------------------------------------------------------

-- pH Pump Smart Plug --
Although it is named a smart plug, there is nowhere for you to plug any devices into it.  Instead it turns one of two pumps on. One pump can pump pH Up into your reservoir and the other can pump pH Down into your reservoir when needed.  So lets take a look at what is under the hood.


First off we are going to use the popular DRV8825 motor driver SOC to drive a stepper motor.  This driver can accept up to 45 volts, can handle up to 2.2 amps per coil and has over-temperature thermal shutdown, over-current shutdown, and under-voltage lockout.



The motors I chose were the nema17 bi-polar stepper motors.  They have 200 steps per 1 revolution, plenty of torque to drive a peristaltic pump, plenty cheap and the nema17 is the most popular size for these motors meaning plenty of attachments are ready made for them.  Attachments such as these handy pump heads pictured below.


These pump heads paired with a stepper motor means the most accurate dosage possible of each chemical.  A fraction of a mL is possible.  It will take some time testing it to figure out how to keep the pumps primed so accuracy is maintained.  A check valve of sorts maybe?  We shall see.

Now each motor driver (DRV8825) will be attached to an arduino nano for the prototype.  Eventually the small attiny85 will replace the arduino and hopefully I can make a clip to attach it to the rear of the motor.  The ESP8266 will communicate with each driver via i2c to each of the arduino nanos.

I ran out of breadboards, and a breadboard wouldn't work so well anyways for this prototype, so I took 3 pcbs and made prototype boards for the ESP8266, and the two arduino/DRV8825 combos, and shoved everything into a rubbermaid container as you will see.

You will need…
1x nodemcu12 dev board
2x arduino nanos
2x DRV8825 Motor Drivers
2x Nema17 sized Stepper Motors
2x Peristaltic Pump Heads of correct size
2x 100 uF Electrolytic Capacitors
1x 10 uF Electrolytic Capacitors
1x .1 uF Electrolytic Capacitors

Here is the schematic

I am quite horrible with schematics, so I took one of the arduino nano/DRV8825 sections out to make this more readable.  Just make two, and make sure to connect pin A5 and A4 of the arduino to D1 and D2 pins of the nodeMCU respectively.  These are the i2c lines of each device.  A5 and D1 is SCL, A4 and D2 is SDA.

Just as horrible at circuit analysis too.  The capacitors near the DRV8825 is the capacitor value called for in the datasheet.  The two other caps near the voltage supply are arbitrary values I normally use to "smooth" i guess the signal.  I dont have a scope to really check so they are just guesses.  If anyone has any input please let me know.



Here it is built





I didn't add a button or leds on this one for no good reason but time, but a future revision will receive these.  I have found out on my other devices that having really good led codes helps debug my device without having to hook it up to my PC and stare at a serial monitor. 


current github repo (real link coming soon)
https://github.com
------------------------------------------------------------

-- Nutrient Pump Smart Plug--

(coming soon)

Here is the schematic

Here it is built

current github repo (real link coming soon)
https://github.com

Edited by RyeJar (05/23/22 03:55 PM)

Extras: Filter Print Post Top
OfflineRyeJar
StrangerDanger


Registered: 04/16/15
Posts: 523
Last seen: 1 year, 3 days
Re: open source IoT agriculture automation (Taraxacum) [Re: RyeJar]
    #27769235 - 05/08/22 10:44 PM (1 year, 10 months ago)

*************************************

    Embedded Side Finalization   

*************************************


(coming soon)

Edited by RyeJar (05/09/22 07:30 AM)

Extras: Filter Print Post Top
OfflineRyeJar
StrangerDanger


Registered: 04/16/15
Posts: 523
Last seen: 1 year, 3 days
Re: open source IoT agriculture automation (Taraxacum) [Re: RyeJar]
    #27769484 - 05/09/22 06:59 AM (1 year, 10 months ago)

********************************************************

    Client Side (user interface to the web app)   

********************************************************


(coming soon)

Edited by RyeJar (05/09/22 07:32 AM)

Extras: Filter Print Post Top
OfflineRyeJar
StrangerDanger


Registered: 04/16/15
Posts: 523
Last seen: 1 year, 3 days
Re: open source IoT agriculture automation (Taraxacum) [Re: RyeJar]
    #27769494 - 05/09/22 07:25 AM (1 year, 10 months ago)

************************

    Integration Hell   
   
************************


(coming soon)

Edited by RyeJar (05/09/22 07:34 AM)

Extras: Filter Print Post Top
OfflineRyeJar
StrangerDanger


Registered: 04/16/15
Posts: 523
Last seen: 1 year, 3 days
Re: open source IoT agriculture automation (Taraxacum) [Re: RyeJar]
    #27783418 - 05/18/22 06:37 PM (1 year, 10 months ago)

Just a quick update.  I am still working on the project when i get some time from work and classes.  Nothing gets to go into one of the above sections until its really ready so small updates will go into a reply below.

Im not going to upload any code until everything is integrated and working.

DISCLAIMER!  Even though small things like paddings and margins are still yet to be done, I personally have no experience with any type of graphical design.  I would like to pair up with someone who is artistic to really lock down fonts, font sizes, colors and placement of my elements.  I think my colors really need work, and some sections like the "device edit"  and "device remove" elements have no color at all yet.


Ive updated the server side section because there were a few problems.  I have double checked it and for now id say it gets your server about 95% set up.  I am also trying to work on bash scripts to make the setup much easier for people who hate linux or hate terminal work in general.  It should ease up 80% of that work in just two steps.









For the embedded sensors, id say I got the code about 90% there.  They host a web server to gather needed info such as the wifi ssid and password, along with the server IP and the mqtt password and stores it into flash and resets itself.  Wakes up, polls the sensor, connects to the the mqtt broker on the AWS server and publishes its data and goes into sleep mode for a minute.




Ive been wearing my fingers out working mostly on the web app or user interface.  As of now I have some refactoring of my code to work on, but we are looking at 238 lines of markup code, 660 lines of CSS and 1050 lines of javascript.  So bare with me.  Im working as fast as I can.



As you can see I have stolen the firefox logo temporarily because I love that logo for reasons.  I need to hire someone to make me a logo before long and you can see the project's code name "tarax".  Below is the name of the current zone you are looking at along with any relevant info.  If you dont connect a ph sensor to the current zone, it wont display any info about ph as you can see in my mock "cloning zone".  The two buttons on the sides scroll through the different rooms and there is a settings button that does nothing as of right now.  This webpage is currently responsive as long as its in portrait mode.  I still have to work on responsiveness to tablets or desktop PCs.

As a note, all the sensors, sensor info, plugs and enviromental conditions are just hard coded into a database.  I set up 4 temporary rooms with an array of sensors and plugs. 







You can click on any of the conditions present in the zone which takes you to a control screen.  Here all of the sensors or plugs attached to that condition of the current zone is listed in a scrollable element that displays the current value of a sensor, or a red or green circle to show whether the smart plug is on or off.  Each device has a type and a user inputted name.

There is also a graph button to show you historical data is present and a numpad where you can input the desired range of that condition you want.

I do have a restAPI on the server running that is giving the web app all the information from the database. 

The api and web app is close to done.  I still have to add the functionality of adding or removing rooms, adding sensors, and editing room names.

Edited by RyeJar (05/30/22 04:38 AM)

Extras: Filter Print Post Top
OfflineMAIA
World-BridgerKartikeya (DftS)
Male User Gallery


Registered: 04/27/01
Posts: 7,396
Loc: Erra - 20 Tauri - M45 Sta...
Last seen: 2 months, 15 days
Re: open source IoT agriculture automation (Taraxacum) [Re: RyeJar]
    #27784057 - 05/19/22 09:36 AM (1 year, 10 months ago)

Man ... I commend you for your effort.

It's looking fucking great !

As a coder myself, like 4 years ago I bought an arduino, boards and many sensors. The idea was to use sensors to manage - using software - a relay system to turn on and off heaters, fans, lights and humidifiers. The idea was much simpler than what you did but I never managed to have the time nor the patience to build the thing.

Imho, an open source project with prototyping, with available cheap hardware, is a game changer. Either growing plants or mushrooms. I'll pay more attention to your project in the future.

Thanks!


--------------------
Spiritual being, living a human experience ... The Shroomery Mandala



Use, do not abuse; neither abstinence nor excess ever renders man happy.
Voltaire

Extras: Filter Print Post Top
OfflineRyeJar
StrangerDanger


Registered: 04/16/15
Posts: 523
Last seen: 1 year, 3 days
Re: open source IoT agriculture automation (Taraxacum) [Re: MAIA]
    #27784404 - 05/19/22 02:29 PM (1 year, 10 months ago)

Thanks for the kind words.  Ive made many projects that I can code that works for me and takes just a few hours, but I thought I needed the experience of actually creating a solution that an end user would be willing to use and have a pleasant time using.  That in itself is by far the hardest thing about this project.  Pleasing an end user.  Bleh!

UPDATE!
For anyone curious, since yesterday Ive updated the embedded prototype sensors section to include a smart plug and a pH pump that really starts to round out the project.  I am officially out of parts now (in fact im behind a few esp8266 chips for the devices Ive already shown) and im too poor so I cant finish the smart plug section for a while.  Finishing the software for what I got will be my priority.

I go back to work today so it will be a week before any updates are posted.  Good luck to y'all

Extras: Filter Print Post Top
OfflineMAIA
World-BridgerKartikeya (DftS)
Male User Gallery


Registered: 04/27/01
Posts: 7,396
Loc: Erra - 20 Tauri - M45 Sta...
Last seen: 2 months, 15 days
Re: open source IoT agriculture automation (Taraxacum) [Re: RyeJar]
    #27784451 - 05/19/22 03:00 PM (1 year, 10 months ago)

Quote:

Pleasing an end user.




Heard that too many times in UI and UX classes XD

Keep it up and good luck to you too.


--------------------
Spiritual being, living a human experience ... The Shroomery Mandala



Use, do not abuse; neither abstinence nor excess ever renders man happy.
Voltaire

Extras: Filter Print Post Top
OfflineRyeJar
StrangerDanger


Registered: 04/16/15
Posts: 523
Last seen: 1 year, 3 days
Re: open source IoT agriculture automation (Taraxacum) [Re: MAIA]
    #27798582 - 05/30/22 04:29 AM (1 year, 9 months ago)

So i screen captured a small demo of what I have so far.  As of now I got a pretty good working set of APIs setup on the server and now we can build up our "operation" starting from scratch.

There is up to a 60 second lag from adding a device that will eventually be operated on batteries, and the UI actually recognizing it since the device sleeps for 60 seconds in between readings to save battery.   

I have four devices I can hook up to the operation right now since I have four micro usb cables. There are some problematic bugs I am still working on (such as deleting the last zone at the end doesnt update the home screen and i had to reload the page manually) but so far I am pretty happy with how its coming out so thanks for checking it out!


I pre configured each device using my cell phone and I dont have screen capture software on my phone.  Here is a screen shot of what the form looks like tho.


FYI there is A LOT of formatting still to be done on the user interface.  Placement of elements will change in the future, the input forms will change, colors will change and such, but its not too bad right now.  Im going to find someone to collab with to lock down the looks of the interface and add subtle professional animations.



Edited by RyeJar (05/30/22 04:32 AM)

Extras: Filter Print Post Top
Jump to top Pages: 1

Shop: Left Coast Kratom Buy Kratom Extract   Myyco.com Golden Teacher Liquid Culture For Sale   North Spore North Spore Mushroom Grow Kits & Cultivation Supplies   Original Sensible Seeds Autoflowering Cannabis Seeds   Bridgetown Botanicals Bridgetown Botanicals   Kraken Kratom Kratom Capsules for Sale   PhytoExtractum Buy Bali Kratom Powder   MagicBag.co All-In-One Bags That Don't Suck


Similar ThreadsPosterViewsRepliesLast post
* Live kratom source
( 1 2 all )
esin 8,817 38 03/31/08 05:15 AM
by royer
* Can plants think? New research opens a window to the minds of plants HagbardCeline 2,009 9 03/05/05 06:56 AM
by delta9
* Sustainable DMT Source?
( 1 2 all )
hnc 4,552 21 06/03/05 05:50 PM
by Psiloman
* Opioids from sources other than poppies and kratom (not pharmaceuticals)
( 1 2 all )
stvip 10,766 39 05/09/08 02:41 AM
by pixeljuice
* Zone 5 Dmt source plant? LOBO 6,455 10 03/07/02 11:46 AM
by rommstein2001
* Kratom resin extract sources. OrangeVWCamper 1,655 10 12/10/04 06:39 PM
by OrangeVWCamper
* HELP!! Anyone else have problems with River's Source Botanicals?? blazed123 4,037 18 11/15/05 07:09 PM
by Prisoner#1
* Favourite HBWR source? Openminded 1,712 9 07/20/04 02:20 AM
by stefan

Extra information
You cannot start new topics / You cannot reply to topics
HTML is disabled / BBCode is enabled
Moderator: Mostly_Harmless, A.k.a
1,394 topic views. 1 members, 8 guests and 8 web crawlers are browsing this forum.
[ Show Images Only | Sort by Score | Print Topic ]
Search this thread:

Copyright 1997-2024 Mind Media. Some rights reserved.

Generated in 0.028 seconds spending 0.007 seconds on 14 queries.