Author Topic: Awesome Coffee Server - ESP8266 based webserver IoT  (Read 1780 times)

0 Members and 1 Guest are viewing this topic.

Offline frozenfrogz

  • Frequent Contributor
  • **
  • Posts: 447
  • Country: de
  • Having fun with Arduino and Raspberry Pi
Awesome Coffee Server - ESP8266 based webserver IoT
« on: August 04, 2017, 09:02:53 PM »
Dear forum,

I am working on an open source / open hardware project that started out as a remote switch for my coffee machine - hence the name. The initial build was put together on vero board but since this prototype has been running stable without issues for a couple of months now, I want to move on to making a PCB layout and pushing the project to my github for everyone else to fiddle with it. Of course all schematics, KiCAD files, BOM, and firmware will be released under a suitable license. I am thinking MIT license but suggestions are welcome - this is my first contribution to the OSHW world.
The initial design consists of a Wemos D1 mini, one relay, MAX6675 + K-Type TC and a MeanWell IRM board mounted AC/DC 5V converter (Class II) enclosed in an industrial style plastic case.



Now here is my question: With only one Class II isolated power supply on-board, is it of any use to control the relay via an isolated optocoupler?



Mainly, I want to make the design as reliable and safe as possible, but I am not an electrician. What kind of safety features should I look into? Of course mains and low voltage circuits will be separated on the PCB and isolation slots incorporated to work against surface creepage.

Also: This started out as a one-off build for my own purpose, but I thought others might be interested as well. I want to keep the platform as adaptable as possible so I am thankful for any suggestions / wishes of features to build in. All unused pins will be broken out to the edge of the PCB. I also thought about possible solutions for plug-in modules via industrial connectors but have yet to sort out some design decisions.

At the moment, the webserver has the Wifi credentials hard coded into the firmware on upload. However I am working on a new version using a wifi manager and a physical switch to put the ESP into AP mode for configuration. Also firmware update OTA is on the list, but I did not implement it properly as of today.

Here are some logo ideas/sketches you might or might not like, feedback is welcome too :)



Please let me know what you think and fire away your suggestions.

Thank you!
Frederik

Edit: Fixed broken links.
« Last Edit: August 05, 2017, 01:56:03 AM by frozenfrogz »
He’s like a trained ape. Without the training.
 

Offline madires

  • Super Contributor
  • ***
  • Posts: 3659
  • Country: de
  • A qualified hobbyist ;)
Re: Awesome Coffee Server - ESP8266 based webserver IoT
« Reply #1 on: August 04, 2017, 10:46:17 PM »
The opto coupler doesn't make sense when you power the relay and the MCU by the same PSU. And the relay driver needs some changes anyway. Connect the relay to 5V and use the NPN transistor to switch it to ground (for high side switching you'd need a PNP). Add a resistor in series with the LED to limit the LED's current. 
FidoNet 2:240/1661
 

Offline frozenfrogz

  • Frequent Contributor
  • **
  • Posts: 447
  • Country: de
  • Having fun with Arduino and Raspberry Pi
Re: Awesome Coffee Server - ESP8266 based webserver IoT
« Reply #2 on: August 04, 2017, 11:03:12 PM »
Oops, you are correct about the NPN. I slapped the initial drawing together last night a little to careless...
Would opting for two separate power supplies be beneficial, or is that just unnecessarily adding to the overall parts cost?

« Last Edit: August 04, 2017, 11:14:41 PM by frozenfrogz »
He’s like a trained ape. Without the training.
 

Offline madires

  • Super Contributor
  • ***
  • Posts: 3659
  • Country: de
  • A qualified hobbyist ;)
Re: Awesome Coffee Server - ESP8266 based webserver IoT
« Reply #3 on: August 04, 2017, 11:39:07 PM »
The relay provides isolation already, no need for an opto coupler. BTW, what is the purpose of connecting L to the relay and the screw terminal? How do you intend to switch the coffee machine?
FidoNet 2:240/1661
 

Online ebastler

  • Super Contributor
  • ***
  • Posts: 1204
  • Country: de
Re: Awesome Coffee Server - ESP8266 based webserver IoT
« Reply #4 on: August 04, 2017, 11:53:39 PM »
Apologies if this is obvious to everyone else -- but you have not described yet what your gadget actually does, have you? WiFi-controlled power adapters are already widely available. What's the function of the thermocouple? Does it interact with the switching functionality, or provide remote reading of the coffee temperature via a companion app?  ;)
 

Offline frozenfrogz

  • Frequent Contributor
  • **
  • Posts: 447
  • Country: de
  • Having fun with Arduino and Raspberry Pi
Re: Awesome Coffee Server - ESP8266 based webserver IoT
« Reply #5 on: August 05, 2017, 12:09:08 AM »
BTW, what is the purpose of connecting L to the relay and the screw terminal?

Right now this is a "relic" (not fully diagrammed) from the current implementation. Inside my Gaggia Classic coffee machine the ESP board is supplied via the machines mains inlet, so the server is always running. The relay is wired in series with the power switch. That way the machine will not power on if the switch is set to of. This allows for keeping the original state of usage if the relay is switched on.

Regarding the functionality, it started of as a simple project to satisfy my need to be a lazy arse. I wanted to be able to preheat my coffee machine remotely and read back the current temperature. I planned for sending an alarm when preheating is done but have yet to implement it.
The device sits on my local network behind a firewall because I do not want to have it working "that" remote.

Currently I am thinking about some possible directions to push this project out of the very niche of switching on a coffee machine. However, implementation of RFID access control for a shared-office machine might be one possible use case quite easy to do.

I looked at a couple of cheap wireless relays but was not very pleased with what I could do with them. Usually there is no option to implement additional functionality, because the unused ESPs pins are not broken out and getting supply voltage for a display or whatever you want to drive needs to come from a separate power source etc.
He’s like a trained ape. Without the training.
 

Offline frozenfrogz

  • Frequent Contributor
  • **
  • Posts: 447
  • Country: de
  • Having fun with Arduino and Raspberry Pi
Re: Awesome Coffee Server - ESP8266 based webserver IoT
« Reply #6 on: August 05, 2017, 01:42:59 AM »
Damn. I just saw, that this post had failed to be removed by me. I opened this thread and then remembered the OSHW section. So I pushed delete here and reopened the thread in the OSHW board. However, the thread here had not been removed... Looks like I need to contact a mod - oh well.

Here is what I came up with so far...

He’s like a trained ape. Without the training.
 

Offline madires

  • Super Contributor
  • ***
  • Posts: 3659
  • Country: de
  • A qualified hobbyist ;)
Re: Awesome Coffee Server - ESP8266 based webserver IoT
« Reply #7 on: August 05, 2017, 04:25:45 AM »
Presumably you have to lower the NPN's base resistor to drive the NPN into saturation.
FidoNet 2:240/1661
 

Offline frozenfrogz

  • Frequent Contributor
  • **
  • Posts: 447
  • Country: de
  • Having fun with Arduino and Raspberry Pi
Re: Awesome Coffee Server - ESP8266 based webserver IoT
« Reply #8 on: August 05, 2017, 07:29:27 AM »
Presumably you have to lower the NPN's base resistor to drive the NPN into saturation.

The relay coil is rated for 72mA current at 5V nominal (datasheet).
H_fe_sat @I_CE 72mA of the NXP BC817-40 is around 350, taken from this datasheet.

My calculations for the base resistor are:
I_B = I_CE / H_fe
I_B = 72mA / 350
I_B = 0.2mA

R_B = (U_B - U_BE) / I_B
R_B = (3.3V - 1.2V) / 0.2mA
R_B = 2.1V / 0.0002A
R_B = 10,500Ohm

What did I do wrong?
He’s like a trained ape. Without the training.
 

Offline NiHaoMike

  • Super Contributor
  • ***
  • Posts: 3410
  • Country: us
  • "Don't turn it on - Take it apart!"
    • Facebook Page
Re: Awesome Coffee Server - ESP8266 based webserver IoT
« Reply #9 on: August 05, 2017, 12:38:42 PM »
Try reducing the resistor to 1k or even 470 ohms.

For the software side, a standard protocol already exists.
https://tools.ietf.org/html/rfc2324
Cryptocurrency has taught me to love math and at the same time be baffled by it.
 

Offline frozenfrogz

  • Frequent Contributor
  • **
  • Posts: 447
  • Country: de
  • Having fun with Arduino and Raspberry Pi
Re: Awesome Coffee Server - ESP8266 based webserver IoT
« Reply #10 on: August 05, 2017, 07:30:42 PM »
Haha yes, the coffee protocol. I think I read through it some years back, but totally forgot. Espresso machines need different implementation though...

Can you please enlighten me why the calculations for the base resistor are wrong / off by an order of magnitude? I am doing these things to learn stuff :)
Thank you!

I am thinking about just doing the PCB layout for the current version, pushing it to github together with the bits of firmware I have finished and then work on variants e.g. a minified version with just an ESP8266 instead of a NodeMCU. Also a version with MAX31865 for PT100 / PT1000, solid state relay and implementation of PID might be interesting.
He’s like a trained ape. Without the training.
 

Offline madires

  • Super Contributor
  • ***
  • Posts: 3659
  • Country: de
  • A qualified hobbyist ;)
Re: Awesome Coffee Server - ESP8266 based webserver IoT
« Reply #11 on: August 05, 2017, 07:40:04 PM »
You've calculated the base current for an Ic of 72mA, but that won't drive the NPN into saturation reliably. A rule of thumb for small signal transistors is to double or tripple the base current. BTW, BC817-40's minimum hFE is 250.
FidoNet 2:240/1661
 

Offline frozenfrogz

  • Frequent Contributor
  • **
  • Posts: 447
  • Country: de
  • Having fun with Arduino and Raspberry Pi
Re: Awesome Coffee Server - ESP8266 based webserver IoT
« Reply #12 on: August 05, 2017, 08:30:57 PM »
Thank you madires. Seems like I should read more about bipolar transistors to fully understand how they work.
I took the gain factor from Fig. 3 @25°C of the NXP datasheet.
So with hFE 250 and double the base current this would mean more like a 3K resistor.
Do I need to use an additional voltage divider then?
He’s like a trained ape. Without the training.
 

Offline madires

  • Super Contributor
  • ***
  • Posts: 3659
  • Country: de
  • A qualified hobbyist ;)
Re: Awesome Coffee Server - ESP8266 based webserver IoT
« Reply #13 on: August 05, 2017, 08:58:17 PM »
Just the base resistor. It's a simple switching application. And yes, 2k7 sounds more reasonable.
FidoNet 2:240/1661
 

Offline perieanuo

  • Regular Contributor
  • *
  • Posts: 95
  • Country: fr
Re: Awesome Coffee Server - ESP8266 based webserver IoT
« Reply #14 on: August 05, 2017, 11:45:34 PM »
Just the base resistor. It's a simple switching application. And yes, 2k7 sounds more reasonable.
Yes madires offer good advice. You made your beta/I base calculation but you have to bet a little more, like a safety coefficient because you have noise on the lines, Vcc fluctuations and so on so good practice means to drive to saturation heavily. Me I usually double I base for example or more on order to fall on same values for the items. Like production preparation...
Regards pierre

Envoyé de mon HUAWEI NXT-L29 en utilisant Tapatalk

 

Offline frozenfrogz

  • Frequent Contributor
  • **
  • Posts: 447
  • Country: de
  • Having fun with Arduino and Raspberry Pi
Re: Awesome Coffee Server - ESP8266 based webserver IoT
« Reply #15 on: August 06, 2017, 04:09:28 AM »
Good to keep in mind as future knowledge :)

By the way, the current firmware is written in Arduino. When the first ESP8266 development boards showed up I looked into the NodeMCU / Lua script package but did not really like it - maybe, because I was already more familiar with the Arduino environment. Integration into the Arduino IDE is pretty straight forward and works out of the box. So I did not feel the need to switch the dev. environment.
He’s like a trained ape. Without the training.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf