sqfmi / badgy

Home of Badgy - IoT Badge
http://badgy.sqfmi.com
MIT License
309 stars 61 forks source link

Works with USB power, not with battery? #20

Open codepope opened 6 years ago

codepope commented 6 years ago

Set up badgy on USB power, things behave as expected. Board LED glows flickers blue. Board boots up.

Popped a LIR2450 in with no USB connection and... nothing. Won't wake up, won't reset for new sketches, no LEDs glowing.

Pop in USB with LIR2450 in place, board LED glows bright blue (charging?) and board functions.

Any suggestions as to trouble shooting this?

chunkysteveo commented 6 years ago

Just received my new (WHITE PCB) version and can echo the same here - Works fine on USB, appears to charge when an LIR2450 is in place (blue LED) and USB plugged in. Can switch on with an LIR2450 and USB connected, and interestingly when I disconnect the USB while still on it still works. Switch off and back on with just the LIR2450 and no power.. Have not looked into testing where power getting to, and also just testing another LIR2450, but this is odd behaviour indeed! It's like the USB connection trips it on, and without that initial USB trigger, it doesn't power up?

@codepope - if your board is working with both USB and LIR connected, disconnect the USB and does it still work on the battery? And then when you switch off and on, does it then fail to boot up?

Would be worth people advising which boards they have, I.E. I now have a blue PCB version with programming headers, and now a super cool white PCB with a serial-USB programming chip on the USB (very cool additon!)

codepope commented 6 years ago

That's exactly what I'm seeing. (White PCB too). USB+LIR boots, pull the USB, it carries on running, then switch off and back on and it fails to boot up.

chunkysteveo commented 6 years ago

hmmmm, maybe the power regulator is not detecting the battery voltage to switch on? Trying another battery here, but sounds like a valid problem.

codepope commented 6 years ago

Seems to be another symptom - when you do the switch on with USB and then pull the USB the default sketch reports multiple incorrect directions selected when the stick is touched. Plug the USB back in and it reports as normal.

chunkysteveo commented 6 years ago

Yes(!), did not notice that, but now also seeing that the button message reports randomly when going from USB to BATT, and it tends to report multiple button presses, and incorrect ones. It's actually reporting multiple presses as I type this and I am not touching it. Sounds like the button is not being de-bounced correctly, or something to do with the ground - unless on USB which may be grounding things correctly?? Could also tie in with the battery issue, maybe there is an incorrect ground issue when running on battery, so it won't boot up from battery?

chunkysteveo commented 6 years ago

Also - not sure if this is part of the schematic, but if you plug in the USB with switch ON (after it runs on BATT), it does not work. Switch if off and on again with the USB still plugged in, and it still does not work. I have to remove the USB, switch OFF, and then plug in the USB and switch ON. This is not how the blue version of the board works.

Additionally to the previous post - running on BATT when you power up with USB and then remove it - the Badgy stops responding after several minutes. So maybe it's not running on battery at all, but some residual energy stored up in the capacitors, but that doesn't make much sense?!

I am going to poke about with a multimeter and see what voltages we are seeing. Have tried this with three LIR2450 batteries too.

chunkysteveo commented 6 years ago

@sqfmi - any thoughts on this odd behaviour of the new boards? Noticed the use a new charge IC too, the TP4054.

Flet commented 6 years ago

Same exact issue here :(

New white PCB. Tried two different fully charged batteries.

@sqfmi any thoughts?

chunkysteveo commented 6 years ago

Oh ho.... Huston, we have a problem..! 😣

sqfmi commented 6 years ago

Sounds like it could be a hardware issue with the new batch, let us investigate the issue and get back to you guys shortly.

chadvavra commented 6 years ago

I just received 2 white PCB units and can also confirm that they do not boot, or even power the esp on battery power.

sqfmi commented 6 years ago

Brief update, it seems while on battery power only, you are able to turn it on by resetting it. This can be done by using a metal object to short the reset pin with the metal shield (e.g. paperclip, key, etc.):

image

Hacky solution for now, will continue to diagnose the root cause.

codepope commented 6 years ago

Doesn’t seem to be working for me.

chunkysteveo commented 6 years ago

I can confirm this hack works for me and boots the ESP8266 on battery power.

A better connection to "tap" @codepope would be the lower pad of the Lipo JST connection (which is ground). Not the upper pad as that is the positive to BATT. The casing didn't seem to give a good reliable ground connection, but turn on the switch, put a wire (I used a dupoint breadboard wire) on the RESET pin imaged above, and then tap the lower JST pad - the ESP should flash it's blue light on boot. (don't tap the left side pads of the JST connection, these don't seem to be tied to ground, just mechanical fixings)

codepope commented 6 years ago

@chunkysteveo Yes, the JST pad is easier to tap, but still no joy. To ensure I was getting a reset, I applied USB power and ground tapping the reset line did reset.

chunkysteveo commented 6 years ago

hmmm, not good. Assume battery is fully charged too? Some flake-y issues going on to be sure! Hopefully there will be a fix soon, even if it's a bodge wire fix...!?

codepope commented 6 years ago

Well, I thought it was, but testing says otherwise. Tried another battery which shows charged and it didn't play ether.

bmv437 commented 6 years ago

As a temporary fix, I added a reset button between the ground pad on the JST connector, and the RST pin on the ESP8266. Also threw on a JST connector and LiPo battery since I didn't have a proper coin-cell size LiPo.

Now I just power it on, and click the reset button to boot the ESP8266.

It would be nice to know what the actual issue is, but this works for the time being.

dpcdmrmxoaapgms

Korenchkin commented 6 years ago

can we have schematics for this version?pretty please? :) the switch behaves strange,i want to know what i'm doing

chadvavra commented 6 years ago

I put in a LIR2045 and tried the bodge wire with no luck. It does work with the USB power though.

I just probed and found that with a LiPo battery I get 4.0v at the JST connector and only 3.2 at the ESP8266 reset pin. When I ground it, it does nothing at all. Disconnected my color screen to see if that was causing something and still no response.

sqfmi commented 6 years ago

@Korenchkin yes! Thank you for the reminder :) The new schematic is in the hardware folder now.

Everyone else, sorry we're still trying to debug the issue :(

Korenchkin commented 6 years ago

thanks for the schematic!i tried to find the problem,but this makes my head hurt..everything seems okay for starting,i'd try pulling the usb chip and stick with prog header(i'm guessing some leakage to ground),but maybe somebody will make smarter solution..like cap on reset?tried that,but did not work for me..but at least i know what the switch switches...

sqfmi commented 6 years ago

Removing the CH340C does seem to work! But the reason is unclear at this point... we'll try to do some further investigation with a scope.

chadvavra commented 6 years ago

I would like to go on the record as saying that the CH340 is the devil's brood.

I flipping hate those things

bmv437 commented 6 years ago

@sqfmi If you're looking for better alternatives to the CH340, I'm a big fan of the SiLabs CP2104. Adafruit uses them for all their newer dev boards. High data transfer rates, better driver support than the CH340, and cheaper than an FTDI. Adafruit has more details on their product page: https://www.adafruit.com/product/3309

Korenchkin commented 6 years ago

Just a theory,could the ch340 be pulling down gpio0 and/or reset over the 2 transistors?maybe only on start befor it semi-charges its vcc cap?then there are only rx/tx pins,they should not do anything high or low,and that seems all the influence it can do powered off

ibuildrockets commented 6 years ago

@sqfmi Hmm.. Reset didn't work for me - the LED on the ESP8266 blinks when reset - but nothing. In fact, I get absolutely nothing happenng now :( sketches won't upload and the currently loaded sketch (weather) won't refresh :,( Oh, and the circled component is scortching hot - 20181017_215502

chunkysteveo commented 6 years ago

Can you upload a sketch via the USB 2 serial?

g2rHP7prvJqO commented 6 years ago

Removing the CH340C does seem to work! But the reason is unclear at this point... we'll try to do some further investigation with a scope.

I am also suffering from this major issue which makes the Badgy basically 99% useless. @sqfmi I'm strongly considering de-soldering the CH340C but is there any other active/passive component I need to de-solder too to completely fix this issue and avoid any side effects? Could you please confirm that I can still flash my badgy using a USB-serial adapter connected to pins 1/3 (first two pins top-right opposite of reset pin) once done with the CH340C?

g2rHP7prvJqO commented 6 years ago

Yes(!), did not notice that, but now also seeing that the button message reports randomly when going from USB to BATT, and it tends to report multiple button presses, and incorrect ones. It's actually reporting multiple presses as I type this and I am not touching it. Sounds like the button is not being de-bounced correctly, or something to do with the ground - unless on USB which may be grounding things correctly??

@chunkysteveo I observed that too. It certainly has to do with the fact that the UP/DOWN buttons use the same pins as the Serial TX/RX and that bloody CH340 is playing on those sending "phantom button presses"...

ibuildrockets commented 6 years ago

Can you upload a sketch via the USB 2 serial?

@chunkysteveo No :(

Korenchkin commented 6 years ago

@ibuildrockets try with python esptool,launch the command,short gpio0 and reset manually,i was able to erase flash,but after reset i was not able to flash anything until i shorted them...also check for 3.3v,that hot element is inductance for high voltage for the display,if it is hot,it colud mean transistor is on(i think on from esp,can't find it which pin..i must be blind) and not pulsing,if the program is not running,could be the cause..

codepope commented 6 years ago

Any update @sqfmi ?

ibuildrockets commented 6 years ago

@Korenchkin esptool run - I've finally managed to get it to the point where I can upload the hello sketch - however the display is frozen still on the "weather" sketch :(

Korenchkin commented 6 years ago

hmmm,if it uploaded sucesfully,could be the high voltage generator is broken(transistor or coil?)..check without battery if you can,so we can be sure reset went okay

ibuildrockets commented 6 years ago

@Korenchkin I've been using the USB power from the PC, not battery :(

pastorhudson commented 6 years ago

Just tried my white badgy on battery for the first time, and nothing. It does work when I plug and unplug the usb cable. But power cycling with the switch doesn't work without usb power.

I also experienced phantom Left button and down button presses. They are consistent. I can't use those functions in sketches because they will override other inputs.

sqfmi commented 6 years ago

Sorry for the delay, here's an update to the issue:

  1. Though we're still not exactly sure why the CH340C is causing Badgy to malfunction while on battery power only, removing it does resolve the issue. One option is to remove the CH340C and rely solely on OTA to upload your sketches, like in the original Badgy (all code samples currently have this built-in). If your Badgy requires a hardware flash for recovery, refer to the pin-out diagram below:

image

  1. As per suggestion by @bmv437 on the CP2104, we tried replacing the CH340C with it and it appears to work fine in our week of testing. We created an adapter board on OSH Park https://oshpark.com/shared_projects/f7gRYBxi and it can be ordered for about $0.60. See pics below:

image

image

We will continue to investigate if there are other viable solutions. In the meantime, we've asked the factory to build some adapter boards for us; when they are ready, anyone experiencing this issue may request a board from us. Going forward, all new Badgys will be using the CP2104 (╯°□°)╯︵ ┻━┻

chadvavra commented 6 years ago

I found that if you don't want to fully remove the CH340C you can just cut the VCC leg (with a nail clipper in my case) and it will perform as if it's removed.

I figured that if you found another fix it would be easier to bridge that one pin later on.

Huzzah on the adapter boards though. Those look lovely, and like something I will order a few of for all the other stuff that comes with those dodgy chips.

ibuildrockets commented 6 years ago

@sqfmi I'll desolder the chip when I get home tonight, but so far my display's been totally unresponsive and the small back component pictured in my post above ( that @Korenchkin identified as an inductor for the display) is still scotching hot. I've managed to get a sketch loaded after using the Esptool, again as suggested by @Korenchkin, but the display remains frozen on the Weather sketch that I uploaded prior to attempting to get the battery working. Any suggestons on how I may get this working again, or is my badgy toast?

pastorhudson commented 6 years ago

Does the CP2104 also address the button issue? Or should I open a separate issue?

sqfmi commented 5 years ago

@ibuildrockets none of the components should be scorching hot, something may be faulty or damaged for that to occur. Did this always occur, or only after uploading the weather sketch?

@pastorhudson following up on #27 @chunkysteveo has created.

codepope commented 5 years ago

@pastorhudson taking the ch340c off resolves the button issue (but unfortunately, end of line with my badgy as the epaper apparently cracked in the process.... so can't dig any further).... now to wait for some cp2104 based badgys....

chunkysteveo commented 5 years ago

@sqfmi - Is there a way to disable or cut the power to the CH340C when on BATT? Would that allow the CH340C to power up on USB and work, but on BATT be powerless and not interfere with the buttons and also maybe boot the ESP8622 chip up? Are the VUSB and VBATT connected, am looking at the schematic and assume no, using the mosfet as a power switch? Or is that the issue, that it is powerless on BATT and causing the issues?

Love the idea of the CP2104 adaptor board and will be keen to get one, but looking to see if we can salvage the CH340C with some bodge wire somehow...?!

chunkysteveo commented 5 years ago

Or how about bodging on a small slide switch to power off the CH340C? From the comment above - cutting the VCC leg of the chip makes the Badgy work. So could we bodge a "PROG/RUN" switch to essentially power off the CH340C chip to allow it to run? Could we not tie this in with the mosfet that controls when the Badgy is running on USB or BATT power?

Steve

chadvavra commented 5 years ago

@codepope you can replace the eink really easily. I changed mine out with a yellow 3 color display.

https://www.waveshare.com/catalogsearch/result/?q=2.9+Inch+E-Paper

just get a Raw display panel, otherwise you'll have an extra button-less ESP8266 driver board for no reason.

JonPrevost commented 5 years ago

Received 10 white boards all with this battery problem, haven't looked at the button press issue yet. I'm looking into a capacitor (low pass) solution. If effective I'll post my solution.

codepope commented 5 years ago

@chadvavra Already done that and back up and running today.

@sqfmi any idea when the adapter board (and next batch of badgys) will be about?

ibuildrockets commented 5 years ago

@sqfmi - the issue occurred after uploading the weather sketch and resetting the ESP8266 as described in the 'Hacky solution' from October 8th above :(

Brief update, it seems while on battery power only, you are able to turn it on by resetting it. This can be done by using a metal object to short the reset pin with the metal shield (e.g. paperclip, key, etc.):

image

Hacky solution for now, will continue to diagnose the root cause.

chunkysteveo commented 5 years ago

Any updates on the diagnostics, the CP "hack" PCB's, any other fixes, revisions of the PCB @sqfmi ?