Newbie here. First "big" project: greenhouse automaton - Page 1
Forum section: electronics / projects

author: NoradIV
author_rank: Contributor
timestamp: March 02, 2017, 09:31:28 pm
content: Newbie here. First "big" project: greenhouse automatonHello everyone,I have been following Dave for a couple months now and I feel this forum would be the right place to get actual help from knowledgeable people.I have a college degree in electronics, but since this job is in serious decline in canada, I have not been able to use what I have learned for about 5 years now; so sorry, I might be outdated.So, I have been given a project to build an automaton for a greenhouse. (To grow food, not illegal stuff.) The greenhouse is around 10x20 feet and will run 9 months a year (December to march is too cold).The overall goal is to be able to do the following:1. Turn lights on and off based on a schedule and ambient light2. Water plants based on a schedule and possibly from soil humidity3. Water plants from a separater water source containng fertilizer4. Control temperature from a opening roof and a heater5. Have some sort of user interface6. Sync time from NTP with WiFi7. Has to be able to have different profile for different seasons8. Have circuit protection when relevant9. Have a professionnal looking setup that is easy to use by the end user10. Be roughly under 1000$ for the whole project11. Will be 100% hand assembled (I have decent soldering skills)I will scale down the project and cut it in small parts to begin.So, currently, I have selected the Arduino Mega2560. I have ordered a SD card reader and a WiFi module. The first control "interface" will be a .CSV file like the following:Outputs | 1 | 2 | ..| 15 | 1600:00 | 0 | 0 | | 0 | 000:05 | 0 | 1 | | 0 | 100:10 | 0 | 1 | | 0 | 000:15 | 0 | 0 | | 1 | 0In short, this will be a table with all 24 hours with a resolution of 5 minutes. When he put 1, the selected output will be on for that time. This will be updated using a different system later.For now, I would want to focus on the hardware part.What I would like to do first is the relay board. I have established the following needs:1. Need to be able to switch 10 amps2. Has to be able to be installed easily by the owner3. Has to be fused4. Fault detection is a plus5. Will have the following leds (AC, 5V, FAULT, RELAY ON)6. Parts has to be "easy" to purchase, since I may need to do a second or a third bundle later (so no chinese ebay for this part)So, here is my first questions.Where do I start?How would I select my parts?Is there a free and decent cad software which I can do circuit design and CAD to send to an online service?Please note that this is merely an introduction post, which I am going to refer to from future questions later; I do not expect replies to everything here.I really appreciate you taking the time to reading this.Best regards,

author: paal
author_rank: Newbie
timestamp: March 03, 2017, 10:21:08 am
content: Hi! That sounds like a really fun project to do!Are you planning on doing your own design on the AC mains parts? If so, that can be quite serious stuff - especially if you are going to hand it over to someone else to operate it! Are there any constraints on your project that makes it impossible to use e.g. 12V instead?It's a bit hard to interpret from your post how much you have done on the requirements and the system design. Did you spend some time on the use cases and system requirements & architecture, and have them fairly clear in mind, or maybe even written down? I always find that very useful to do - often a great time saver as I have to order stuff online and it's important that I have all the stuff I need when I have a time slot available for design or implementationI'm usually on a budget, so if time allows I'll order most of the 'rapid prototyping' HW on ebay. The prices are so low that I'll often order a few variants - sensors, actuators etc will come in handy for rapid prototyping on other projects. The 'production parts' I'll buy from a reputable source, of course.I've not done much PCB design (my background is IC design), but find Diptrace to be quite nice to use for that kind of stuff.Cheers,Paal

author: danadak
author_rank: Super Contributor
timestamp: March 03, 2017, 11:12:39 am
content: Seems like a wireless network makes sense. ESP8266 based stuff pretty easy,cheap, and lots of code base/examples on Youtube, github.... Primary drawbackis not low power, unless you incorporate sleep mode into system.Possible host could be a Raspberry Pi running Linux. Fairly easy display/network support.As far as power load handling, opto isolated SSR probably easiest choice.Regards, Dana.

author: Ian.M
author_rank: Super Contributor
timestamp: March 03, 2017, 01:12:51 pm
content: Most relay boards for Arduino are pure junk and are totally unsuitable for switching mains voltages or high currents.You'll probably do better using an I/O expander with a ULN2803 buffered output that can drive off-board 12V or 24V coil relays or SSRs. The mains side of things will have to be installed by a licensed electrician, and you'll have a lot less grief meeting code if you present the electrician with two DIN rails, one full of circuit breakers, feeding another full of relay modules.I've googled up an 8 bit I2C => ULN2803 board for you:https://www.ereshop.com/shop/index.php?main_page=product_info&products_id=806. Up to 16 of them (8 I2C-OC805S + 8 I2C-OC805SA) can be daisychained on the same I2C bus, so you could have up to 128 relays. This will do a lot to mitigate the wiring mess as it only needs a 4 wire daisy-chain cable back to the Arduino, so the stack of shields will only have to handle your desired sensors and user interfaceThey don't have indicator LEDs - you can either pay a premium for DIN rail relays or SSRs with indicator LEDs, or more usefully add LED front panel indicators across the relay coils.For reliability, the I2C-OC805S boards will need to be mounted on metal standoffs on a grounded metal baseplate, with the Arduino, and a grounded metal mesh screen should be fitted between them and the mains wiring, to provide protection from loose mains wires and from EMI. Probably the best option is to mount all the purely low voltage stuff on the hinged front panel of the cabinet, which allows for easy mounting of displays and controls, then run a cable harness down the full length of the hinge side secured to the door at one end of the hinge and the cabinet at the other with enough slack for the door to open easily, with the mesh screen formed to fit over the low voltage boards.

author: 3db
author_rank: Frequent Contributor
timestamp: March 03, 2017, 05:36:29 pm
content: I think you should look into what you need to do in order to comply with any legislation applicable to a product of this type in your country.You may also like to check out the Siemens IOT 2020.It is certified and geared up for mounting on DIN rails.3DB

author: NoradIV
author_rank: Contributor
timestamp: March 03, 2017, 11:00:59 pm
content: First, thank you guys for the replies.I am sorry, I didn't explain myself correctly. I was intending to make the relay board myself since I have not found anything that would quite do what I was looking for.Here is a rough layout.Quote from: danadak on March 03, 2017, 11:12:39 amWell, this is a greenhouse; any solution I use will be completely dwarfed by the power taken by the lights.Quote from: danadak on March 03, 2017, 11:12:39 amI have already purchased an arduino for that project. The is a good idea, thanks!Quote from: Ian.M on March 03, 2017, 01:12:51 pmI was thinking on buying an industrial panel to house the arduino and the 24VAC for the water valves. Everything else will be sent with a 4 wire cable to small relay boxes closer to the lights. The main power is already wired and installed, I will just remove the hand switches. A certified electrician will be installing these. I have an electrical engineer at work, I'll go ask him a couple questions about regulation.Quote from: paal on March 03, 2017, 10:21:08 amYep, industrial panel. No restrictions on the 12V. I could use amplifiers on the arduino side. On the requirements, I have basically established the features needed and some restrictions. It is difficult for me to plan everything ahead since I do not know the things or changes I will encounter during the project. I purchased all my tools but my multimeter from ebay. I have couple passives I got from ebay (resistors, caps but on the relay part, I need to have a reliable source of components because I do not want to respin the board if I receive parts not matching my original design.I'll take a look on Diptrace.

author: Ian.M
author_rank: Super Contributor
timestamp: March 03, 2017, 11:19:17 pm
content: Ifr they are dumb relay boxes, you'll do fine driving them remotely from ULN2803 OC buffers in the main unit. I would suggest 250mA polyfuses in each relay coil drive output line and 12V coil feed.If they are smart, what protocol do you propose to run over your 4 wire cables to the relay boxes? Bear in mind that I2C and SPI are unsuitable for running outside of a single grounded enclosure.

author: NoradIV
author_rank: Contributor
timestamp: March 05, 2017, 12:02:35 am
content: Quote from: Ian.M on March 03, 2017, 11:19:17 pmBy "smart" I was intending to do the following:I wanted to make a comparison between the ac input and output, then send that back to the arduino with one input pin and one output pin using the following logic---|AC in|---| AC out|---| |-----| AND GATE |----| Input (from arduino) || || AND GATE |||Output (To arduino)|I don't know if that makes sence.

author: Ian.M
author_rank: Super Contributor
timestamp: March 05, 2017, 04:10:06 am
content: No. it doesn't make sense and the cost of doing so in a way that wont give a qualified electrician fits would probably be prohibitive. Instead consider adding a current transformer so you can detect whether or not the load is drawing the expected current. Put its burden resistor at the Arduino end for accuracy, with a low voltage bidirectional TVS diode shunting the secondary at the transformer end to protect its insulation ifd the burden resistor is disconnected. That also has the advantage that the relay box is then 'dumb' with no circuits that need a local power supplyor that are sensitive to EMI.

author: NoradIV
author_rank: Contributor
timestamp: March 06, 2017, 09:36:45 pm
content: Quote from: Ian.M on March 05, 2017, 04:10:06 amWell, ok then, I will scrap the idea of "smart" boxes, because I wanted something that would give out a status regardless of the current drawn; the current can be anything from a 50W lightbulb to a 1000W neon array.

author: Ian.M
author_rank: Super Contributor
timestamp: March 06, 2017, 10:57:19 pm
content: Going back to your 'smart' logic, I *THINK* this is what you are trying to do._/AC in o----o---o/ -o--o AC out| || |+12V o----)---. || | || C| || C| || C| || | |Relay Drive o--o-)---' || | || | | __| | '--| \ __| | | )----| \| '-----------|__/ | )----o Sense| .--|__/| |\ |'-------------| >O--'|/(created by AACircuit v1.28.6 beta 04/19/05www.tech-chat.de)Remembering that the Relay Drive Signal is active low, so needs inversion, You want a Sense output if there is power both sides of the relay and the Arduino has commanded it on.However:If there is no power to the relay, its output cant be powered unless there is a short from another circuit, so the first AND gade is nearly redundant.If the relay contacts weld, the information that the output is stuck on is thrown away by ANDing it with /Relay_DriveYou'd do better to simply return the state of AC_out then have the Arduino compare it to the commanded relay state. You could do that safely with a insulated wire ended mains panel indicator, a photoresistor and some heatshrink.Seehttps://www.hackster.io/porrey/vacsensor-0fe427If you let your tame electrician cut one open to inspect it, (s)he should grudgingly accept it, if it can be cable tied so it isn't loose in the box - Ask First!

author: NoradIV
author_rank: Contributor
timestamp: March 08, 2017, 12:04:59 am
content: Quote from: Ian.M on March 06, 2017, 10:57:19 pmYour plan is accurately representing what I am intending to do. The AND gate was because I wanted the relay box to be "unpolarised" as either side could be input or output. The 12vdc power would come from the automaton panel.

author: Ian.M
author_rank: Super Contributor
timestamp: March 08, 2017, 12:23:18 am
content: Yes. Well you can design your own relay modules, but unless you've got very deep pockets, you'll have problems getting the safety approvals that would be needed before a licensed electrician would consider wiring them in. Any competent electrician can be expected to make sure the monitoring circuit is on the load side so your relays, so you don't really need reversibility unles you are doing something strange.If you still need to sense both sides of the relay, use two separate sensors. Wire their photoresistors in series for AND logic to a single Sense signal pair. However that's going to push the cost up . . .

author: NoradIV
author_rank: Contributor
timestamp: March 11, 2017, 08:33:23 pm
content: Well, I have not found any decent relay boards yet, so I am unsure what else to do at this point.

author: Ian.M
author_rank: Super Contributor
timestamp: March 11, 2017, 09:15:38 pm
content: You could try a search for:UL listed relay board, but I doubt you'll get lucky.You wont easily find decent relay boards for substantial mains loads - that sector of industrial automation is usually served by DIN rail relays (or other means of chassis mounting relays) + an open collector output PLC or PLC + expansion module to drive them, or by a special purpose controller with everything including the relays (except possibly the display and controls) all on one board.Din rail relays and monitoring modules would probably be the preferred approach for your application - the electrician who has to wire it will be a lot happier to be working with brand-name parts, and the modular nature eases future maintenance. For any 'smarts' you need to build into the relay boxes, you'll probably want an enclosure for the electronics that clips onto the same rail. e.g.http://camdenboss.com/enclosures/din-rail-enclosures/cvb-plus. Order the accessory CVB-PLUS PCB to prototype your monitoring circuit on then design your own PCB to fit. Your electrician may not be too happy but you are more likely to be able to get your own monitoring board to pass inspection if it is in a standardised industrial enclosure, doesn't directly switch the load current and you can show that you have followed industry best practices for creepage and clearance distances, part ratings and other safety critical issues.

author: Morgoroth
author_rank: Regular Contributor
timestamp: March 12, 2017, 02:32:51 am
content: I made a project pretty like your, but for hydroponics, we control eC and pH, with schedule, including relays, humidity and light sensors, etc etc... at real time and supporting IoT protocols.and indeed I start with a mega2650, worst desition ever, the chip is old and there are much better and cheaper around, try to get a new one (ESP8266, CC3200, CC3200MOD, ESP32), no need to be the best, just one with good support and not complicated to mount for prototyping, if I would have to make that project again I'll choose a wifi chip only for communications and others for control. Examples and support are important to code fast, so probably TI chips are the best option for this.Now, as advice, start simple, simple as possible, for example, take a Rasberry pi 3, buy a CC2650Sensor Tag for humidity, temperature, and other ambient variables you are interested and integrate it.then make your own Relay board, is easy and cheap. Don't try to control big currents because when you has to put price to your device (with all the protections you MUST have) you will realize that when you have 1KW of power is better to add a contactor switch controlled by your relay (if you have the money for 1KW you have the money for the contactor switch), so, use your relay to control up to 400W of power and/or to control that contactor switch (all at 110/220V).So far that is your best and cheap way (for me) to get your system working at a shorter time.If you have doubts feel free to contact me.Regards,JP