Tag Archives: arduino

Coffee boss day 7 – Moar sensorz

Those last graphs were nice but I don’t think they tell me enough. The graphs and the analyses make intuitive sense to the eye but they’re still disconnected enough from concrete reality to make it hard to put the numbers into context. I’ve run up against the limit for what my simple-minded analytics can do for me. I could learn more analytic skills, you know like nunchuck skills, bowhunting skills, computer hacking skills. But I won’t, I’m just going to brute force it with more sensors.

I’ve got an AC current sensor (SCT-013-000 Non-invasive AC Current Sensor Clamp Sensor 100A High QUALITY!!!) and an Adafruit VCNL4010 proximity sensor.

Inside the coffee machine

The coffee machine has a float switch in the water reservoir that it triggered as long as there’s water left in. I don’t really know how the heater/pump works or even if there is a pump there or if it’s some kind of expansion thing powered by the heater on it’s own. I looked inside:

And I’m not sure what to make of that, doesn’t look like a mechanical pump but water goes in the bottom that is discoloured from heat, and comes out the top tube going up to the sprinkler-head.

There’s two wires running from the controller mechanism on the left to the heater capsule, and they look the same as the ones leading from the main 240v input connector (bottom left) as well as sharing the same connector, so I’m going to surmise that this is a 240V AC heater.

Searching more, I find this: https://www.gastroparts.com/en/part-113792 which is a “flow heater”, 2160W, 240V. Power divided by voltage gives current so 2160W / 240V = 9A.

The current sensing clamp

  • https://learn.openenergymonitor.org/electricity-monitoring/ct-sensors/interface-with-arduino
  • https://olimex.wordpress.com/2015/09/29/energy-monitoring-with-arduino-and-current-clamp-sensor/

Ideally I’ll put the current clamp on those two wires so it only senses when the heater is running. I’d prefer not to have something mounted inside the machine since I’ll get the blame if the office burns down.

So I’ll test this system with the clamp fitted on the main power cable instead, and see how hard it is to recognise the “heater running” signal from the “hotplate” on signal. If it’s obvious, then that’s ideal. If it is indistinguishable then I’ll try it inside.

Looking at the link above, I should do some sums to figure out how to wire up the current sensor. I don’t really understand this so will be Just Doing As I’m Told.

Primary peak-current = RMS current × ?2 = 13A × 1.414 = 18.3A. 

I picked 13A as I wanted to leave a little headroom over the current that the heater would draw in case the hotplate is on too. I can’t find any spares for that bit yet so don’t know what that’ll draw.

Secondary peak-current = Primary peak-current / no. of turns = 18.3A / 2000 = 0.009191A

Ideal burden resistance = (AREF/2) / Secondary peak-current = 1.65 V / 0.009191A = 179.52 ?

I need a 180ish ohm burden resistor and a 10uF capacitor. I’ll get those from the workshop tomorrow.

I wired this up and found that there was a constant stream of numbers coming out, between 200 and 400, but turning the load on or off didn’t make any difference. In fact it’s the same whether it’s clamped over a cable or not, so I think this is just electrical noise. Boo.

Update! With the cap and burden resistor… Exact same response as last night ie fairly stable number coming out of this sensor, but no relation to whether the device is on or not. So… I was testing it with the clamp on the mains lead of a heater. It needs to be on just one wire because both wires cancel each other out. I’m going to have to build an intercept box for the power cable to go mount externally, or mount the clamp inside the coffee machine, on one of the cables near the heater. OK – that’s some more useful information. I wonder if there’s a way to get the signal out of the machine without trailing wires out of it? I don’t want it to fail it’s PAT test and inspection.

VCNL4010 Proximity sensor

This is a short-range IR-based proximity sensor chip mounted on a neat little breakout board. It uses i2c but there’s also an adafruit library for it so I don’t need to cry about the bus.

I’m planning to mount this on a little plate directly on the coffee machine behind the collar of the carafe so that it can be used to sense the presence or absence of the coffee jug.

Adafruit libraries

Adafruit have info about this module here https://learn.adafruit.com/using-vcnl4010-proximity-sensor/overview and docs for the arduino library here: https://adafruit.github.io/Adafruit_VCNL4010/class_adafruit___v_c_n_l4010.html. I tried the standard vcnl4010test.ino example that came with the Adafruit_VCNL4010 library and found that the measurement maximum distance was about 45mm which is _just_ too short for my application. It is sensitive up close (5-20mm) but tails off the further away you get.

I noticed from the docs though that I could turn up the power on the LEDs in the proximity sensors (it uses a time-of-flight thing!) so I turned that up to maximum (indicating 200mA). Made no difference.

I could still mount this sensor on a little tower so it is closer to the carafe ring. It would be fairly well protected from bumps but I did want to keep this quite compact and unobstrusive. Is one of those ultrasonic detectors the answer? I think I have one in that kit that Euan gave me that time. I’ll check tomorrow.