Use this forum to chat about hardware specific topics for the ESP8266 (peripherals, memory, clocks, JTAG, programming)

User avatar
By GarryKeogh
#48128 Testing your collective wisdom if you don't mind?

About the project...
I mess about with this kind of stuff, hacking I believe you call it :D I also have four bicycles in a garden shed and there is plenty of crime with bikes being sought after. I have upgraded my home security system so that the house is now IoT enabled. There is a Raspberry Pi embedded in the home security panel which interfaces using GPIO. Specifically I have a "System Armed" and "System Alarming" inputs to the Pi and I have the fire alarm circuit of the home security through a relay driven again by the Pi's GPIO.
The Pi is running Mosquitto and is the MQTT broker handling messaging between my Nodemcu and the Raspberry Pi.
I have some code working on the Nodemcu and the Pi and it is sweet. I set my home security and the shed security system automatically arms and acknowledges the arm message from the Raspberry Pi. All works well and I can simulate an intrusion to the shed and the shed security "alarms", via the MQTT link the house security also "alarms" and the Python code on the Pi uses bash/cURL to push (pushbullet) a message to my phone. Happy days!

So I have plenty experience with electrical/electronics and Pi's and Arduinos but this doesn't make sense. I have worked in the industrial automation business for years, this is all simple stuff but it won't work on external power! I am stumped!

If I power the Nodemcu via the USB then it starts and runs fine. If I plug the module on to the board below (with 5V from the buck converter to the 5V pin on the module) then it will stay running even if I remove the USB lead. If however I supply 5V through the module pins (no USB supply)... Nothing! There is power getting to the board via the 5V pin as the board regulates my 5V down to 3V3 using the on board linear reg.
If I power the module via the 3v3 pins it is just the same, I tried this, it won't start???

Image

There's the board, all the I/O is on the right:
D0 - No connection (will be door magnetic reed switch)
D1 - Pull Up (10K) to 3v3 (reading row 2 of 4 x 3 matrix keypad)
D2 - Pull Up (10K) to 3v3 (reading row 4 of 4 x 3 matrix keypad)
D3 - Series resistor 1k8 to base of 2N2222 (polling column 1 of 4 x 3 keypad)
D4 - Series resistor 1k8 to base of 2N2222 (polling column 2 of 4 x 3 keypad)
3v3 - VCC used for D0, D1 pull up
GND - Emitter of 2N2222 of D3, D4, D5, D6, D7
D5 - Series resistor 1k8 to base of 2N2222 (RGB Red Led)
D6 - Series resistor 1k8 to base of 2N2222 (RGB Green Led)
D7 - Series resistor 1k8 to base of 2N2222 (RGB Blue Led)
D8 - No Connection
D9 - Series resistor 1k8 to base of 2N2222 (Piezo Buzzer)
D10 - Series resistor 1k8 to base of 2N2222 (105dB Piezo Siren)
GND - Emitter of 2N2222 of D9, D10

Am I missing something? The buck converter is good for 3Amps or so. I can probe the board and there is 3.3v on all the 3.3v pins, 5v on the 5v pin but I get no LED's on the Nodemcu? The fact that I have 5V on the board and the internal linear reg is supplying 3.3v to the pins tells me there is no short to ground. I just can't work out why the module does not boot? The whole system runs of 12Vdc solar/battery through the green screw terminal and yes, I take 12V out to the 105dB siren through the red/black wires and the header. The only other 12V connection is to the buck converter supply pads.

Any ideas? I would be much obliged if you can spot my mistake!!!


Thanks

Garry
User avatar
By GarryKeogh
#48342 I think I may have found the issue. I checked the board a dozen times assuming it was a bad solder joint or a piece of copper track not right but all seems well.

The problem (not fully verified yet) looks like the boot mode options which are selected by adjusting pin levels on the ESP Module. Looking at my strip board I have a 10k pull up resistor between D3 and 3.3V which maps across onto GPIO0 on the ESP Module. Looking at the text pasted below I think I am confusing the boot process. It makes sense as if I power up my PCB and lower the NodeMCU module slowly onto power pins before the GPIO pins make contact it boots normally.

Looking at the setup on my PCB I think I can swap D2<->D4 and D3<->D5

ESP Boot Modes

The Espressif code can boot in different modes, selected on power-up based on GPIO pin levels. (MTDO is equivalent to GPIO15).

MTDO GPIO0 GPIO2 Mode Description
L L H UART Download code from UART
L H H Flash Boot from SPI Flash
H x x SDIO Boot from SD-card


Hope this sorts it, off to do some soldering...

Thanks

Garry
User avatar
By martinayotte
#48343 I'm not sure to understand your issue...
Of course, to boot in normal execution mode, the GPIO15 needs to be LOW while GPIO2/GPIO0 need to be HIGH.
But since you're using a NodeMCU module and not a plain ESP, those pullups/pulldown should be already present on the module, you don't need to add some others externally.
User avatar
By GarryKeogh
#48464
martinayotte wrote:I'm not sure to understand your issue...
Of course, to boot in normal execution mode, the GPIO15 needs to be LOW while GPIO2/GPIO0 need to be HIGH.
But since you're using a NodeMCU module and not a plain ESP, those pullups/pulldown should be already present on the module, you don't need to add some others externally.


I get what you mean and I am not sure I understand either Martin!

So I have tried about 10 new fixes including changing a couple of inputs to outputs and re-wiring some of the PCB to be absolutely sure that the GPIO pins I mention are actually pulled high or low on the NodeMCU header pins.

To be honest I can not see any reason why the board won't boot when installed on the pcb. If I carefully engage the left side pins (same side as A0, RSV pins and 5V, 3.3V and GND pins) it starts fine, runs the code I uploaded and is 100%.

If however the GPIO pins on the right hand side are connected before power is applied it is dead. All voltages are correct but it doesn't boot.

I have a second board in the anti-static bag which I may try later but I can not work out why it won't work! :(

Garry