mortenx
(Mortenx)
March 6, 2024, 10:13am
1
Hello
As part of a school project, it is necessary to read rotameter information, what would be the best way? I’m thinking of using Opto photo Interrupter . What sensor type in esphome programming would be best to read them? And the best way to show the result ?
https://www.aliexpress.com/item/32657347266.html?spm=a2g0o.order_list.order_list_main.110.597f1802oWbXwP
mortenx
(Mortenx)
March 21, 2024, 9:51pm
2
binary_sensor:
- platform: gpio
pin: GPIO13
name: "rota015"
id: "rota015"
- platform: gpio
pin: GPIO12
name: "rota030"
id: "rota030"
- platform: gpio
pin: GPIO14
name: "rota050"
id: "rota050"
- platform: gpio
pin: GPIO27
name: "rota070"
id: "rota070"
- platform: gpio
pin: GPIO26
name: "rota090"
id: "rota090"
- platform: gpio
pin: GPIO25
name: "rota110"
id: "rota110"
- platform: gpio
pin: GPIO33
name: "rota130"
id: "rota130"
sensor:
- platform: template
name: "Rotameter"
unit_of_measurement: "L/min"
accuracy_decimals: 2
lambda: |-
if (id(rota015).state) {
return 0.15;
} else {
if (id(rota030).state) {
return 0.30;
} else {
if (id(rota050).state) {
return 0.50;
} else {
if (id(rota070).state) {
return 0.70;
} else {
if (id(rota090).state) {
return 0.90;
} else {
if (id(rota110).state) {
return 1.10;
} else {
if (id(rota130).state) {
return 1.30;
} else {
return 0.0;
}
}
}
}
}
};
}
update_interval: 5s