Tag Archives: arduino

Coffee boss day 10 – Neat board and RFID

Been a while! Coffee boss has a great upgrade recently, that’s the current sensor. This, combined with a new firmware that counts the time since the last time the current went low (so signifying that a boil cycle has completed therefore a new pot is ready) means that this is suddenly actually useful.

Pictured here is the various circuits combined on one piece of board. The back is a bit of a rats-nest but this should all fit in a project box reasonably neatly. I’ve made up a power cable with twisted mains cable where the individual conductors can be separated out without having to cut any insulation but I need to get that cleared off with the estates people – I would still prefer a sealed moulded plug on the part that plugs into the coffee machine itself.

The reason why I put the current sensor on this part (near the machine, where there water is) is because the other option is down on the floor, and the wire going to the sensor isn’t very long. That’s still a decent option for a more permanent installation.

Next to it is a new RFID reader, a board made by Elechouse based on a PN532 chip. This is a neat little beast but I’ve had a right battle getting it working. Elechouse have some libraries for Arduino but there are some improved ones here:

This module has a serial, an SPI and an I2C interface, with a little set of dip switches to control which one to use. I tried all kinds of ways and could. not. get. it. working. on the ESP32, only to have it work first time with a regular ATMEGA based Arduino board. Something about the ESP32 perhaps? My circuit? Likely.

Cut a long story short, I have to do a full power cycle of the ESP32 to get the PN532 to initialise properly. Reset won’t do it – presume the reset button only resets the microcontroller rather than actually interrupts the power – and that makes a difference.

Only just got this working this evening, and made up some neat cables. I’ll take it for a test drive tomorrow.

What’s the RFID reader for?

Oh right, yes, it’s so that coffee drinkers can bump their work ID when they have a cup of coffee and the machine will repeat back how many cups they’ve had recently. It’s so they can think about how much they owe. It won’t ever know who they are, but the cards that our IDs are printed onto have unique identifiers so can track you across sessions.

The Connectors Saga

  1. I decided to use Molex Mini-fit jr sockets on this because I had a few sets left-over from Polargraph drawing machines. I never actually used them on the Polargraph and they’ve been burning a hole in my pocket ever since since they are so adorable.
  2. I dismantled the Coffee Boss machine and stripped down the cable ends… And realised that the metal crimp contacts I had to go into the Mini-fit jr plugs were the wrong kind! I’ve got a reel of contacts for “Microlock Plus” system. As soon as I noticed, I remembered kicking myself for making that mistake the first time around. At least one reason why I never used these plugs and sockets.
  3. I ordered some crimp contacts for Mini-fit jr, along with a couple of sets of backshells for the plugs, so they look super pro. Expensive! But worth is for the pro-ness.
  4. When they arrived after the weekend, I crimped a couple onto the current sensor… And realised they wouldn’t fit into the plugs I had. I hadn’t wanted to test it before crimping them in case they got stuck in the plug and I couldn’t get them out.
  5. I realised that my plugs and sockets weren’t Mini-fit jr at all… They were Micro-fit 3.0.
  6. Always had been Micro-fit 3.0.
  7. And a cursory glance at the bags they were stored in confirmed that.
  8. So I ordered some crimp contacts for Micro-fit 3.0. Got them, fitted them tonight, and now we’re cooking.
  9. I wish there were some backshells to be had for the Micro-fit system, they are super pro.

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.