the USB is plugged into my laptop which is delivering 1a and 5.07v I’ve also tried it in a wall socket where it is getting 2a but with no joy.
as I have two I split one down to start again and only wired the 5v and ground of the input, connected it to a 5v 2a power adaptor (that I use to charge my phone) but still no joy. after words I checked the charger again to see if mybe i had blown it but it still works perfectly and if I connect the ESP-01s to the breadboard again for power, everything is great.
the load that will be attached to the relay will be my phone, but at the moment I havent attached anything to that end as I am just trying to find out where I am going wrong with gettign it to work. Yes it is on by default, the idea is to have the relay turn the power off but in the event of a problem the cable wil open and just charge as normal.
is there any way to check the relay is actually working? and in order for the esp-01s to work does it only need power?
edit:
ok I have played some more and not sure if this will help or not… I thought if I go back to the start (everythign wired up as in the diagram) but this time use dupont wires between the ERSP-01s and the relay I could see if any one connection is causing the problem. so I wired up the 3.3v on the relay to the 3.3v on the board, with the gnd - gnd . the chip powerd up and was visable in ESPhome, I could also see logs. so I pulled the power and connected each gpio in one at a time checking to see if any cause problems, gpio0 is the only one that for some reason prevents the board from booting up.
so I thought maybe I could ignore that one and move the switch on my yaml to gpio2, on doing this i get a blue led turnign on when I flick the switch in HA but other than that, nothing with the relay. any ideas?
my current Yaml file :
esphome:
name: robins_usb_charger
platform: ESP8266
board: esp01_1m
wifi:
ssid: !secret ssid
password: !secret password
manual_ip:
static_ip: 192.168.0.54
gateway: 192.168.0.1
subnet: 255.255.255.0
dns1: 192.168.0.1
dns2: 192.168.0.1
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Robins Charger Fallback Hotspot"
password: !secret appass
captive_portal:
# Enable logging
logger:
# Enable Home Assistant API
api:
# enable over the air updates
ota:
# Enable Web server.
web_server:
port: 80
# Sync time with Home Assistant.
time:
- platform: homeassistant
id: homeassistant_time
# Sensors with general information.
sensor:
# Uptime sensor used in the following formatted uptime sensor
- platform: uptime
name: "Robins Charger Do Not Use"
id: robins_charger_do_not_use
internal: true
update_interval: 600s
# WiFi Signal sensor.
- platform: wifi_signal
name: Robins Charger WiFi Signal
update_interval: 600s
# Text sensors with general information.
text_sensor:
# Expose ESPHome version as sensor.
- platform: version
name: Robins Charger ESPHome Version
# Sensor to display uptime in Days/hours/minutes
- platform: template
name: "Robins Charger Uptime"
lambda: |-
uint32_t dur = id(robins_charger_do_not_use).state;
int dys = 0;
int hrs = 0;
int mnts = 0;
if (dur > 86399) {
dys = trunc(dur / 86400);
dur = dur - (dys * 86400);
}
if (dur > 3599) {
hrs = trunc(dur / 3600);
dur = dur - (hrs * 3600);
}
if (dur > 59) {
mnts = trunc(dur / 60);
dur = dur - (mnts * 60);
}
char buffer[17];
sprintf(buffer, "%ud %02uh %02um %02us", dys, hrs, mnts, dur);
return {buffer};
icon: mdi:clock-start
update_interval: 600s
# Exposed switches.
switch:
# Switch to restart the charger.
- platform: restart
name: Robins Charger Restart
# Switch to turn on/off the charger.
- platform: gpio
id: relay
name: Robins Charger
pin:
number: 0
inverted: true
this is not my code, I cant program to save myself, this is howerver snips of code from various threads and projects that I think work in doing what I want. there may be better easier ways to do this , if so please feel free to tel me, my aim is to try and get this to work and hopefully learn something of how it works along the way.
thank you for all your help, I can appretiate this is not easy, and I appretiate the time you are all taking to help me
robin