I made a more detailed post about this over on lemmy.world, but I might as well show a couple pictures here too.
#Smart mailbox - Tells me when I have mail
67 messages · Page 1 of 1 (latest)
The code makes use of a custom component I made for the VCNL4010, based off Adafruit's library but reworked so it doesn't delay the loop unnecessarily.
Everytime I see these mailbox projects, I always think to myself, "I can't be the only one who gets mail almost every damn day and don't need a sensor to tell me crap is in there" Do you not get mail pretty much daily too?
We get an email each day telling us what we’ll get in the mail, and motion sensing camera to let us know when mail arrives. TBH if we didn’t have both of those, something like this would be perfect!
@slow pumice Me and my wife usually miss to see the mailbox everyday because we don't received many mails. So we are exception 😄
This project is what I wanted to do for my house, because when mail arrives we notice it after days.
@mighty vigil I read the article on lemmy.world, but I don't found a schema, can you share me it?
The end of the post (and second message here) links to the custom component github, which has an example config https://github.com/dixonte/esphome-vcnl4010
Sorry for the late reply, but yeah, I get mail very infrequently. But when I do it's 50/50 junk or the most important mail imaginable.
Do you mean the yaml file or a circuit diagram? I don't have the latter, I just worked it out on the fly. I can share my final yaml config tho. I'll dig it out tomorrow, since I really need to sleep right now.
I mean the circuit diagram, I thought you had yet a draft of the circuit diagram. take your time. You did a very great solution 😉
Ah, no, nothing like that. The hard part was the power circuit, and I basically copied that from an article that's linked in the lemmy post. Everything else was just connecting GPIO ports to headers so I could connect them to the sensors. I am sure you can figure that out. 🙂
If you have trouble I could try and draw something out from scratch.
https://randomnerdtutorials.com/power-esp32-esp8266-solar-panels-battery-level-monitoring/ Here's the article I was talking about, from which I took the power circuit design.
I did use much higher valued resistors, though.
Since even now I think it loses more charge through the voltage divider than powering the SoC or sensors.
You should be able to connect the GND side of the divider to a GPIO, then you can turn it on when you want to measure it.
Looks like I used a R1 of 360 kOhm and a R2 of 1 MOhm
I was wondering if you could do something like that. Next time I make a battery powered device I'll give that a go. As it stands I'm okay with the slow battery discharge with the little solar panels recharging it every day.
The safer method would be a mosfet on the battery line since you're slightly over-volting the input, but it should be fine.
Analogue electronics is not my forte ^^;
I'm pretty sure the max for the analogue input is 3.3v and the divided voltage should max at less than 3.1v
At least the original ESP32 chips are 5V tolerant.
Sorry I don't really understand these sorts of electronics well, but where would you put the mosfet? And how would it solve the over-volting?
(I'm interested in doing some solar ESP stuff eventually, but want to make sure I do it right.)
The voltage divider makes the voltage safe, but disconnecting the GND line to avoid idle current would put the full voltage on the ESP pin. If you instead disconnect the battery voltage at the point it's going into the divider, then the adc pin will be grounded normally, which is fine. Then when you connect the battery voltage, it will go into the divider and everything is still fine.
Aah I see. That makes sense, thanks!
You dont get much mail you say? Well, you just say the word and I can start forwarding some bills to you. I'm just nice like that and you won't feel left out anymore!
I get all my invoices via email, where Heavybell's solution doesn't work 😅
Also bank comunications too.
The only mails we receive are advertisements or spot communications from local or public administration related initiatives.
That reminds me. In college I hooked up a little servo with a mail flag to the side of my monitor, so I could quickly see if I had any unread emails
Sounds like someone is just being shy! Don't you worry, they're on the way
@mighty vigil the power supply its not a my problem, I've the intercom near the mailbox, I waiting the VCNL sensors and then I want try to replicate your solution.
I want also add a BME280 to monitoring the external temperature, humidity and pressure.
This is the mailbox usally in use on my country
so I can draw current from the intercom power supply and then power the device (with a voltage reduce).
Interesting. My concern would be that my solution works by allowing the mail to land flat on top of the sensors, making it really obvious when there's mail or not. With something like this the mail might land upright and avoid the sensor. You might need to put some on the lower back as well as the bottom, perhaps.
Oh that's nice.
Oh right, you wanted the circuit diagram.
The mailbox have 2 hole in the back: one up about in 1/4 from top and the other below about 1/4 from bottom.
You use the i2c so you connected the sensors in the same pins of the GPIO of the ESP, right? (example D1 and D2)
So, the VCNL sensors I got both had the same address, which meant I had to put them on different pins for clock and data each.
If I understand right I need to wrote in the code something like that to manage more sensors:
`i2c:
- id: bus_a
sda: GPIOXX
scl: GPIOXX
scan: true - id: bus_b
sda: GPIOXX
scl: GPIOXX
scan: true`
Yes
i2c:
- id: bus_a
sda: 21
scl: 22
- id: bus_b
sda: 25
scl: 26
This is what I used
oh ok
Actually, hang on...
Here's my entire ESPHome config for the device.
Now, I've made it sleep frequently to preserve power, but you could probably do a much simpler setup since you have a power source for it.
In lieu of a circuit diagram, here's a photo of the underside of the prototype board I used. However everything except the white and blue wires is to do with power delivery and battery level sensing.
Basically all that leaves is connecting the 4 GPIO pins to the sensors, 2 each plus power.
The white and blue wires connect to this JST connector in the back right, for easy maintenance.
Yes, the sleep isn't necessary to me... but no one place mail in the late evening or in the early morning, so a sleep of check its a good option to evaluate.
I might have an earlier version of the config file around somewhere...
Yeah, here it is
Thanks a lot, I'll update you when my sensor arrive... I need to wait some week. The shipment from Cina to Italy its very long also when you order on some big ecommerce site 😦
Ah yeah, I got most of my parts from aliexpress and it takes a while to get here.
I do hope you can find a good sensor position that works for your usecase.
The worst case scenario I can think of is if the mail lands vertically on the far side of the sensor. Because then how do you tell the difference between the light hitting the far wall of the mailbox, and the light reflecting off the mail?
Perhaps if you can put some dark black matte paint on the opposite side to the sensors? Something that absorbs the light emitted by the proximity sensor so the value for unobstructed is very different from obstructed.
one of the sensors will surely have the letters near it, the problem should be the newspapers of my wife... due the mailbox format.
Embroidery magazines and other monthly magazines have a lot of pages. So the postman folds the magazine and puts it in, but it doesn't go all the way down. It's usually tucked in halfway.
I think and hope that vertically it will be enough for just one sensor to detect presence.
If not, you will need an i2c multiplexer.
I don't know how exactly those work with ESPHome, though.
Finally I received the sensor, but I've an error with my ESP8266 device in the last steps of install.
You should take this to #general-support . Make a thread there with config and error message.
Hi @mighty vigil, I'm trying my prototype.
Over the weekend I'll do some tests by inserting the sensors into the mailbox, I need to see what the minimum threshold value is to assign.
The depth of my mailbox is different from yours, I want to be sure it doesn't trigger unnecessarily. So if the weather is nice I'll do some tests trying to adjust the threshold too.
I added also a DHT11 to measure external temperature/humidity.
Funny you should mention the ESP8266, someone actually submitted an issue to the VNCL4010 library I made with a similar chip.
They ended up swapping to an ESP32 derivative
And nice, I look forwards to hearing about your results 🙂
it was me
Ahhh, I wondered if it was
Add a camera at the top with some imaging and some simple machine learning to decide if the top item is junk mail or not