-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace TCRT5000? #57
Comments
Hey Oliver, Short answer: No. Long answer: The TCRT is the best option I am aware of. I would refrain from any sensor under the cup (push button or pressure sensor) for the obvious reasons around moisture and cleaning. A contactless sensor is the way to go. An alternative might be an ultrasonic sensor or any other radio sensor, which might work behind the plastic - however, a probable issue is the limited space inside the machine. Be my guest to give it a try. Honestly, in my humble opinion, don't bother. The small hole in the housing is barely visible and no one ever realized and asked about it. On the contrary, it was always convenient for me to say "yeah I've hacked the coffee machine, check out this sensor for cup detection!" |
For your information, I plan to try this one very soon: https://www.az-delivery.de/en/products/ir-abstand-sensor-modul I'll let you know how it goes, but I don't expect to be at the drilling stage before a few weeks. |
Good idea. From the far my modification looks like a clean little rectangular element, as if it belongs to the machine design. Btw "from the far": because of the nozzle, you can't even see it when next to the machine. As said before: Don't bother :) |
I received the distance sensor I mentioned before and it works exactly like the TCRT5000 you use but it's way bigger (basically the size of two LEDs). Turn out the TCRT5000 is way smaller than I imagined. No sure which one I'm going to actually use within my Senseo. |
Okay... will think about it... Thank you :) |
Nice! Looks great |
It's Senseo Quadrante HD 7863/60 from 2013. |
I must admit that the buzzer handling is a bit of a weak spot of the code as it is today. I have recently hacked together a better solution, which you might like. It utilized ezBuzzer instead of tone. Would you like to give this a try? I would appreciate a PR that replaces all #include "SenseoLed.h"
#include "SenseoSM.h"
#include "pins.h"
#include "constants.h"
#include <ezBuzzer.h>
SenseoLed mySenseoLed(ocSenseLedPin);
SenseoSM mySenseoSM;
ezBuzzer buzzer(beeperPin);
int melody1[] = {
NOTE_C7
};
int noteDurations1[] = {
2
};
int melody2[] = {
NOTE_E5, NOTE_E5, NOTE_F5, NOTE_C5
};
int noteDurations2[] = {
4, 8, 8, 2
};
int melody3[] = {
NOTE_C4, NOTE_C5
};
int noteDurations3[] = {
4, 8
};
//void ICACHE_RAM_ATTR ledChangedHandler() {
void IRAM_ATTR ledChangedHandler() {
mySenseoLed.pinStateToggled();
}
void senseoStateExitAction() {
switch (mySenseoSM.getStatePrev()) {
case SENSEO_OFF: {
int length = sizeof(noteDurations3) / sizeof(int);
buzzer.playMelody(melody3, noteDurations3, length);
break;
}
}
}
void senseoStateEntryAction() {
switch (mySenseoSM.getState()) {
case SENSEO_READY: {
//tone(beeperPin, 1536, 500);
int length = sizeof(noteDurations1) / sizeof(int);
buzzer.playMelody(melody1, noteDurations1, length);
break;
}
case SENSEO_NOWATER: {
//tone(beeperPin, 4096, 1800);
int length = sizeof(noteDurations2) / sizeof(int);
buzzer.playMelody(melody2, noteDurations2, length);
break;
}
}
}
void setup() {
pinMode(ocPressLeftPin, OUTPUT);
pinMode(ocPressRightPin, OUTPUT);
pinMode(ocPressPowerPin, OUTPUT);
pinMode(ocSenseLedPin, INPUT_PULLUP);
digitalWrite(ocPressPowerPin, LOW);
digitalWrite(ocPressLeftPin, LOW);
digitalWrite(ocPressRightPin, LOW);
//pinMode(beeperPin, OUTPUT);
pinMode(resetButtonPin, INPUT_PULLUP);
pinMode(cupDetectorPin, INPUT_PULLUP);
pinMode(cupDetectorAnalogPin, INPUT);
attachInterrupt(digitalPinToInterrupt(ocSenseLedPin), ledChangedHandler, CHANGE);
tone(beeperPin, 1536, 2000);
delay(2500);
}
void loop() {
buzzer.loop();
mySenseoLed.updateState();
mySenseoSM.updateState(mySenseoLed.getState());
if (mySenseoSM.stateHasChanged()) {
senseoStateExitAction();
senseoStateEntryAction();
}
}
|
I REALLY would like to test it, but I have absolutely no idea where to put the code. I guess it has to be inserted in the SenseoWifi.cpp? |
Grab the latest from my fork : https://github.com/Pierre-33/SenseoWifi You can then try to add yourself more melody in the buzz function. |
Working! Thank you! Now I will find out how to use it and become a composer ;) |
Let me know if you came up with some nice tune and I’ll them to my pull request. |
@Pierre-33 looks perfect! Because of the blocking method issue I would ideally get rid of |
The thing is that I don't know how to submit a PR with only the buzz change (I'm not so much confortable with git, I'm more of a peforce guy myself). So I was waiting for you to accept the one with HomeAssistant discovery before opening the one with the buzzer. |
@luftpumpe83 how is going your Senseo? I'm affraid that by using AsyncMqttClient 0.9.0 in my fork I introduced an issue. Your Senseo won't be able to reconnect to the MQTT server if your wifi connection drop for a while. This can be fix with by adding this dirty hack on the HomieEventType::WIFI_CONNECTED events: void onHomieEvent(const HomieEvent &event)
{
switch (event.type)
{
case HomieEventType::WIFI_CONNECTED:
// If myIP is set, this is not the first time the wifi is connected
if (myIP != IPAddress(0,0,0,0))
{
// With AsyncMqttClient 0.9.0, Homie can't reconnect to MQTT after a wifi disconnection
// Unfortunately 0.8.2 (which is the version packaged with Homie), has a mqtt max payload size to low for sending Home Assistant Autodiscovery config
// This is clearly a bad workaround but I have nothing better yet
Serial.println("We lost Wifi Connection during Operation. The Esp need to reboot");
Homie.reboot();
}
myIP = event.ip;
...
break;
...
}
} You'll need to declare your variable somewhere in your SenseoWifi.cpp as well ...
HomieNode senseoNode("machine", "senseo-wifi", "senseo-wifi");
IPAddress myIP = IPAddress(0,0,0,0);
... |
Hi, |
Hi!
Just found your project and it's really amazing.
Will order some PCBs right now.
But one question: is it possible to replace the TCRT5000 with another sensor? I'd really like to use the cup detection, but don't want to cut a hole in the Senseo's housing.
Best regards,
Oliver
The text was updated successfully, but these errors were encountered: