Notifications
Clear all

Mega plus board with ESP 32

164 Posts
7 Users
96 Likes
8,727 Views
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 7028
 

@dastardlydoug They are rated at 400ma so will need to be attached to a relay.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
(@dastardlydoug)
Member
Joined: 2 years ago
Posts: 68
Topic starter  
Posted by: @zander

@dastardlydoug Check out the video and blog here on shift registers, that will show you how to control dozens of relays with only 3 logic pins plus 5V and Gnd of course. Video  Blog

Yeah. Watched that video before.

The question I would have is can the Nano IoT33 work with a shift register?


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 7028
 

@dastardlydoug No, just wanted to know if they came with the shift register type functionality, they do not. Make sure you look at Bills video on shift registers and look at the related blog post so you will see how to control dozens of relays with only 3 pins.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
(@dastardlydoug)
Member
Joined: 2 years ago
Posts: 68
Topic starter  
Posted by: @zander

@dastardlydoug They are rated at 400ma so will need to be attached to a relay.

What's rated at 400ma? If you're talking about my pumps, I knew that 😉


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 7028
 

@dastardlydoug Yes, any logic pin can work with a shift register, just be sure to match up 3.3V to 3.3V and 5V to 5V, get it wrong and the magic smoke will be released. If you need to, you can get level changers, 3.3 to 5 and 5 to 3.3.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 7028
 

@dastardlydoug Just checking.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
(@dastardlydoug)
Member
Joined: 2 years ago
Posts: 68
Topic starter  

I don't know if I had mentioned this before... But, all this will be in an off-grid configuration.

100W Solar panel with a 12v 100Ah AGM battery

Power conditioner and a 300W Inverter.

Kinda like 'Certs'. It's two, two projects in one 🤣 


   
Inq reacted
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 7028
 

@dastardlydoug I have to leave for 30 mins or so, but I think you have a few ideas and perhaps a better understanding of what you need to do. I really hope this discussion has been helpful for you, sometimes it's difficult to be tactful and gentle when putting one's proverbial hands on the tiller but it sounds like you understood we were just trying to help. TTYL.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 7028
 
Posted by: @dastardlydoug

I don't know if I had mentioned this before... But, all this will be in an off-grid configuration.

100W Solar panel with a 12v 100Ah AGM battery

Power conditioner and a 300W Inverter.

I am a solar guy, 1,080W with 7.2kWh LiFePO4 batteries and a 3,000 W inverter. TTYL

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 7028
 

@dastardlydoug What latitude are you or closest city so I can do a solar calculation for you.

You have 50AH usable x 12V is 600WH so 25W/hr for 24 hrs. If you use that much you will need at least 200W of solar. My last panel I bought was 190 so 200 should be easy to find and these are small 5' x 2' panels.

I don't see a battery monitor or solar charger, probably a cheap PMW for a small array like that, I would recommend a Bogart battery monitor and solar charger combo, that is the best small system unit around. Let me know if interested and I will get you the right links (Amazon?)

Get yourself some LM2596 buck modules to convert your 12V to 5V and/or 3V (I would go 12 to 5 then a second 5 to 3) Do NOT be tempted to let the Nano or ESP32 do the Voltage reduction, they are LDO regulators and waste power via heat.

One of the reasons I went Lithium is the straight line charge curve, the reality is with solar and lead you will likely only get 80% to 50% cycling. That means a realistic 360Wh or 15W/Hr for 24 hrs. The good news is one 100W solar panel is all you need. From your system description so far that might be doable depending on how much the fans pull.

I would be tempted to go with 300W or even 400W of solar to attempt to overcome the resistance in the batteries as they get closer to full. Panels are cheap. 

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 7028
 

@dastardlydoug That 300W inverter is waaaaaay too big, more like 200W or even 100W. Also, Use ONLY marine grade connectors (tinned copper), high grade wire and use a wire calculator to make sure they are causing as little loss as possible. Use the double walled glue containing heat shrink and seal all joints well. Good grade breakers are very expensive but there is a reason for that. Mount a disaster fuse on the battery plus post. Also marine grade bus bars.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
(@dastardlydoug)
Member
Joined: 2 years ago
Posts: 68
Topic starter  
Posted by: @zander

@dastardlydoug What latitude are you or closest city so I can do a solar calculation for you.

You have 50AH usable x 12V is 600WH so 25W/hr for 24 hrs. If you use that much you will need at least 200W of solar. My last panel I bought was 190 so 200 should be easy to find and these are small 5' x 2' panels.

I don't see a battery monitor or solar charger, probably a cheap PMW for a small array like that, I would recommend a Bogart battery monitor and solar charger combo, that is the best small system unit around. Let me know if interested and I will get you the right links (Amazon?)

Get yourself some LM2596 buck modules to convert your 12V to 5V and/or 3V (I would go 12 to 5 then a second 5 to 3) Do NOT be tempted to let the Nano or ESP32 do the Voltage reduction, they are LDO regulators and waste power via heat.

One of the reasons I went Lithium is the straight line charge curve, the reality is with solar and lead you will likely only get 80% to 50% cycling. That means a realistic 360Wh or 15W/Hr for 24 hrs. The good news is one 100W solar panel is all you need. From your system description so far that might be doable depending on how much the fans pull.

I would be tempted to go with 300W or even 400W of solar to attempt to overcome the resistance in the batteries as they get closer to full. Panels are cheap. 

My fans:

"https://www.amazon.com/dp/B07P46D62Q?psc=1&ref=ppx_yo2ov_dt_b_product_details"

Don't know anything about battery monitors, etc. What I got is from Home Depot...

"https://www.homedepot.com/p/Renogy-100-Watt-12-Volt-Monocrystalline-Solar-Starter-Kit-for-Off-Grid-Solar-System-STARTER100DWD30/302260739?ITC=AUC-40235-23-12140"

"https://www.homedepot.com/p/Renogy-100-Watt-12-Volt-Monocrystalline-Black-Frame-Solar-Panel-with-High-Efficiency-Module-PV-Power-RSP100D-BK-US/316677202?ITC=AUC-39177-23-12140"

"https://www.homedepot.com/p/Renogy-Deep-Cycle-AGM-Battery-12-Volt-100Ah-for-Solar-Panel-BATT-AGM12-100/303412933?ITC=AUC-72870-23-12140"

"https://www.homedepot.com/p/Nature-Power-300-Watt-Battery-Powered-Inverter-37300/308016833"

Forgot to add that I am in the state of Oregon. 44.5365° N, 122.9070° W

PS: I wouldn't want to add more panels if I can help it. The yard looks nice as is.


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 7028
 

@dastardlydoug Homedepot????

A battery monitor allows you to know how much power is going in or out, how long the batteries will last until empty (50%) and everything that can be measured. It's most important function is to alarm you if the battery is approaching the critical 50% level.

You also are missing the solar charger, you can't just hook up a panel to a battery, my panels put out 19V at 10A, the controller changes that to the proper voltage for the state of charge, for instance to fully charge a lead acid battery, a charge curve that looks like the attached picture is required. If those panels only put out 12V they will never charge the battery, the solar panel has to be higher than the battery. Think of it like water pressure. A lead acid battery is starting to die at 12.2V. 

If the battery has the initials CCA or MCA or the word crank anywhere on it then it is the wrong kind of battery.

There is much more to lern, but I know you are already overwhelmed so I will leave it there.

AM Solar is a good resource.

A long extension cord would be so much simpler and more reliable.  The other option is to turn the solar system over to a professional.

I am attaching some pics of my battery monitor, my solar charger a lead acid charge curve

IMG 6909
IMG 6911
IMG 6910
Screen Shot 2022 05 26 at 22.39.42

 

Good luck.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
Inq
 Inq
(@inq)
Member
Joined: 2 years ago
Posts: 1900
 

@dastardlydoug - Catching up with your thread, I feel like a Ping-Pong ball. 😆  I want to summarize what "I think" I've read.

  1. You've said you are a beginner.  However, it is obvious, you have done a great deal of research as you have a bunch of hardware and had a quite adequate approach on how to tackle the project.  
  2. You even recognized the need to handle voltage between Mega 5V and ESP32 3.3V. - Serial Communication between the two would be added complexity.  I would classify that beyond "beginner".
  3. I see you have a Mega shield, but I didn't see if you have plain-ole breadboards to do your prototyping.  I would highly recommend just using jumper wires and breadboards while you are learning.
  4. You mentioned you only want 4 zones to start with, but "might" use all 8 eventually.
  5. I saw most of your parts itemized either by pictures or purchase links.  I however, did not see your soil moisture sensor.  I would like to see how the data is accessed (analog, I2C, SPI, etc).  Also, it is obvious you know your stuff about being in the soil and degrading.  I'd like to learn some of those aspects from you.  
  6. Your relays are individually triggered. 
  7. You have mentioned several types of sensor data.  I think you mentioned that you no longer will need to get air temperature/humidity data at you spun that off with some other device, but I would like to read a summary, all in one place and links also.  Here is what I think I've read.
    1. (4) relays (8 eventually) to energize fluid pumps.
    2. (4) soil moisture sensors (8 eventually)
    3. (1) pH sensor for tank.  Many sensors have temperature sensors included as they tend to need to adjust their primary reading based on temperature.
  8. I've looked at the pin-out for your ESP32 board.  Even if you go to 8 relays and 8 moisture sensors, at worst, should only use 16 out of the 34 available pins.  I don't currently see why you would need the Mega OR even the Shift-registers we've recommended.

There are many ways to approach your project.  You had in mind to do all the sensor/relays off the Mega and simply use the ESP32's WiFi to talk to the cloud.  That is one way and certainly valid.  However, the ESP32 has many pins and a far better processor and must be used to reach the cloud.  The Mega, Mega shield might be "refundable" 😉 

Having done this stuff for at least a decade, I would not try to put the hardware all together in one fell swoop and try to then program it.  Even now, I would do one trial step at a time.  Here is what I would suggest:

  • Wire just one relay to your ESP32 board. 
  • Getting all the wiring correct and not blowing smoke is non-trivial.  You have high-voltage/high-current devices (12V pumps) and low voltage logic (3.3V).  The two don't like to play together.  Obviously, you knew that since you sourced the relays.
  • Use a relay example from the Arduino IDE and just see if you can trigger your relay.  This will check that you have all the building blocks configured correctly and can successfully program it.  It also gives you an relatively easy win to feel good about.
  • Unfortunately, the relay board page you referenced shows they are 5V relays.  They may or may not be triggerable by the 3.3V logic pins of the ESP32.  If not, you'll have to decide your next step.  I also don't see a spec sheet on how much current they need to trigger them.  The ESP32 should not be asked to supply more than 40 mA or you may smoke the ESP32.

VBR,

Inq

 

3 lines of code = InqPortal = Complete IoT, App, Web Server w/ GUI Admin Client, WiFi Manager, Drag & Drop File Manager, OTA, Performance Metrics, Web Socket Comms, Easy App API, All running on ESP8266...
Even usable on ESP-01S - Quickest Start Guide


   
DastardlyDoug and Ron reacted
ReplyQuote
Inst-Tech
(@inst-tech)
Member
Joined: 2 years ago
Posts: 554
 

@inq , @dasterlydoug, I was reading your post and found some information that might help @dasterlydoug with his project concerning the ESP32 and relays operation.. https://forum.arduino.cc/t/controlling-a-5v-relay-module-with-an-esp32/884689/3

As far as the esp32 is concerned, level shifters are not required if using a separate power supply for the relays. There's a wiring diagram in the link that shows you how to do it.

@inq, indeed, sensors like pH, Orp, and Conductivity are all VERY much temperature dependent and require precise temperature measurement to get good results from your measurement.

I also would recommend capacitive type soil sensors as they would last much longer than resistive types that are prone to corrosion of the probes due to electrolysis. here a link to capacitive sensors .. https://www.circuitschools.com/interface-capacitive-soil-moisture-sensor-v1-2-with-arduino-lcd-and-oled/

Good luck with your project @dasterlydoug..

regards,

LouisR

LouisR


   
DastardlyDoug, Inq and Ron reacted
ReplyQuote
Page 6 / 11