# First post! Arduino and/or Raspberry Pi controlled MistKing system?



## mikeh77 (Feb 2, 2017)

Hello guys! This is my first post, I'm actually quite far along in my first viv build. It's a 55 gallon build with custom background (cork, Great Stuff with silicone and background mix, etc). I've taken a bunch of pictures and I'll document the entire build soon.

So I've done quite a bit of research on my own, but I can't seem to find any info on this: is there a way to control the MistKing system through an Arduino sketch or Raspberry Pi program? All MistKing parts seem proprietary, but the technology can't be that difficult. Everything else in my build is controlled and monitored with the Arduino and/or the Raspberry Pi, and I do have the MistKing timer set up, but ideally I'd like to control the misting digitally without having to manually time it and set it up.

Any ideas? For reference, I do have the ZipDrip system installed with the MistKing as well.

Full build pictures will be coming in the next week or so in a separate thread. Thanks in advance for the advice, anyone!!!


----------



## 55105 (Jan 27, 2015)

Check my sig


----------



## mikeh77 (Feb 2, 2017)

port_plz said:


> Check my sig


Yeah man, I'm glad you posted, your site is an awesome resource! I took a little bit of a different approach by using the HTU21D-F humidity sensor, I had some problems with the accuracy of the other sensors and this one is supposed to be extremely accurate. I'm also using RF controlled Etekcity power outlets (with a RF transceiver) to make things a little simpler for controlling/scheduling power to fans.

The challenge is this MistKing system. I don't see anything on your site that specifies MistKing integration, unless I'm missing something.

One thing I thought of is if there's a way to set the MistKing in an "always on with power" state, then I could just control the MistKing via the power plug on/off, but the timer seems to reset every time it's unplugged so this doesn't seem feasible, again unless I'm missing something.

Do you (or anyone else) have any more insight or success in controlling the MistKing system specifically?


----------



## 55105 (Jan 27, 2015)

mikeh77 said:


> Do you (or anyone else) have any more insight or success in controlling the MistKing system specifically?


Nope, I've never used the mist king... Can you wire the pump straight to the power supply without the timer? 

I have a couple of those sensors. Was it difficult to get them working?


----------



## cam1941 (Jan 16, 2014)

My Mistking systems have been completely reliable while some of my internet controlled iHome plugs have not. If I had had those controlling my Mistking I would have had my vivs flooded by 5 gallons of water. 

How reliably perfect are those systems? Mistking has a great track record all on its known.




mikeh77 said:


> Yeah man, I'm glad you posted, your site is an awesome resource! I took a little bit of a different approach by using the HTU21D-F humidity sensor, I had some problems with the accuracy of the other sensors and this one is supposed to be extremely accurate. I'm also using RF controlled Etekcity power outlets (with a RF transceiver) to make things a little simpler for controlling/scheduling power to fans.
> 
> The challenge is this MistKing system. I don't see anything on your site that specifies MistKing integration, unless I'm missing something.
> 
> ...


----------



## mikeh77 (Feb 2, 2017)

port_plz said:


> Nope, I've never used the mist king... Can you wire the pump straight to the power supply without the timer?
> 
> I have a couple of those sensors. Was it difficult to get them working?


That's the thing, the MistKing system specifically says wire only to its own proprietary timers and controllers. That said, the system seems quite simple with only a few wires. Ideally, however, I'd like to control the system without power on/off, but actually via a dashboard (think IoT).

The sensor wasn't qat all difficult to get working. Initially I had it hooked up directly to the RPi3, but the python script was kinda unreliable via dweet, so I'm going with an Arduino to Cayenne connection which seems much more reliable.



cam1941 said:


> My Mistking systems have been completely reliable while some of my internet controlled iHome plugs have not. If I had had those controlling my Mistking I would have had my vivs flooded by 5 gallons of water.
> 
> How reliably perfect are those systems? Mistking has a great track record all on its known.


So I'm with you, I'd definitely recommend against going with a WeMO or iHome WiFi plug. They are not that reliable in my experience, either. An RF-outlet controlled Arduino/Pi system is more more reliable since it's running on Linux and using RF. Besides functionality of reporting to a cloud-based dashboard, you don't even need WiFi or internet connectivity, it's all controlled via the Arduino/RPi3.

Please anyone correct me if I'm wrong, I'm still pretty new to this.

All of this said, I may just want to stick with the MistKing branded timer in the end if external controlling will be too unreliable. As you guys will see with my build post coming in the next month or so, I'll have this setup connected to my LED lights, fans, temp/humidity, etc... if I were to connect the MistKing successfully, then this opens the possibility of mirroring external weather to be emulated within the tank, i.e. rainstorms and sunny days with the lights, fans, and misting. Pretty mind blowing stuff. The missing link is MistKing control.

If the MistKing connection won't work then it's not a huge deal breaker, I really like the reliability of the pump, tubes, bulkheads, fittings and such of the MistKing system and I'd rather not go the DIY route for misting.


----------



## kromar (Jun 6, 2015)

this might be interesting for choosing the preferred sensor, it seems that the one you want to use has some higher error in the high humidy ranges where most viv's are so maybe you are better off choosing a different sensor for the job at hand.

https://www.kandrsmith.org/RJS/Misc/Hygrometers/calib_many.html

concerning reliability i have port_plz's software running since a couple of month and controlling the mist system via power port on a fresh rpi3 and it has never failed once. 
i had a rpi2 before and it was not as stable as the 3 but that might also have been due to my hacking that i did on the system


----------



## mikeh77 (Feb 2, 2017)

kromar said:


> this might be interesting for choosing the preferred sensor, it seems that the one you want to use has some higher error in the high humidy ranges where most viv's are so maybe you are better off choosing a different sensor for the job at hand.
> 
> https://www.kandrsmith.org/RJS/Misc/Hygrometers/calib_many.html
> 
> ...


Very interesting stuff, thanks for linking! Yeah, there are definitely other sensor options, but virtually all tests agree that the "standard" DHT22 sensor is not the way to go nowadays and has some wild outliers and/or bias. Also worthy to note is that the F model of the HTU21D (i.e. HTU21D-F) is different than the HTU21D in that includes a filter membrane over the humidity sensor for water and particle interference. The significance of including the filter on this newer model is yet to be studied from what I've seen but it's supposed to be a significant improvement.

This guy has also studied many sensors and ultimately concluded that it's almost a tie between the SHT31-D and the HTU21D-F, but the slight edge goes to the SHT-31D in his opinion. https://www.facebook.com/notes/phil-moyer/comparing-temperaturehumidity-sensors/10157468075605557

So, to clarify, do you have a MistKing system set up with your Pi? Is it simply controlled via power? Is it hooked up through the timer to be always on so that when the power comes on it mists, and when the power is cut it stops? Or, rather is it wired directly to the power in some other way?

Any help with your setup would be GREATLY appreciated if you do in fact have a controlled setup via MistKing! Thanks in advance!!


----------



## kromar (Jun 6, 2015)

mikeh77 said:


> Very interesting stuff, thanks for linking! Yeah, there are definitely other sensor options, but virtually all tests agree that the "standard" DHT22 sensor is not the way to go nowadays and has some wild outliers and/or bias. Also worthy to note is that the F model of the HTU21D (i.e. HTU21D-F) is different than the HTU21D in that includes a filter membrane over the humidity sensor for water and particle interference. The significance of including the filter on this newer model is yet to be studied from what I've seen but it's supposed to be a significant improvement.
> 
> This guy has also studied many sensors and ultimately concluded that it's almost a tie between the SHT31-D and the HTU21D-F, but the slight edge goes to the SHT-31D in his opinion. https://www.facebook.com/notes/phil-moyer/comparing-temperaturehumidity-sensors/10157468075605557
> 
> ...


yeah in the end all sensors will probably do, and one can always do some offset calibration in the software if theres to much *offset*^^

intresting to see that the test you linked he also got a lot of bad readings (*spikes*) with a dht22 sensor, i also had those on the pi2 but almost never have them on the pi3 with a new sensor, so i guess it also depends how the moon and stars align when the sensor is produced^^

actually in the link that i posted he tested the D sensor with and without *membrane *and could not measure a real difference, so i would assume its similar with newer versions or other models that use a membrane.


for the *complexity*, lets say if you have never used a linux system before like i did there is definitely some pain involved in setting everything up, but i think its more the nature of linux that everything one wants to do needs a load special console commands that probably 99% of people have to look up in some tutorials.
but with the *tutorial *there is not much that one can do wrong, and there is always the forum where a lot of help can be found.

once its running its quite easy and with the new software its easy to *clone *the system to a usb drive to restore or copy to a new pi which is really awesome (like 2 clicks in the interface)

the misting system is controlled by a *relay *that is hooked up to a gpio port on the pi and the relay is a switch that turns the power to the pump on or off.
there is a script that checks if its time to enable the misting and triggers the relay to *switch on or off*. 

and there is also a web interface with buttons to enable/disable the misting online if you feel you need a bit more misting


finally i might mention that i am working on quite a big project to improve the functionality of the software. not much has been done yet since im waiting on the 2nd pcb batch but once my hardware is up and running i will start on the software and of course im always looking for some help since it will be a rather big undertaking. 
you can find more details about the project in the raspiviv forum or check the planned items here and status here: 
https://goo.gl/photos/5iu5bneP8WwXniZr7
https://tree.taiga.io/project/kromar-raspiviv_community/kanban

but dont wait on it, since its a *hobby project* i do not set any deadlines and it could also happen that i feel like i want to do different things for some months or so. just to be clear on that


----------



## mikeh77 (Feb 2, 2017)

VERY cool project kromar!! Between you and the raspiviv site from port_plz you guys have some super encouraging material to start with! I'll definitely start posting on the raspiviv forums as well in the future.




kromar said:


> the misting system is controlled by a *relay *that is hooked up to a gpio port on the pi and the relay is a switch that turns the power to the pump on or off.
> there is a script that checks if its time to enable the misting and triggers the relay to *switch on or off*.
> 
> and there is also a web interface with buttons to enable/disable the misting online if you feel you need a bit more misting


So, first of all thanks for posting the pictures and the community for your project. I do have a few quick questions that maybe you could answer or at least point me in the right direction to...

Specifically, are you controlling the misting from a MistKing system, or a different/DIY system? The reason I'm concerned is because it says quite clearly on the MistKing to only use their proprietary controllers, but I really want to have more flexibility. So, are you specifically using a MistKing system?

The follow-up question is if you are indeed using MistKing, do you have more details on the specific wiring and relays used? Any info or links here would be supremely appreciated. This is really the only roadblock I've experienced so far, since most people either go the tough route of DIY'ing their misting system (not MistKing), or they go with a MistKing branded controller. I've found no specific references to people using a DIY controller on a MistKing setup.

Thanks again for the insight, everyone!


----------



## kromar (Jun 6, 2015)

Thanks it has been a lot of learning but also a lot of fun working on the project

And yes i use a mistking system and you can hook it up to any timer on the market as long as it has the same voltage. Seems to be some marketing stunt they do there. But i will need to take a look at the new systems they have to confirm my claim.
I can post some details of the relay and the wiring tomorrow or on the weekend.

Looking forward to see what you put together wether its with rpi or arduino!


----------



## mikeh77 (Feb 2, 2017)

kromar said:


> Thanks it has been a lot of learning but also a lot of fun working on the project
> 
> And yes i use a mistking system and you can hook it up to any timer on the market as long as it has the same voltage. Seems to be some marketing stunt they do there. But i will need to take a look at the new systems they have to confirm my claim.
> I can post some details of the relay and the wiring tomorrow or on the weekend.
> ...


Awesome! I'll keep you posted and I'll definitely look forward to your response.

If this helps, I just took a picture of my MistKing pump, it's their latest model (I bought it less than a month ago): Imgur: The most awesome images on the Internet


----------



## kromar (Jun 6, 2015)

mikeh77 said:


> Awesome! I'll keep you posted and I'll definitely look forward to your response.
> 
> If this helps, I just took a picture of my MistKing pump, it's their latest model (I bought it less than a month ago): Imgur: The most awesome images on the Internet


that looks like the same pump that i use and even if it would be a other one it also is powered by electricity so no reason why its use should be limited to a timer of a specific brand. 

i put together some pics with some sketching to make the connection to the relay clear. so the relay is basically used as a switch on the power cable, take one phase and put the relay in between.

the relay has 2 different states, either the circuit is closed by default or open by default, so it depends on the gpio default (high/low) how you want to hook it up.
you can imagine a relay like a switch with 2 different lines


----------



## mikeh77 (Feb 2, 2017)

kromar said:


> that looks like the same pump that i use and even if it would be a other one it also is powered by electricity so no reason why its use should be limited to a timer of a specific brand.
> 
> i put together some pics with some sketching to make the connection to the relay clear. so the relay is basically used as a switch on the power cable, take one phase and put the relay in between.
> 
> the relay has 2 different states, either the circuit is closed by default or open by default, so it depends on the gpio default (high/low) how you want to hook it up.


Awesome!!!! Thanks so much for your help, kromar!

I'm ordering the relay today, but unfortunately I'll be out of town this week so I won't be able to get to it until the week after. After that when I'm back I'll give it a shot and post up pictures of my entire build.

Much appreciated!


----------

