Geekzone: technology news, blogs, forums
Guest
Welcome Guest.
You haven't logged in yet. If you don't have an account you can register now.
Filter this topic showing only the reply marked as answer View this topic in a long page with up to 500 replies per page Create new topic
1 | 2 | 3 | 4
1916 posts

Uber Geek
+1 received by user: 374

Subscriber

  Reply # 1893446 1-Nov-2017 08:57
One person supports this post
Send private message

Very impressed with your Instructable. Very well done. 




299 posts

Ultimate Geek
+1 received by user: 62


  Reply # 1893611 1-Nov-2017 13:23
Send private message

linw:

 

Very impressed with your Instructable. Very well done. 

 

 

Thanks! I find it frustrating that too many instructables projects assumes the person following it, already has knowledge in what they're following - which kind of defeats the purpose because if they did, then they would already be able to work it out themselves.  I like to write instructables so the person gets educated as they follow the steps in the project - its really a summary of what I learn't doing it myself.

 

Feel free to vote for it if you like :-)  I've entered into the instructables electronics competition - worth a shot...!

 

 




299 posts

Ultimate Geek
+1 received by user: 62


  Reply # 1956881 14-Feb-2018 10:51
Send private message

chimera:

 

Got the basic's of this going last night, works pretty well. Thanks so much for your help Aredwood, it makes sense, well - now that I've done it! 

 

EDIT: The only one downside, is the Wemos doesn't power up when the alarm powers up.  Suspect the alarm panel must draw a bit of power on startup, I'll try some capacitors for the Wemos see if that helps.  Other issue is powering off alarm panel all the time for testing, comes up with fault 12 hours later but luckily it is only because the date/time isn't set.

 

 

 

Breadboard to alarm...

 

 

iPhone view of OpenHAB

 

 

 

 

 

 

 

I want to revisit this... specifically my post above where I mention "The only one downside, is the Wemos doesn't power up when the alarm powers up."

 

As my alarm system has been powered on all this time, and the circuit was running off a breadboard I'd forgotten about this small issue.  While its powered, it runs fine (eg; power up alarm system, wait 5 seconds, and THEN plug power to the circuit)  I've now soldered this to a PCB and was going to enclose into the alarm panel, and noticed this small issue has come about again so need to remedy.

 

The issue is when everything is connected (circuit board to alarm and PIR zones etc) and I power up the alarm system (which also powers the Wemos) the Wemos doesn't work. The LED on it flashes once briefly, but it doesn't run.  I've worked out the issue is due to the GPIO's (that are connected to the comparator outputs) and I suspect its possibly something to do with the "alarm system power on test" (as I've tested it with comparator outputs unplugged, and it boots up fine)

 

The problem has something to do with the GPIO pins - I suspect the voltage that is hitting these is causing the issue, but I can't work out where or why. 

 

Any ideas?

 

 

 

Here is what it looks like (ignore the voltage reg on the right, that's been replaced with a buck convertor - although is irrelevant to the issue)

 

 

 


517 posts

Ultimate Geek
+1 received by user: 117

Subscriber

  Reply # 1956909 14-Feb-2018 11:16
Send private message

Have you tried seeing if its the ESP8266 crashing?

 

If you plug it into a computer and bring up a serial terminal if it does crash it will dump the crash log.

 

It may be something as simple as a number being out of bounds during the power on cycle.

 

If its the LM339 crashing the only suggestion would be to put a p channel MOSFET on the power rail to the LM339 and have the ESP8266 bring it high after a select amount of time.





Geoff E

674 posts

Ultimate Geek
+1 received by user: 239


  Reply # 1957000 14-Feb-2018 12:17
Send private message

You should check the rise time on your power supply to the wemos. Make sure the rail doesn't take too long to come up.

 

If it is this, you can get reset ics that hold your MCU in reset until the power rail is up.




299 posts

Ultimate Geek
+1 received by user: 62


  Reply # 1958320 14-Feb-2018 21:03
Send private message

It's not rise time, power is near immediate to Wemos (prior to buck convertor, 9V then jumps to about 12V - but seamless at 5V on buck output)

 

It's not ESP crashing, certainly not a coding issue.  As I say, works normally as per usual.

 

Delaying to power the LM339 makes sense, I'll work through this in my head and see how it goes.

 

Thanks for your replies!


674 posts

Ultimate Geek
+1 received by user: 239


  Reply # 1958342 14-Feb-2018 21:51
Send private message

There is more to crashes than software.
Yes, if you have current coming in the gpio before the cpu boots, that could be problematic.

Do any of those gpio signals exceed vcc?



299 posts

Ultimate Geek
+1 received by user: 62


  Reply # 1958353 14-Feb-2018 22:26
Send private message

Yes actually they do. I think 6.6V I measured. The pins are defined as pull-ups in code, but you’re saying there is a likelihood that the higher voltage is hitting the pins before the board is able to boot and define those pins as pull-ups?

 

 

 

Confirmed voltage on GPIO pin jumps high to about 6.7V for 1-2 seconds before dropping down to the ~4.7V or so range.  How do I avoid this?!


674 posts

Ultimate Geek
+1 received by user: 239


  Reply # 1958369 14-Feb-2018 23:53
Send private message

It could be the fact the pin voltage exceeds VCC - usually modern chips can handle an active input pin on boot.

 

Solve with a clamp diode - anode on GPIO, cathode (stripe) on VCC.

 

More info on illegal pin states is in the hardware manual for the MCU (sorry not familiar with that particular one you have, just speaking generally with my comments).

 

http://www.kevinmfodor.com/home/My-Blog/microcontrollerinputprotectiontechniques

 

Pic half way down the page shows this idea. 


3109 posts

Uber Geek
+1 received by user: 1205

Subscriber

  Reply # 1958373 15-Feb-2018 01:35
Send private message

@chimera Are you sure that your buck converter doesn't cause a voltage overshoot at power on? Also verify you have good ground connections between alarm, LM338 and wemos. As there will be large currents in the ground wires at switch on. Any resistance will mean voltage differences that shouldn't be there. You can get lots of weird and difficult to trace symptoms caused by high resistance ground connections.

What is the default state of the wemos gpio pins at switch on? if it is logic high, that combined with the alarm doing its self test and activating the LM338 will short the gpio pins. As they will be trying to go high and low at the same time.

Try installing 1Kohm resistors in the wires between the LM338 and wemos. This might fix your problem. And if not, you can measure the voltage across those resistors to figure out if power is flowing out of the wemos pins, or into them.

Most microcontroller boards have a power supervisor circuit that does the equivalent of continuously pushing the reset button until the power rails reach their correct voltages. Check what state the gpio pins are in while this is happening.







299 posts

Ultimate Geek
+1 received by user: 62


  Reply # 1958419 15-Feb-2018 08:35
Send private message

Apologies, it was too late at night to be working on this... GPIO voltages are actually ok, I was measuring the comparator inputs rather than outputs undecided

 

I measured GPIO pin voltage and they are very low Vcc on power on.  GND connections from what I can see are good.  Buck convertor voltage output is dead on 5V on power up (plus as I say, if I plug power to the Wemos AFTER the alarm system has powered up it runs ok)  

 

However, I just did a test with the 12V VCC to the LM339 VCC unplugged, and the Wemos booted up fine.  So, if I control the LM339's power on by code instead, this should in theory work right?

 

If I'm powering on the LM339 via a MOSFET then I'd want an N channel wouldn't I?  Because the GPIO pin will be LOW on power up, and I'd need to provide HIGH to the gate to power it?  Or would it be better using a P channel MOSFET with pull up resistor then pull the gate LOW to power it?

 

 




299 posts

Ultimate Geek
+1 received by user: 62


  Reply # 1958488 15-Feb-2018 10:42
Send private message

I had an N channel FET (2N7000) floating around so hooked it up with a 1K ohm resistor pulling the GPIO pin to ground, gate to GPIO, source to GND, drain to GND pin of LM339 and altered the code in setup to set "LM339" GPIO pin low first, then delay a few seconds, then pull it high and it worked a treat. Thanks Geocom for the suggestion! Question though - would it make more sense to use a P channel FET still?  Eg: so I'm not wasting power by holding a dedicated GPIO pin HIGH all the time?  Is that the main difference between P and N from a usability point of view? 

 

 


517 posts

Ultimate Geek
+1 received by user: 117

Subscriber

  Reply # 1958536 15-Feb-2018 11:36
One person supports this post
Send private message

The key difference between a p-channel and n-channel is that p only works on positive and n only works on negative.

 

The reason I suggested a p-channel is in some chips the GND can be tied to multiple pins even ones not marked GND(https://www.youtube.com/watch?v=2yFh7Vv0Paw) where as this should not really be the case with the positive rail.

 

But if it works fine with a n-channel mosfet then there would be no real reason to change it for a p-channel one.





Geoff E

3109 posts

Uber Geek
+1 received by user: 1205

Subscriber

  Reply # 1958789 15-Feb-2018 20:47
Send private message

Another possible test. Try temporarily connecting the 4 Wemos inputs to ground. And see if that stops it from booting.

It's always good to try and find the root cause, rather than have a possible unresolved race condition.





674 posts

Ultimate Geek
+1 received by user: 239


  Reply # 1958821 15-Feb-2018 22:12
Send private message

That's right @aredwood.

 

i suggest you follow his earlier suggestion to check the state of the GPIO's internal pullup/down at boot.

 

You might find that all you have to do is invert the signal arriving at the GPIO (and the corresponding software) or, flip a config bit in the IO config register.

 

BTW, what pin numbers use the comparator input?


1 | 2 | 3 | 4
Filter this topic showing only the reply marked as answer View this topic in a long page with up to 500 replies per page Create new topic

Twitter »

Follow us to receive Twitter updates when new discussions are posted in our forums:



Follow us to receive Twitter updates when news items and blogs are posted in our frontpage:



Follow us to receive Twitter updates when tech item prices are listed in our price comparison site:



Geekzone Live »

Try automatic live updates from Geekzone directly in your browser, without refreshing the page, with Geekzone Live now.



Are you subscribed to our RSS feed? You can download the latest headlines and summaries from our stories directly to your computer or smartphone by using a feed reader.

Alternatively, you can receive a daily email with Geekzone updates.