Nodarium - NodeJS Powered Controller

djmx2002

Premium Member
Hi All,

I want to share with the community what's I've been working on for the past several months, I started a big tank build thread on a local reef club in DC. And one of the more complicated tasks was to come up with an elegant way to control everything in the tank.

Going back several months ago, I've made the decision to go with a custom reef controller, one that I could fully customize, and add/adjust things as needed.

So far I got most of the things prototyped such as:
Mixing Station:
- Measure water Levels in both tanks (using pressure transducers)
- Keep track of water temperature
- Keep track of salinity in mixing tank (haven't implemented that yet, still debating if it's worth the extra money for the probe)
- Control auto top off
- Control solenoid to fill water from fresh holding tank to mixing tank.
- Future: Auto flush for RO membrane
- Future: Auto water shut off based on water level on tank, Instead of the water pressure valve.

Generic Outlet Control:
- Control up to 16 Outlets (can be extended)
- Auto / Manual (On/OFF) Modes
- Extendable

Probes:
- Measure PH
- Measure ORP
- Measure Salinity
- Measure Temperature

Lights
- Control individual LED Channels
- Simulate sun rise/set
- FUTURE: Simulate lunar cycles
- FUTURE: Simulate Weather patterns based on real time weather.

Software wise, I decided to keep as much as I can off the arduino, in the past i ran into issues where the arduino would freeze up on me... I assume it's because of me writing bad code, rather than the arduino being defective (went through several of them). Because of that, I first looked into a solution that could provide the arduino MC instruction on how to operate. First looked into Beaglebone and RasPi, but wasn't too happy with the performance, and the type of software I was able to install. So at the end i've decided to buy one of those refurbished PCs from micro center for around 150 dollars, I wiped the computer clean, and booted it with Ubunto, installed NodeJS, Mongo DB and bunch of other things to make it work as a full server.

Communications between the arduino and the computer is being done via bluetooth module at a baud rate of 115200, wish i could go faster than that. I've ran into some issues wish slower speeds.

I am planning to keep updating this post at least once a week, (only get to work on the project on weekends)

here's a sort video demonstrating the light settings page, next week I'll be working on the code to control the Jebao power heads and the settings panel for those. The week after i'll probably jump into getting the probes code written and start working on the dash board.

https://www.youtube.com/watch?v=Vo0UuYs6l8Q

I forgot to mention that the whole project is open sourced, code is available here: https://github.com/mottihoresh/nodarium
 
Did you consider using multiple Arduino Yuns' instead of the Mega with BlueTooth?

Oh, and are you going to use or start out with this:
http://semu.github.io/noduino/



I haven't played around with arduino yun yet. But looking back it could have made things simpler since I ran into issues running i2c cables over 20ft or so, and I've ended up getting i2c bus extender chips from eBay which fixed the issue. Also enabeling simple web services on yun could have been safer than serial in regards to data integrity. Even with the higher baud rate some communications is still being messed up. I tried writing some code to check for it on the nodejs side. Whenever I send a command to the arduino the arduino sends back a json object to confirm the communication. If the number of characters in the original command is different than the one sent back I retry to send the command.

I originally checked out nodiuno and Johnny five but it seems like they were both very generic. So I thought it could be good to leave the arduino logic to the arduino (just in case something happen and the connection breaks) and pass commands to it in the following format C04|00|10|4095.

The above command is mapped to setting the PWM value for the adafruit PWM extender. 04 is the main command the first two numbers in the index of the chip I want to target, the PIN number on the chip and the value.
 
Back
Top