I had interesting problem. I wanted to add presence detection to the far end of my driveway but didnt want to run dedicated power to the location. I had 12 volt LED lights that I had already installed but didn't want to keep the lights on 24/7 just to run a pi Zero for the presence detection. So I added this little device, it charges to full capacity while the lights are on and then runs the Pi for about 24 hours on battery. The lighting turns on everyday for 4-6 hours and then acts as security lighting when the presence sensor 'sees' something. The battery pack has Over and Undercharge protection and it does not turn off due to low current draw! I hope this helps with someone else's project, I do a lot of LED stuff so most of my projects have 12volts handy so this is a real timesaver for me. I don't know how to determine if its on battery or charger, if someone has a suggestion on that I'd like to know how to do it. I could then put in a safe power down after a set period of time if there is no charging.
Thank you
So you probably need some way to detect whether current is flowing to the input then you would know if it was charging?
There are several ways to measure current that would connect to the Pi - somewhat depending on how DIY you want to get?
Have a look at this tutorial guide I wrote for a couple of my IoT students to explain how to use the INA219 voltage/current/power sensor, it might be useful in your situation.
I love those big battery packs, they are useful for so many things...
I may not have read everything correctly, but it seems to me that when your LEDs are on, it's on charger. When your LEDs are off, it's on the battery.
It should not be too much of a challenge to take the output of the 12V charger (which is energized when the LEDs are on), use a voltage divider (or a small 12-3.3v regulator) to provide a high signal when 12V is applied. That signal goes to a GPIO pin where it is processed. You can use an optocoupler too.
I'm curious as to what kind of sophisticated "presence" detection requires a Linux microcomputer. Seems to me that an ESP8266 could do the same thing, but I don't know what it is you are doing (but I am curious!).
CaptClaude -The simple answer to your question is I can't figure out how to use ESP8266 reliably with MQTT, or wifi or anything else. I have drawer full of them! I started this hobbie about a year ago and only know how to use Nodered to program . Since a Pi Zero is only $10.00 I just use those and make ridiculously elaborate waterproof housings for them and their relays. The presence detection is relatively simple, I use these. They work well (so far)
Thank you! dynamicdave I'll check that out.
When I first tried the ESP8266, I had lots of problems as well. Until I purchased my first Wemos D1-Mini. My problem was power, I didn't know enough about reliable power supplies to be able to get a bare ESP device working reliably.
The D1-Mini has a decent on-board power supply and you simply use a convenient USB charger. Programming is fairly easy if you use the Arduino IDE. I found other methods too complex for me & I'm not very familiar with C/C++ so the Arduino IDE is perfect as it keeps everything as simple as possible. Of course, there are hundreds of convenient libraries for Arduino and the majority work absolutely fine with the ESP8266.
But, you can even avoid programming the ESP at all by using one of the several excellent pre-built firmwares such as ESPeasy or ESPhome.
Here is a long thread about using these sensors with ESP8266 and ESPeasy. There certainly seem to be some challenges.
The Wemos D1 Mini is probably the best ESP8266-based device to purchase as it has a CH340 programming chip on the board. This means it is dead-easy to flash an alternative firmware onto the D1.
If you use one of these releases you'll find the 'zip' folder contains a 'flasher' so all you need to do is plug the Wemos D1 Mini into a USB socket and flash-away.
IF you are running on windows. It doesn’t run on a Mac.
Thank you all for the help. I've been inspired to get into this again. I do have one more question. Lets say I get an Node MCU ESP866 up and working (I just was able to make it blink!) will I be able to program it via wifi at some point? or will it always require to be plugged in to alter the programming? Thanks I know I'm way off topic for this forum but I do appreciate the help.
Once you have the Wemos D1 Mini up and running, you can alter the device's configuration, device drivers and the rules just by logging-in to the device to gain access to the web management panel.
All my devices have fixed IP addresses, so all I do is type something like this into a web browser...
192.168.1.41
And hey-presto I'm connected to that particular Wemos.
PS:
Paul was right about iOS, ESP-Easy Flasher only works on Windows-OS.
I am sympathetic to the pains of programming tiny computers, but I have not had any problems with the ESP8266 (D1-Mini or NodeMCU) since I gave up trying to use Lua to program them. I love MQTT and currently have a bunch of D1-Minis around the house sending and receiving data via MQTT. I use a Raspberry Pi as a broker and if passes data among the D1-Minis to do what I want.
The pre-built firmwares that are available are simply fantastic. I use Tasmota in all of my Sonoff devices and setting it up is very quick and easy. I'm simply astonished at how well it works.
As for the Pi0W, it's my second favorite platform after the ESP. I have a drawer full of Arduino clones that I no longer use because they don't have WiFi or enough memory. I love the Adafruit M0 & M4 Cortex boards because they are small & very fast. And if I want, I can use Circuit Python with them.
If you want to make use of all those ESPs you have, there are Reddit forums for help. Remember: start simple and build slowly.
Yes, it is possible. It is referred to as OTA (Over The Air). There are various ways to do it and things like ESPeasy have it built in.
Thank you all, I am able to turn on a LED controlled by the ESP8266 via an MQTT signal from Node red running on a Pi. I now feel like I've won the lottery or the Nobel prize!
I am looking for a simple sketch that I can modify to send the a message via MQTT from the ESP8266 when the radar sensor "sees" something. Just a 1 or 0. I can take it from there once it gets to Node Red. Any suggestions? I don't want it to print anything to the serial port or send a "intruder detected over there" message. Is there a Node Red something that I can load on this cursed device so I can say:
"Connect to this network, send the state of a pin, via MQTT, to here". I know this is probably very easy, I lack the vocabulary to ask the question appropriately
If you are using the Arduino IDE, add the MQTT library and you will find some examples in the examples menu. Open one of those, amend for your configuration, save, upload.
Its Working! Thanks to everyone for the help. This is a fascinating hobby, days of frustration and feeling like you have made terrible choices of what to do with your free time, and then Eureka, you are the coolest guy on the planet. I'm going to have a cocktail.
now that you have that working - go back and try one of the precompiled firmwares - you will be astonished the difference it makes going forward - EspEasy is dead easy as is Tasmota
Craig
and here is a thread re ESPEasy and your sensor