First of all, apologies for the poor questions. As wvmarle's signature says, it's difficult to give good answers with s****y questions like mine.
My project is around an AeroGarden hydroponic system, an old model which is not connected to any IoT system. It just switches on/off the lights and cycle the water inside the tank.
As I am learning the amazing world of microcontrollers and sensors and got a few of them, I am planning to connect the following sensors to the NodeMCU V3 (and possibly a MEGA2560) which will be connected to my Wi-Fi and send data to my MQTT server connected to Home Assistant:
-
A MPX5010DP to detect water level. It runs on 5v only and uses an Analog pin.
-
A 18B20 Temperature Sensor to get the temperature of the water. I want to plant chillies (and basil, coriander and mint) and it seems water temp is important. It can work on 3.3v and uses a single Digital pin for data.
-
A BME280 Temp, Pressure and Humidity Sensor for the room's temp and humidity, requires 3.3v and communicates over SPI
-
A Photo cell (CDS Photoresistor) to log when lights are on/off. 3.3v and 1 Analogue pin.
-
A MQ-2 Gas sensor. The hydroponic garden will be placed next to the flat's boiler and I want to monitor a possible leakage. 5v, 1 Analogue + 1 Digital pins
-
An active buzzer as an alarm.
-
A 2 colour LED as a visual indicator of the system
I also have a MEGA2560 and a TFT screen shield for it, which I wanted to use as a monitor of the system with a HC-SR501 PIR Motion Sensor to switch the screen on and off when someone is in front of it. All the 5v sensors were going to be connected to the MEGA and the rest to the NodeMCU. But the screen doesn't support to switch the backlight on/off, so maybe I scrap the MEGA and get another screen which can be controlled directly from the NodeMCU.
Maybe all of this is too much for a single NodeMCU board, but I prefer to aim high and then, learn from the problems I may face. I am learning about MOSFETs (thank you, Paul__B!), logic level converters, how screens work, powering the NodeMCU and the MEGA, communicating between them, growing chillies and, hopefully, to ask better questions.
Plan A is NodeMCU + MEGA + current screeen.
Plan B is NodeMCU + new screen.
Plan C is NodeMCU + MEGA + new screen 3.
The main problem so far with plan A is the screen. Tested all sensors successfully. I'm still thinking about how to power the boards, probably will split a single 5V 2A PSU and power the boards via USB. They may communicate over I2C (or maybe PJON?)
Plan B's challenge is to learn how to use 5v sensors with the 3.3v NodeMCU. I see this as basic knowledge with Arduinos, so I'm eager to try. Logic level converters are not the solution like I initially thought. Voltage dividers? I've got a PCF8574 digital expansion board and a CD74HC4067 analog mux. I have used them before but not on the NodeMCU. Also, I would like to learn about calculating and measuring current in the circuit, so this could be a good chance to do it.
Plan C looks more feasible to me. Still a lot of chances to learn new things...
Any feedback is very welcome. Thank you for your help!