AquaticSuppliers.com     Golden State Discus

Results 1 to 9 of 9

Thread: DIY Control - RaspberryPi4 - Raspbian - NodeRED - AtlasSci Inst - NCD ExpI/O over i2c

  1. #1
    Gold Member FischAutoTechGarten's Avatar
    Join Date
    Apr 2003
    Location
    Green Valley, Arizona, USA
    Posts
    1,179
    iTrader
    1 (100%)
    Real Name
    Peter

    Default DIY Control - RaspberryPi4 - Raspbian - NodeRED - AtlasSci Inst - NCD ExpI/O over i2c

    I'm building a YAAC = Yet Another Aquarium Controller. Don't worry, I will give it another name.
    Switched gears again on this thing... but have something worth showing. No Arduino, No Windows10IoT, No VisualStudio UWP app, etc...

    I'm building my own controller using a RaspberryPi4 running Raspbian Linux, Node-RED Software, and Atlas-Scientific i2c Sensors and NCD i2c Expansion Boards for Control... It's just in it's infancy... At the moment, I just have 4 sensors coming in. When I receive a part this week, I will enable Temperature control based on the RTD and CO2 fertilisation based on pH. Everything else will come later as I learn to use NodeRed with other hardware components. Here is a photo of it's quick and dirty Node-RED dashboard on the small 7" PI4 screen (when I'm done, it will be run in Kiosk mode and loose all of the Chromium stuff that is taking up so much real estate).



    If you are into Node-RED, I'll post the Flow that I have so far all the way at the bottom of this post.

    Don't know if anyone is interested, but I am clearing out a ton of IoT related stuff that would be useful for anyone doing a DIY Aquarium Controller.


    Atlas-Scientific stuff and an absolute ton of Arduino Stuff in two separate auctions.. It just seems wrong not to point it out to the DIYs here building their own aquarium controllers... So you will have to send me PMs to ask about the auctions as it is against policy to include the Ebay Auction links here..

    I hope someone is able to make use of all of this great material. It's the last I'll mention it... This thread is all about the Aquarium Controller. AS I make progress, I'll post pictures here, but I will post code updates on the Node-RED site... I will include a link to the code updates here though, just in case anyone is following it.

    Okay, so if you know how Node-RED works you just copy all of this text below and then paste that code into a blank flow of your own in Node-RED... and you'll see it pop before your eyes. I used the default i2c addresses and the default configuration of the Atlas-Scientific EZO circuits, so if you do the same this code should just work. This is the first and last time that I will post actual code updates here in this thread...as stated above, it will just be a link to it.
    Last edited by Second Hand Pat; 05-06-2020 at 06:53 AM. Reason: Removed code and pics as requested by Peter.
    Peter
    Cuerpo en Green Valley, Arizona, USA y Corazón en Alamos, Sonora, Mexico

    learning never stops

  2. #2
    Gold Member FischAutoTechGarten's Avatar
    Join Date
    Apr 2003
    Location
    Green Valley, Arizona, USA
    Posts
    1,179
    iTrader
    1 (100%)
    Real Name
    Peter

    Default Re: DIY Control - RaspberryPi4 - Raspbian - NodeRED - AtlasSci Inst - NCD ExpI/O over

    The Control has been added. Presently using Relays directly controlled/wired to the RaspberryPi GPIO. Still waiting to receive my i2c Expansion Board so that all sensors/io communicate over a bus instead of being directly wired to the microcontroller. Just plugged turned it on and tested. You can see for Temp and pH that I am calling for the Heater (green dot) and the CO2 fertilisaton (green dot).

    Using hysteresis for control.... to keep from constantly switching the relays on/off. For Temp, I want 27degC (about 80degF). So at 26.75 I will turn heat on.... at 27.25 I will turn heat off... That's reverse acting control. Not sweating the small temperature swing because with my inexpensive directly wired relays, I'm just tying to keep the duty cycles at a minimum. Ditto for pH... Desiring 7.0.. So at 7.05 I will turn on CO2, at 6.95 I will shut CO2 off. That's direct acting control.

    Setpoints are set by a schedule, which of course doesn't change... but that allows the system to startup with defaults without going through a routine to set everything.. I will program the setpoint slider controls to override the schedule, but for now, they just follow and indicate what the schedule dictates.

    I moved the controller over to a 'live' 5 gallon aquarium... Don't have a means for hooking up the flow meter with this particular setup.. so it's reading zero.... until I move the controller over to a 20L where I can hookup an external pump... and plumb in the flow meter and a flow switch..

    FATG-AtlSci-Ctlr-Alpha.jpg

    I created a 2nd screen that is used simply for monitoring and controlling the RaspberryPi4 Microcontroller. Just swiping the screen left or right changes the screens... It's a slicker way to navigate instead of adding page links to each screen...

    FATG-RPI4-Ctlr-Alpha.jpg

    Screen indicates my CPU is hardly working at all at 1%. However, it is running a little warmer than I would prefer. I do have it overclocked by 20% and I'm still waiting for my cooling fan... I can always knock the speeds back down to stock without affecting performance at all.
    Last edited by FischAutoTechGarten; 04-11-2020 at 01:58 PM. Reason: added additional photo.
    Peter
    Cuerpo en Green Valley, Arizona, USA y Corazón en Alamos, Sonora, Mexico

    learning never stops

  3. #3
    Gold Member FischAutoTechGarten's Avatar
    Join Date
    Apr 2003
    Location
    Green Valley, Arizona, USA
    Posts
    1,179
    iTrader
    1 (100%)
    Real Name
    Peter

    Default Re: DIY Control - RaspberryPi4 - Raspbian - NodeRED - AtlasSci Inst - NCD ExpI/O over

    Started a Controller build thread on the Node-RED forums. It's very focused on the Atlas-Scientific i2c sensors and getting data in and out. Lots of progress has been made. I'm even doing control over relays on that i2c enabled relay expansion board now...

    Sonora Technical's Aquarium Controller w/ Node-RED, RaspberryPI and Atlas-Sci.
    Peter
    Cuerpo en Green Valley, Arizona, USA y Corazón en Alamos, Sonora, Mexico

    learning never stops

  4. #4
    Gold Member FischAutoTechGarten's Avatar
    Join Date
    Apr 2003
    Location
    Green Valley, Arizona, USA
    Posts
    1,179
    iTrader
    1 (100%)
    Real Name
    Peter

    Default Re: DIY Control - RaspberryPi4 - Raspbian - NodeRED - AtlasSci Inst - NCD ExpI/O over

    My thread on the Node-RED website was closed for inactivity (they do that after 30 days of no posting). I'll have them re-open it.

    Meanwhile, I thought I'd just show a little progress I've made. I added Conductivity and Dissolved Oxygen Sensors, Some Duty Timers (need them to reset every 24hours) and a Pump Control. Yeah... still working on the Dosing Pumps, with two present it changes my coding methodology a bit.

    SensorRunStatus.jpg

    Big deal was working with the Atlas-Sci EZO circuits and figuring out how to do a few things (turn off their built-in LEDs, change addresses, factory reset, enable temperature compensation, and most importantly.. calibration!). I did not do this alone! I received help and some shared code from a guy named MaddyP on one of the Reef forums who is attempting something similar to me.
    Status is a little misleading as 'Powered Off' on each of the sensor circuits... they are certainly powered-up and running'. The Status is really the 'Last Restart Reason'.... hence.. the sensor circuits restarted because it was power shutdown, software shutdown, watchdog expiration, a power brownout, etc...).

    SensorConfigCalibScreen.jpg

    Nice dialogue to warn about wiping calibrations before you start. Ph is a 3-point calibration... Temperature is 1-point, Dissolved Oxygen is 2-point, Conductivity is 3-point, Oxygen Redox Potential is 1-point. Still working on Flow and Dosing Pump calibrations too.

    SensorBeginpHCalibDialogue.jpg

    I need to recondition my Dissolved Oxygen probe and afterwards calibrate it as it's not reading well.. Need to calibrate the ORP and Conductivity as well (my solutions are expired...but maybe I'll use them anyway).

    I'm upto about 6 different display pages on the little 7" 800x480 touch lcd. The Node-RED Dashboard runs in the Chromium browser of the RaspberryPi OS. I need to enable the Kiosk mode for Chromium on the LCD so that I can start to resize and make things fit a little better. Have a touch screen keyboard working now too.
    Last edited by FischAutoTechGarten; 09-28-2020 at 03:11 PM.
    Peter
    Cuerpo en Green Valley, Arizona, USA y Corazón en Alamos, Sonora, Mexico

    learning never stops

  5. #5
    Gold Member FischAutoTechGarten's Avatar
    Join Date
    Apr 2003
    Location
    Green Valley, Arizona, USA
    Posts
    1,179
    iTrader
    1 (100%)
    Real Name
    Peter

    Default Re: DIY Control - RaspberryPi4 - Raspbian - NodeRED - AtlasSci Inst - NCD ExpI/O over

    Made some more progress... Figured out LED dimming using a few PWM chips and LEDs under Node-RED. Did a nice test. So now, I will install the hardware to control all 8 24V 6W Stunner Strips that make up the lighting for the 4 dispaly tanks in this rack... (Looking at an NCD.io PWM 16channel card).
    Peter
    Cuerpo en Green Valley, Arizona, USA y Corazón en Alamos, Sonora, Mexico

    learning never stops

  6. #6
    Registered Member
    Join Date
    Jun 2020
    Location
    UAE
    Posts
    327
    iTrader
    0

    Default Re: DIY Control - RaspberryPi4 - Raspbian - NodeRED - AtlasSci Inst - NCD ExpI/O over

    It looks great! How much did it cost you: Raspberry as well all probes?

  7. #7
    Gold Member FischAutoTechGarten's Avatar
    Join Date
    Apr 2003
    Location
    Green Valley, Arizona, USA
    Posts
    1,179
    iTrader
    1 (100%)
    Real Name
    Peter

    Default Re: DIY Control - RaspberryPi4 - Raspbian - NodeRED - AtlasSci Inst - NCD ExpI/O over

    Quote Originally Posted by pablos View Post
    It looks great! How much did it cost you: Raspberry as well all probes?
    it would have been cheaper to go all in on a full Neptune system.
    when i'm done, i'm sure that I will have well over $1500 usd, but that does include the 2 dosing pumps... so that skews it because that is more equipment than the controller.
    my device will also serve as a 4 channel light dimmer and 4 channel wave pump controller.

    it could be done much cheaper. i often integrated components from vendors instead of 'inventing/building' absolutely everything. i didn't design my sensor circuits, but integrated sub assemblies from atlas-scientific for each probe.... so there is several hundred dollars doing that. I also didnt' use any of the Raspberry Pi's GPIO, but purchased standalone i2c capable relay, pwm, and discreet i/o term boards that carry features that I would have struggled to design and build. again, several hundred dollars could be saved if someone built their own. I used nicer bnc connectors, waterproof connectors for other devices (level switches, etc..), a rather expensive metal chassis, an official raspberrypi 7" touch lcd..and the latest raspberrypi4B w/ 4GB of ram. This has been a multi-year project that has changed direction several times.. so the money was spent so slowly, i hardly feel it.

    When I'm all done, I'll put together a BoM (bill of material) and release all of my Node-RED flows so that someone can copy it.

    That said.... it would be cheaper for someone to go all in on a Neptune. I just really wanted to tackle the project and build my own... but I certainly didn't save any money doing it this way.
    Peter
    Cuerpo en Green Valley, Arizona, USA y Corazón en Alamos, Sonora, Mexico

    learning never stops

  8. #8
    Gold Member FischAutoTechGarten's Avatar
    Join Date
    Apr 2003
    Location
    Green Valley, Arizona, USA
    Posts
    1,179
    iTrader
    1 (100%)
    Real Name
    Peter

    Default Re: DIY Control - RaspberryPi4 - Raspbian - NodeRED - AtlasSci Inst - NCD ExpI/O over

    I should point out though, I'm able to call up the UI for my controller remotely on a Web browser from any cell phone, tablets, laptop, desktop in my home and Node-RED does a nice job of scaling the Dashboard that I built so that it is very readable and useable regardless of screen size / resolution. (just extra scrolling on smaller displays). I'm going to allow routing from outside the home to pull up the UI as well so that I can remotely monitor and control. So, that's 'free' capability with the route I've gone with my adoption of Node-RED as my development environment. I'll be doing data logging to a MySQL DB and publishing to Graphana as well... again 'free' capability available on the RaspberryPi OS..
    Peter
    Cuerpo en Green Valley, Arizona, USA y Corazón en Alamos, Sonora, Mexico

    learning never stops

  9. #9
    Gold Member FischAutoTechGarten's Avatar
    Join Date
    Apr 2003
    Location
    Green Valley, Arizona, USA
    Posts
    1,179
    iTrader
    1 (100%)
    Real Name
    Peter

    Default Re: DIY Control - RaspberryPi4 - Raspbian - NodeRED - AtlasSci Inst - NCD ExpI/O over

    I haven't updated this in a long time. The UI is a bit different and allot of features have been added (and one removed).

    I no longer control the lights from this DIY Controller. I bought fully programmable lights from CurrentUSA that do everything I need... So, I freed up a relay on my controller and let the lights run with their own 'smarts'.

    I've added the Dosing... It's scheduled, but can also be done on demand. 3 channels.

    DIYDosingScreen.jpg

    Atlas-Scientific came out with a cheap little i2c hub called the sensor bridge which simplifies the number of wires that have to travel all the way back to my RaspberryPi... $6 well spent. I used it to connect the 3 Dosing Pumps and make one home run back to the Controller... you can see it next to the pumps, installed on the Lexan.

    EZOPMPsWithI2CSensorBridge.jpg

    If you've followed my build, you know that i use allot of i2c enabled EZO circuits from Atlas-Scientific. I even use a few expansion boards that cutdown on soldering and wiring. Recently, I received a new prototype version of the Tentacle T-3 (MarkII) from WhiteBoxLabs. It's simplified, but offers an AUX connector for extended the i2c bus neatly beyond the board... It also fully supports the EZO-FLO with a 3 screw terminal for attaching 3 pin Flow Meters. Good stuff. Here I am testing it out.

    TentacleT3Prototype.jpg

    Finally, I've indicated before that i've received help and suggestions from another hobbyist who is also using RaspberryPi, NodeRED and Atlas-Scientific sensors for his advanced reef tank (a tidal pool). His name is MaddyTP (GitHub ID and Reef2Reef ID).. Yesterday, he released a piece of software (a node) for NodeRED to simply working with Atlas-Scientific EZO circuits, sensors and devices... Here's a link where I made the announcement in his behalf (he's modest):

    Announce-node-red-contrib-ezo 1.02 node released

    Anway.. It takes the mystery out of using this hardware in NodeRED.
    Peter
    Cuerpo en Green Valley, Arizona, USA y Corazón en Alamos, Sonora, Mexico

    learning never stops

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Cafepress