💬 MySGrowLED - MySensors control for Grow Lights or Greenhouse
openhardware.io last edited by openhardware.io
I came over from Terraforums to ask a MySensors question. First off, thank you very much for putting in the time to design, build and share this device. It is exactly what I needed when I didn't even know I needed it. I'm pretty good at hardware but very weak at coding, so-so with Arduino but as far as Domoticz I have a long way to go.
So to my question; if I'm building 3 of these what changes do I have to make in the code to make each one unique? I changed String Location = "Plants"; and #define SN "MySGrowLED" but I'm thinking there is more to it than that. So far #1 has been working flawlessly for over 3 weeks but when I powered up #2 I had problems. The #1 was sitting with LED and Fan OFF. When I powered up #2 the LED and fan on #1 went to 100%, which is the default setting for #2. Hope that makes sense and you can point me to a solution.
You should only need to change what is in the "configuration" part of the sketch.
- Optionally change String Location = "Plants"; to something more meaningful
- Enable/disable the "modules" LED, FAN and various sensors depending on what you soldered on the board
- Optionally setup the radio settings for your network.
Assuming, as you seem new with this system, that you only have these devices I would not change anything on the radio part and leave everything commented out like this:
//#define MY_NODE_ID 42 //#define MY_PARENT_NODE_ID 0 //#define MY_REPEATER_FEATURE
You probably don't need to edit #define SN "MySGrowLED", but can it's fine.
Then for your problem I can see 2 possibilities:
- You manually defined a node ID for your board and both have the same, ex:
#define MY_NODE_ID 42
I would recommend to leave it disabled so domoticz take care of it itself.
- Something wrong in the wiring.
If the node ID was setup correctly can you post here the "configuration" part of both of your arduinos?
Ideally a screenshot of your domoticz devices and switch may help to check they have individual IDs assigned.
Finally a picture or schematic of your whole setup including how each modules is wired to each LED driver / fan may help too.
I currently have 3 modules running, and except a different name and manual node ID I did not change anything else between them so it should work for you too.
Thanks for taking the time to look at this.
Initially I used your unedited sketch on node #1 until I knew the LEDs and fan were working properly. I then added 1 sensor at a time and tested until I had all the sensors I wanted. It ran fine for several weeks. I then used that same sketch in node #2, that's when #1 started to do strange things, like the LED turning on when I powered in #2. That's when I made the changes to "string location" and "define SN". Then I put the same sketch into node #3 and nothing happened. I checked debug and saw it was being assigned the same node ID as #1. That's when I contacted you to double check about other changes needed.
I've since hard coded the node ID for #2 and #3 and everything seems okay, although my RFLink gateway crashed after they powered up but that is probably a coincidence. I rebooted Domoticz and everything seems stable now. I have node #2 and #3 just sitting on my bench with only power hooked up to them. I'll have to do more testing with fans and LED connected later today. I soldered 1-wire sensors on them and screwed in external 1-wire sensors and none of them are showing up although I have them enabled in the sketch so I'll need to check my soldering.
Glad it's working for the radio part.
If you don't hardcode the node ID it's always a good thing to use the "Clear Eeprom" MySensors sketch to be sure your arduino did not keep a former ID, else you end up with duplicates.
For 1-wire you can also check them using the "MySGrowPCB_test.ino" sketch, serial log will try to detect everything.
Okay thanks. I think the "Clear Eeprom" MySensors sketch would have helped it I'd known about it. As part of my troubleshooting I was swapping Arduinos around which may have added to my confusion.
Hi there, just wired up my first one. i am very interested in this PCB as the form factor is quite nice.
however, i'm running into an issue with the MOSFET not firing. i checked voltage to the gate and i'm transmitting 3.3v. i think that isn't enough to activate the switch. has this been the case for you or others?
@rchamp i also noticed on the MOSFET mentioned (IRLZ44N) and the one i'm using (L7812CV) that the drain is in the middle, not the far side, but the wiring schematic shows ground on the far side, not the middle.
am i missing something? i have 2 boards wired up. one with default pins, and one where i've switched the drain and the source to match the PCB. however it seems as the 3.3v coming from pin 5 isn't enough to trigger the switch. any ideas and clarifications would be helpful. i'm still very green to microelectronics
@rchamp yes, there have been some problems with (fake?) irlz44n. See https://forum.mysensors.org/topic/4350/irlz44n-not-fully-open-using-3-3v-arduino
is the pro mini always output 3.3v on the pins? even if i switch in arduino IDE to 5V 16mHz?
@rchamp changing the setting in the Arduino IDE won't change the physical components on the board. A 3.3V pro mini has a 3.3V ldo which will always output 3.3V. It has a clock that will be 8MHz regardless if what is selected in the Arduino IDE.
It might be possible to power a 3.3V Pro Mini with 5V on Vcc without damaging it though. I haven't checked.
scratch that. i'm a ditz, apparently. i had the LEDs wired up the wrong way. i had the positive wire of the LED wired to the LED port on the board. i switched the negative was wired to the LED port on the pcb and voila! LED's work.
now i'll need to tinker more and play with fan PWM and other outputs on it.
Thanks for being a sounding board!
The choice of MOSFET can be tricky. Seems that irlz44n was discontinued so you may need to find one adapted to the voltage and current you want to handle.
In all the cases you need to get a logic MOSFET too, meaning that they are fully open usually around 1 to 3V.
Also I'm sort of confused as it seems to me that L7812CV is a Voltage regulator, not a MOSFET. So if you are actually using that in the MOSFET spot it will definitively not work.
Especially if you are handling high current or voltage I would recommend using one from a reputable source for your MOSFET, I recently switched from mouser / digikey / aliexpress to mostly use http://www.arrow.com as you get free regular shipping, event if you order a couple of components (no affiliation to them whatsoever).