Closed nstadigs closed 2 years ago
Please try to set attenuation: auto
ADC sensor change in 2021.11 esphome release.
My Esp32 works great with 2021.11 release and the current config but it depends on manufacturer calibration
Thanks, I've tried that. That seems to set it to 2.5db automatically, giving the same values.:
[10:01:45][D][sensor:113]: 'BEMF 1': Sending state 0.07500 V with 2 decimals of accuracy
[10:01:45][D][switch:021]: 'CH1 IB' Toggling ON.
[10:01:45][D][switch:037]: 'CH1 IB': Sending state ON
[10:01:45][D][sensor:113]: 'BEMF 1': Sending state 0.07500 V with 2 decimals of accuracy
[10:01:46][D][sensor:113]: 'BEMF 1': Sending state 0.07500 V with 2 decimals of accuracy
[10:01:46][D][sensor:113]: 'BEMF 1': Sending state 0.07500 V with 2 decimals of accuracy
[10:01:46][D][switch:021]: 'CH1 IB' Toggling OFF.
[10:01:46][D][switch:037]: 'CH1 IB': Sending state OFF
[10:01:47][D][sensor:113]: 'BEMF 1': Sending state 0.07500 V with 2 decimals of accuracy
[10:01:47][D][sensor:113]: 'BEMF 1': Sending state 0.07500 V with 2 decimals of accuracy
ADC values are proportional to vref (esp32 input voltage). Can you check input voltage ?
Input is 3.30 V
Your voltage reference between GPIO36 and GND are correct values. That means it's an ESP32 problem. Can you test :
raw: true
filters:
- multiply: 0.00026862
and give details or picture of the ESP32 Chip Surface Marking
[10:58:50][D][sensor:113]: 'BEMF 1': Sending state 0.00000 V with 2 decimals of accuracy
What is the chip date code ?
Can you test to wire VCC 3.3V to GPIO36 or better put a potentiometer between ?
Hi, I've done some tests on my board between esphome 2021.10.3 and latest. The values of ADC sensors are 2x biggers. With my ESP32 devkit, I can measure ADC at 0.04V. Your board is perhaps less sensitive. You can try to cut the 12ohm resistor with a wire cutters. Watch out for projections in your eyes !
I can't find the date code anywhere on my chip :thinking:
I don't have a potentiometer but I tried with a bunch of different resistors and I can actually read some higher values via ADC!
You are probably right about the sensitivity of my board. I will try to cut a resistor tonight.
Thanks, you are very helpful!
I removed that 12ohm resistor and now I sometimes get a little spike right when the motor starts, but then it returns to "normal". It doesn't go up at end stops either :man_shrugging:
[19:19:30][D][sensor:113]: 'BEMF 1': Sending state 0.07800 V with 2 decimals of accuracy
[19:19:30][D][sensor:113]: 'BEMF 1': Sending state 0.07800 V with 2 decimals of accuracy
[19:19:31][D][sensor:113]: 'BEMF 1': Sending state 0.07800 V with 2 decimals of accuracy
[19:19:31][D][switch:021]: 'CH1 IA' Toggling ON.
[19:19:31][D][switch:037]: 'CH1 IA': Sending state ON
[19:19:31][D][sensor:113]: 'BEMF 1': Sending state 0.09400 V with 2 decimals of accuracy
[19:19:32][D][sensor:113]: 'BEMF 1': Sending state 0.07800 V with 2 decimals of accuracy
[19:19:32][D][sensor:113]: 'BEMF 1': Sending state 0.07800 V with 2 decimals of accuracy
[19:19:33][D][sensor:113]: 'BEMF 1': Sending state 0.07800 V with 2 decimals of accuracy
[19:19:33][D][sensor:113]: 'BEMF 1': Sending state 0.07800 V with 2 decimals of accuracy
[19:19:34][D][sensor:113]: 'BEMF 1': Sending state 0.07800 V with 2 decimals of accuracy
[19:19:34][D][switch:021]: 'CH1 IA' Toggling OFF.
[19:19:34][D][switch:037]: 'CH1 IA': Sending state OFF
[19:19:34][D][sensor:113]: 'BEMF 1': Sending state 0.07800 V with 2 decimals of accuracy
[19:19:35][D][sensor:113]: 'BEMF 1': Sending state 0.07800 V with 2 decimals of accuracy
[19:19:35][D][sensor:113]: 'BEMF 1': Sending state 0.07800 V with 2 decimals of accuracy
The values from the multimeter are now 19mV when running and 50~70mV at end stops
You can replace the "smoothing" resistor if you have one with a value less than 12ohm between BEMF and GND.
To adjust the endstop threshold, there are bemf_triggers 1 to 8 (input_numbers)
Got myself a breadboard, some jumper cables and a potentiometer today to really dig in.
Seems like the smallest values I can measure via ADC is around 100mV. Everything below that comes out as 0. This matches the recommended measuring values on the docs on the espressif website. Even then it fluctuates a lot until I get to around 200-300mV. Is there a good way to amplify the BEMF? A transistor maybe? Or is there a better way?
My bad! I did not understand that the resistors of CH1 and CH2 where in parallel! After removing the other 12ohm I can successfully read values! But it seems that I have to replace the "smoothing" resistor with one more that 12ohm rather than one with less to read values. I guess a lower value one practically "dumps" more voltage into GND? Anyhow. I now have 22ohm resistors connected as you described and it seems to work!
I'll remove that resistors in the next version. They make troubles
Ok! Sorry, I don't understand half of this. What are they there for? It seems like they make the values less "jumpy". Is this correct? I think my ESP32 crashed once without the resistor, but I'm not sure if it's related.
Do you also get a spike when the motor starts sometimes? That spike is often higher than the endstop bemf causing the motor to stop immediately. Is this the reason why you have the small 5 second pause and resume at the start of the calibration script?
I've just done some test and they are necessary. Without them, the GND is not connected to the L9110 module. If linked directly to GND without resistor, no way to read BEMF
For the spikes, you can adjust the BEMF_trigger_x value. I have only small spikes about 15 mv and then running at 8-10mv
Yeah I noticed that as well. Without the resistor s the bemf goes bananas. Regarding the spike it's often higher than the BEMF at end stops for me, but I think that I can solve that on the firmware side by skipping over the first measurements when the motor is expected to start.
18ohm resistors seems to be optimal for me. If that works for you too maybe it's best to replace them in a future version so that other won't run in to the same problems?
Actually there are two 12ohm parallel resistors = 6ohm If you remove the parallel resistors and link BEMF with GND, the resistors are in series and add their values (18+18=36ohm)
Strange it doesn't work with the factory 6ohm resistance
Oh my. The resistors on my board are wrong! They are marked 1R07! Those are 1.07ohm resistors, right? Did jlcpcb mount the wrong resistors?
Edit: I see they say 1R07 in your picture as well
When I mount 12ohm resistors it works
According to the schematic and BOM a 1.07Ω shunt is used. According to homematic IP the motors are using 120mA of current. This would mean a drop of of 128mV over the shunt. And according to the ESP32 docs the minimum voltage the ADC can measure is 100mV. This seems to be a bit tight especially considering the 120mA are maximum ratings and we are using a bit of the 3.3V for the shunt so the real current would at least a bit lower.
Just found this where they measured a current of ~15mA for this motor. So that would only be 16mV over the shunt, far too less for the ESP to measure.
Many thanks for the comment. I did not knew the https://github.com/Lenti84/VdMot_Controller project. I work on a complete refractor of the project with custom valves as the homematic Vmot are bad quality (they jump around their support and breaks). What is your recommendation for the resistors value ? I've made many tests and the best is 12kohm in series but L9110s chip is not well documented and interfering
I am currently working on something for myself using the Vmots (or disassembled Equiva Model N), with parts available from jlcpcb assembly. I am planning to use an INA180A2 with a 0.51Ω shunt over VCC. This should give me 255mV to 3060mV for 10mA to 120mA so well inside the voltage range of the ESP32 ADC not matter how the motor behaves.
I haven't completly thought this though and wanted to confirm with a colleague who is a bit better at analog stuff than me.
Btw the LS9110 (if really the problem) would be easily replaceable by another H-Bridge or just 4 transistors.
Many thanks for the comment. I did not knew the https://github.com/Lenti84/VdMot_Controller project. I work on a complete refractor of the project with custom valves as the homematic Vmot are bad quality (they jump around their support and breaks). What is your recommendation for the resistors value ? I've made many tests and the best is 12kohm in series but L9110s chip is not well documented and interfering
I too have been thinking about custom valve motors for some time.
I started experimenting with a custom ESPhome component for your board that counts motor revelations with code borrowed from https://github.com/Lenti84/VdMot_Controller. But the values from the BEMF relies on the amount of pressure caused by your specific valve pins, so that gets pretty complex.
So instead I started to look into using stepper motors for driving the valves. I found these small 5v stepper motors with integrated reducing gears and a 3m thread in the shaft on AliExpress. I'm thinking that if you put an M3 hex head screw in the threaded hole in the shaft and lock the rotation of the screw you can use that to press the valve pin. This would allow fine grained positioning of the valve without constant recalibration. What do you think?
I've made a working valve with https://fr.aliexpress.com/item/4000311295036.html?spm=a2g0s.12269583.0.0.18834b0ejbgKSj 15 RPM, 3V.
For steppers, a lot a TRV valve manufacturers use https://www.alibaba.com/product-detail/Brand-new-Linear-actuator-for-Valve_60637359967.html?spm=a2700.shop_plgr.41413.12.531f5635mmtYvx
Steppers is a good solution for position handling, but do not survive a controller reboot (lost position value).
I work on an absolute position control with a reflective optical sensor (ITR8307). That means the controller board must read one more analog input for each valve. The ESP32 is limited in ADC and that involve to use a analog multiplexer (CD74HC4067).
I started experimenting with a custom ESPhome component for your board that counts motor revelations with code borrowed from https://github.com/Lenti84/VdMot_Controller. But the values from the BEMF relies on the amount of pressure caused by your specific valve pins, so that gets pretty complex.
I was thinking about using a small push button on the top side to determine the top position at startup. This is similar to what 3d-printers do.
I work on an absolute position control with a reflective optical sensor (ITR8307). That means the controller board must read one more analog input for each valve. The ESP32 is limited in ADC and that involve to use a analog multiplexer (CD74HC4067).
Very interesting! I'm eager to see what you come up with :)
For information, I upgraded today from python 3.7 to 3.10.3 and recompile with latest esphome and now the null value of BEMF sensor is 0.08V instead of 0.0V Very strange .... I'll investigate if I'll find time to.
@nliaudat do you have any solution about this? I started with this project, build and installed to esp directly from esphome dashboard (Homeassistant). And i have permanent 0.08 V on BEMF sensor. 1.35 v54 board version, ESP32-WROOM-32U chip and HmIP-VDMOT actuators.
@dragop4 No solution for 0.08V reading. I mean it's related to python 3.8 rounding number changes. Reading ADC 0.08 means 0V and that's not a problem to upper the BEMF trigger by 0.1
The latest board as opamp to have better ADC reading.
it's possible to modify my board without ordering new?
Operating environment/Installation (Hass.io/Docker/pip/etc.):
pip ESP (ESP32/ESP8266, Board/Sonoff):
ESP32-DevKitC-v4 ESPHome version (latest production, beta, dev branch)
ESPHome version 2021.12.1 Affected component:
adc
Description of problem: ADC sensor senses nothing even tho I get small values when measured at the pins.
Problem-relevant YAML-configuration entries:
Logs (if applicable):
Additional information and things you've tried:
Board: v53 rev 1.19
Putting a multimeter between GPIO36 and GND gives around 20mV when the motor is running unhindered and around 50mV at end stops. Are these values normal? If I set the ADC sensor to report "raw" I get only 0's. As I understand I should get a value between 0 and 4096. Maybe these values are too low to be measured by my esp32? Or are the values from my board lower than expected?
I've tried other pins and motor contacts but with the same results.
PS. I haven't received the old board you sent me yet, but I payed the import taxes for them yesterday. The local postal service had entered the wrong address for the payment notice letter so it was brought here by my neighbor. So they will probably arrive soon. Thanks again :)
EDIT:
I've also tried this with the same results:
This seems to be the legacy way to specify the board, and json and async_tcp are now working with esp-idf using the newer configuration method that I posted originally.