Surely you have ultra-wideband radios on your bins too?

Hacker News by 19 min read 30x views
Surely you have ultra-wideband radios on your bins too?

Share Post

Home Assistant already knows which bins (trash cans, for the global readers) are due for collection. It can inform me it’s bin night, put the correct colours on a dashboard, and dispatch me a reminder. What it can’t inform me is whether I’ve really done item concerning it.

I’m beautiful certain most group would fair set a recurring reminder on their phone. As my spouse volition no doubt inform you, I am not most people. Some would fair recall to put the bins out, akin a normal person. I’m fine conscious that I’ve ridiculously over-engineered this. I’m additionally so far from normal that six radio-equipped bins seemed akin an fun way to expend my evenings ;)

I had an idea a figure of years ago to rod cheap Bluetooth tags on my wheelie bins and use an outdoor Bluetooth proxy to activity out whether they were nearby. It was frustrating. The batteries drained quickly, the proximity readings wandered about, and the proxy was unreliable in that particular installation. I wanted to cognize whether a bin had moved. I mostly acquired another item to fiddle with.

AirTags were what archetypal got me intrigued by ultra-wideband radio, or UWB. Reading additional concerning how it worked brought the bin idea back. Over the final few weeks it’s rotate into BinRange: a fixed broadcast anchor, six small power division tags, and a Home Assistant setup that combines anywhere the bins have been seen alongside whenever they’re due. There’s a printed enclosure, tradition firmware, and wireless updates as well. All of which is a fairly significant answer to “have you put the bins out?” :D

I leaned heavily on Codex throughout the build. Astra became accessible part-way through, and I was really inquisitive to see how it would do. What I affection concerning operating alongside AI is how quickly I can obtain an idea, react to the result, provision it several feedback, and have item alternatively to try. There’s plentifulness to compose concerning that in another articles. For now, rear to the bins.

The row of family bins beside a wooden partition in the BinRange installation.

There you go, several bins. Beautiful, right?

Six bins, multiple schedules

We have one broad discarded bin, one food compost bin, one storyline discarded bin, two recycling bins, and a pane bin. Six bins. At one house. They’re not equal all on the identical gathering schedule. I’m grateful that the Waste Collection Schedule integration for Home Assistant scrapes the council’s schedules and keeps track of what’s due, since keeping that direct is a job in itself.

With the cheap Bluetooth tags, the way to evaluation extend was RSSI - received indication power indication. You measure how powerful the received indication is and use that to conjecture how far distant the tag power be. The difficulty is that signal strength depends on far additional than distance. Walls, parked cars, reflections, antenna orientation, and differences between the radios and their antennas all power it. Even power division voltage can power the transmit power on several hardware, depending on how the equipment is designed. A weaker indication could average the bin has moved additional away, or it could average item got in the way. It’s a extremely imprecise way to evaluation distance, which explained why my first setup was so frustrating.

UWB was engaging since it measures the time taken by broadcast signals to journey between devices. That gives a extend measure without having to conjecture it from indication strength. It motionless has to get a indication through the surroundings, of course. Choosing a distinct broadcast doesn’t create parked cars disappear.

I additionally spent a during detoured into an scholarly inquiry concerning how many anchors I’d need to add additional dimensions to that awareness. What if I wanted to cognize the direction as fine as the extend from a point? Or the bin’s exact location - how many fixed citation points would I need to triangulate it on a 2D plane? Totally not value it for this job, but tangential thoughts be tangential thoughts.

For the bins, I lone needed to cognize whether all one had moved far adequate from its customary retention area to figure as Out. One anchor was adequate to commencement evaluation that. I used a ten-metre boundary: inner is Home, beyond it is Out, whenever there’s a caller reading. It’s particular to my installation, but it meant I could commencement alongside one powered commission fairly than rotate the storyline into a positioning test range.

Two boards and a stroll outside

The archetypal test used two Makerfabs ESP32-WROVER/DW3000 boards, the two powered complete USB. Before doing item clever alongside Home Assistant, I wanted to see them measure a distance. A local web perspective let me distinct them and observe what happened without needing a USB cable stretched between the two.

A red Makerfabs ESP32-WROVER betterment commission alongside USB connected and its UWB component and antenna visible.

One of the betterment boards. This is the DW3000 example used in the experiment. Hardware reference.

The antenna inclination made a amazingly ample difference. At concerning ten metres, changing the boards from flat to upright took the observed achievement charge from 37% to 100% in that test. A slower broadcast environment alongside a longer introduction additionally worked anywhere the first accelerated environment struggled. These were helpful discoveries to create before designing item about the archetypal result.

The archetypal period I calibrated it alongside a strip measure and watched the reported extend differ from my measure by small than two centimetres, my intellect was utterly blown. Two small boards were exchanging broadcast signals and agreeing alongside a strip measure to that degree.

In the afterward recorded test, a measured gap of 10.1 metres produced an average study of concerning 10.09 metres, alongside a norm deviation of three centimetres. That was encouraging for a project which lone needed to recognise a bin leaving a retention area. The under-two-centimetre outcome was what I saw in that archetypal calibration, fairly than a commitment of that accuracy for all tag, orientation, or outdoor position.

The outdoor stroll was additional revealing. Readings were dependable to approximately thirty metres, afterward intermittent additional out. The furthest recorded study was 37.28 metres, alongside gaps. A car could obstacle the way completely. Holding a commission upright in the open and mounting a small tag below a bin rim were plainly going to be distinct tests.

The outdoor UWB walk-test graph, showing measured extend expanding and decreasing alongside indication and range-spread diagnostics below.

The two-board stroll test. It established a helpful starting point; it doesn’t established safety for the installed bins. Recorded findings.

The anchor publishes its readings complete MQTT, and Home Assistant discovers a distinct equipment for all tag. I considered an ESPHome component, but it wasn’t adding much to the institution I wanted. There’s no additional BinRange server or haze service, and the radios can keep ranging during Home Assistant or the MQTT association is unavailable.

Something small adequate to put on a bin

The betterment boards were helpful for proving the link. I didn’t desire one hanging off all bin, alongside a power division and an improvised box attached. The bin-side hardware needed to be a small, self-contained puck.

I explored tradition tags and business ones, alongside the crucial inquiry being whether I could run my own firmware and use them alongside my own anchor. A small UWB tag isn’t automatically compatible alongside another UWB product. The packaged tags I eventually bought were KKM K4Ws, alongside an nRF52833 processor, a DW3110 broadcast and a LIS3DH accelerometer. They obtain removable CR2477 coin cells (which, btw, are several chonky boy coin cells! I’ve not seen them before, thems fat).

The two Makerfabs boards came to US$123.64 including shipping. Ten example tags at US$25 each, a programming jig and shipping came to another US$330. Those are what the test disbursal at the time, fairly than a current buying catalog or the disbursal of a completed six-bin kit. I doubtful I should evade calculating a payback period.

The provider stated the tags could run my firmware and offered a jig to attain the programming connections. I was far additional curious in the hardware they were supplying and knowing that programming admission wasn’t locked out in several way. None of their existing application features mattered to me. Claims concerning power division existence were meaningless for my use formerly I was going to be the one deciding whenever the CPU slept and what woke it up.

I’m beautiful acquainted alongside nRF52 devices. I’ve used them for years, going rear to my period at rlab. They create brilliant small low-power microprocessors, blessed to expend most of their lives asleep. If you’re clever alongside your scheduling and interrupts, you can drag these things out for years on a small power division in the correct application. That was much additional engaging to me than any the supplied firmware happened to do.

I used a spare Nesso equipment as a programming investigation for the pogo-pin jig. I started alongside a betterment tag, afterward commissioned the packaged ones one at a time: program it, established its identity, brace it, tag it, allocate it to a bin, and put it rear together. There are multiple identities involved, including the printed label, the part identity, and the addresses used by the radios.

Side note: the cases the tags were supplied in had apparently distinctive serial numbers printed on them, alongside QR codes containing those serials. Presumably they assist several intent in the supplier’s inventory firmware and software. I couldn’t discover any affiliation alongside the embedded devices’ MAC addresses or akin identifiers, so they were basically useless to me. Which is a shame really - if they’d been the broadcast MAC addresses, for example, that would have been useful!

A KKM K4W tag fixed below the rim of a green wheelie bin, alongside its identifying tag obscured.

A KKM K4W tag attached to the food caddy beside its carrying handle, alongside its identifying tag obscured.

Close-up of the bin tags stuck to the bins. You can see how chonky they are, those batteries are big! They fit nicely under the rim though, which volition keep rain mostly off.

The manufacturer had connected the accelerometer’s interrupt output to a GPIO pin on the nRF, which is incredibly useful. It method I can let the nRF sleep for extremely lengthy periods, dispatch no broadcast traffic during that sleep, and awaken it up whenever a bodily event happens. Once things resolve down, it returns to occasional check-ins, alongside the UWB broadcast sleeping between attempts. The firmware default is ten minutes whenever stationary; I’ve since changed the installed fleet to thirty minutes using controls in Home Assistant, during keeping the five-second moving reports.

That should evade spending the power division often reporting that a bin is motionless sitting anywhere it was. How much existence it really buys is item I motionless need to measure. I’m collecting voltage and action information, but a short, fairly flat voltage trace doesn’t provision me a defensible evaluation in months or years. I’m certainly not curious in using the bulk of the battery’s existence reporting its own voltage. That seems low value ;)

Updating six bins without taking them apart

Once a tag is mounted, beginning it up and putting it rear on the programming jig all period I alter the application becomes fairly unappealing. The anchor can now provision signed firmware updates to paired tags complete Bluetooth. The former use is retained so a bad update can rotate back, and the scheme lone reports achievement formerly the tag is operating the exact expected depiction and has confirmed its own health.

Testing and iterating on this kind of item is another awesome use of AI. Codex helped me create and simulate a entire range of test conditions and nonaccomplishment modes, afterward activity through them to create deploying firmware to one of these things complete the air as harmless as possible. I tested corrupt images, interrupted transfers, selected power-loss points, and watchdog recovery. I additionally tested what happened whenever the anchor wasn’t there: the tag needs to verify that it’s fit without a broadcast reply, fairly than forsake operating firmware since it can’t attain the anchor.

Going from one tag to multiple established a distinct kind of problem. A document in the Bluetooth archive had been sized for the figure of simultaneous connections fairly than the figure of paired devices. Adding a additional tag could neglect equal although its keys had been stored. Fixing that meant a new bodily tag could brace without clearing the existing ones. Six bins gave the application a improved questioning than one agreeable demo tag.

I’ve since updated the installed anchor and all six tags wirelessly without re-pairing them or reaching for the jig. I’m pleased concerning that. Some before association attempts needed retries, though, so I motionless desire additional evidence before calling the entire procedure reliably unattended. The programming investigation remains the rescue route.

The box took multiple goes

The anchor needed a case, which became its own small project. It started as an OpenSCAD scheme alongside screws. The archetypal fit inspect was promising, but small nuts and bolts, PLA tolerances, and a commission that could motionless rattle made the gathering additional annoying than I wanted.

I wanted a case made entirely from printed PLA, alongside no screws: tapered locating pins for the board, printed springs to clasp it down, and a lid that stayed on. The pins and springs worked. The lid could move about all complete the place.

An inner lip improved the fit. Deeper catches improved the retention, but I could motionless drag the lid off too easily. Making those catches as profound as the partition seemed akin the apparent next attempt, until the two roots bankrupt during insertion. That type was outstanding at becoming two pieces of damaged plastic.

The improved alter was to overlap the basis and lid walls and use multiple shallow catches. A brace of tweaks to the locating pins and vents later, I had a case that held the commission correctly and stayed shut. I was extremely pleased alongside it, which likely says item concerning how many lids I’d pulled off by then.

Render of the assembled screwless anchor case, alongside a blue basis and faint vented lid.

Render of the open anchor case showing locating cones in the basis and commission supports inner the lid.

The screwless case, rendered from its imprint meshes. The colours and complete are illustrative. You can print it from MakerWorld; the design records and former of the small prosperous attempts are on GitHub.

That quick iteration alongside Codex was particularly fun for the case: I could refine the design, inspect it, and imprint it. I motionless had to choice up the outcome and discover out whether the lid cut off. A geometry inspect can established that two shapes should fit together; it doesn’t inform me whether a capture volition last being pushed into place.

The anchor is now partition mounted, alongside the printed case inner a larger outdoor electric box alongside its power components. That engaged another Amazon order. The applicable bits were:

  • A clear-cover outdoor electric box, listed as IP67 and 8.7 × 6.7 × 4.3 inches (£27.99).
  • A DIN-mounted 12V DC power provision (£11.09).
  • A DC-to-USB-C PD module to rotate the 12V provision into USB-C power.
  • A Type A RCBO, listed as 10A alongside 30mA residual-current safety (£14.00).
  • Three metres of 2.5mm² twin-and-earth cable (£11.99).
  • A right-angle USB-C power pigtail alongside a 25cm lead. I lone needed one, but they came in a six-pack (£5.99).

That small USB-C PD component is a beautiful cool, different device. It takes the 12V nourish and provides USB-C Power Delivery. I can see myself ordering another.

Those are the prices on my order, fairly than current quotes. A weatherproof box, power supply, USB-C power module, protection, cable, and USB leads for a reminder to put the bins out. I know.

All six bins have their tags fitted. At that item I was emotion fairly optimistic that it was all working.

The installed BinRange anchor and power components inner a clear-lidded partition enclosure.

The anchor installed on the wall. The printed commission case is inner the larger enclosure. Installation photograph.

Reminders and Notifications

The Waste Collection Schedule integration deserves a lot of credit here. Scraping the council’s agenda saves me maintaining multiple recurring dates and remembering which blend of bins is due. BinRange adds bodily data concerning the bins, and Home Assistant puts the two together.

The average dashboard shows the next collection, compact bin states, and item needing attention. The ranges and broadcast diagnostics have their own view. I akin looking at the specialized details, but checking tomorrow’s bins shouldn’t necessitate interpreting a broadcast trace.

The reminders are grouped into one communication for the applicable bins: at 6pm and 9pm the evening before collection, afterward a final reminder at 6am if they’re motionless confidently Home. At 6pm the following day there’s a reminder to bring rear bins motionless Out. The automation remembers its attempts so a rerun doesn’t keep sending the identical message.

An unavailable study shouldn’t outcome in an allegation that person forgot a bin. Likewise, the average bring-in reminder lone knows the gathering was scheduled and the bin is motionless out. It doesn’t cognize whether the squad emptied it.

Home Assistant notification saying General Waste, Recycling 1, and Glass have to be put out for tomorrow's collection.

Home Assistant notification to put several bins out.

I additionally wanted a communication whenever the bins had fair been emptied. There was an apparent enticement to appearance at movement, period of day, and the gathering agenda and call that enough. Looking rear at one gathering showed how small those clues could established whenever tags stopped reporting for much of the day. A awaken oppose could inform me there had been activity, but it couldn’t inform me who handled the bin or why.

The tags already had accelerometers, so I added a additional particular clue. Relative to a calibrated upright position, a sustained tilt beyond ninety degrees records a tip event. The tag keeps that event through a reception gap and reports its age whenever it next reaches the anchor. Home Assistant can treat a latest tip on a due bin known to be Out as an assumption that it has been emptied.

The archetypal automation checked for pending tips all five seconds. That felt excessive for item that happens a few times a week, so I changed it to an MQTT event stream alongside a timer that lone runs during there’s a deadline pending. Qualifying bins are grouped for sixty seconds, alongside saved province to suppress repeats and assistance improvement following a Home Assistant restart. Scheduled reminders remain the fallback.

Home Assistant notification saying General Waste, Recycling 1, and Glass have fair been emptied and can be brought rear in.

Home Assistant notification that the bins have been emptied and can be brought rear in.

First test in prod

On 28 September I had a Garden gathering I could analyze properly. The bin started moving at concerning 7:05am and traversed the ten-metre border shortly afterwards. Reports afterward stopped arriving during it was away. When it reappeared at concerning 10:25am, it carried a stored tip from about 9:27am, and afterward traversed rear into the Home area and settled down.

The tag had detected and retained the tip. Departure and come back were visible. But the tip was concerning fifty-eight minutes old by the period Home Assistant received it, beyond the automation’s thirty-minute acceptance limit. The “just emptied” communication didn’t send. Other bins had continued reporting, and there wasn’t an MQTT nonaccomplishment at the anchor during the gap. I motionless don’t have an established clarification for that tag’s deficiency of reception at the gathering position.

That was a helpful correction to my optimism. The broadcast could create convincing measurements, the tag could detect a tip, and the dashboard could appearance right, during the phone motionless missed the emptying notification. Checking a genuine gathering gave me a much improved catalog of what needed attention.

It additionally changed how I wanted to display a bin that had gone quiet. Originally, an Out study became Unknown formerly it was stale. That was cautious, but following observing the bin depart and afterward endure communication at the kerb, replacing Out alongside Unknown stopped being extremely helpful.

The live setup now remembers an observed departure as presumed Out, equal through misplaced communication or a Home Assistant restart. Reception health is shown separately. A caller study inner the border is needed to come back the bin Home. If it was final seen Home and afterward goes silent, it becomes Unknown, since I never saw it leave. Return reminders can use presumed Out; put-out reminders motionless need caller evidence that the bin is Home.

That makes the display nearer to what I really know.

 “Are you not complete engineered?”

Waiting for additional bin days

BinRange is installed and in use. (As I category that, I realise I’ve earnestly pigeonholed this alternatively general-purpose tool 🤔)

There’s motionless several fairly average study to do: safety at all retention and gathering position, multiple complete cycles alongside the correct notifications delivered, power division behavior complete weeks, and how the mounting and enclosures oversee outside. I additionally desire updates to nexus dependably without me retrying. I am not really construction this for broad use by another people, but if others are inspired and desire to try item similar, or repurpose any of this, they (or their robot friends) are greeted to.

The repository has the firmware, case files, measured findings, and Home Assistant examples if you’d akin a look. This is my hobby project, and I’m motionless finding out how fine it behaves outside.

Of course, now I’ve seen what UWB can do, I’m wondering whether I could put tags on the cats’ collars and use four anchors about the home to map anywhere they are. Could I get centimetre-level cat tracking? I haven’t tested that, and the bins have already demonstrated how much surroundings and broadcast safety matter. But I’m extremely tempted.

Most group would likely fair appearance for the cat.

Other Article Hacker News
↑
Close Right Ads
Close Left Ads