PCF8591 AD-Wandler Analog-Digital
Moderators: grovkillen, Stuntteam, TD-er
-
- Normal user
- Posts: 12
- Joined: 01 Aug 2021, 16:18
PCF8591 AD-Wandler Analog-Digital
A nice hello,
I connected three A / D converters PCF8591 to an ESP32 via I2C. The addresses are also displayed in the I2C scanner as specified 0x48, 0x49 and 0x4A.
Which port belongs to which address, since I can't select the address? I suspect port 0-3 and port 8-11 but unfortunately I won't be able to use the third one.
Can you help me please?
Greeting Franzel
I connected three A / D converters PCF8591 to an ESP32 via I2C. The addresses are also displayed in the I2C scanner as specified 0x48, 0x49 and 0x4A.
Which port belongs to which address, since I can't select the address? I suspect port 0-3 and port 8-11 but unfortunately I won't be able to use the third one.
Can you help me please?
Greeting Franzel
Re: PCF8591 AD-Wandler Analog-Digital
Ah yeah that one is still on my mental "todo" list as the addressing is just rediculous from a user point of view.
CONFIG_PORT is the "port" you set in the task configuration.
So the lower 2 bits are the port of the chip and the upper bits are added to the base address.
0...3 -> 0x48
4...7 -> 0x49
8...11 -> 0x4A
etc.
Code: Select all
uint8_t unit = (CONFIG_PORT - 1) / 4;
uint8_t port = CONFIG_PORT - (unit * 4);
uint8_t address = 0x48 + unit;
So the lower 2 bits are the port of the chip and the upper bits are added to the base address.
0...3 -> 0x48
4...7 -> 0x49
8...11 -> 0x4A
etc.
-
- Normal user
- Posts: 12
- Joined: 01 Aug 2021, 16:18
Re: PCF8591 AD-Wandler Analog-Digital
Thanks a lot.
That´s nice
Regards
Franzel
That´s nice
Regards
Franzel
Re: PCF8591 AD-Wandler Analog-Digital
I've created a pull-request ([urlhttps://github.com/letscontrolit/ESPEasy/pull/3734]#3734[/url]) to improve the UI on this selection:
Address selection: Port selection:
Address selection: Port selection:
/Ton (PayPal.me)
Re: PCF8591 AD-Wandler Analog-Digital
Hi Franzel,
Does that addressing actually match? From my testing I'd expect the Port -> unit calculation to be like:
1...4 -> 0x48
5...8 -> 0x49
9...12 -> 0x4A
Can you please confirm if using Port 1 is actually reading A0, and Port 2 A1, etc? (I expect that Port 0 and Port 1 are both reading the A0 input on the first PCF8591)
/Ton (PayPal.me)
-
- Normal user
- Posts: 12
- Joined: 01 Aug 2021, 16:18
Re: PCF8591 AD-Wandler Analog-Digital
Hihi,
where can I download the new version. I don not find it.
If I can download the new file I will test it this week.
Regards
Franzel
where can I download the new version. I don not find it.
If I can download the new file I will test it this week.
Regards
Franzel
Re: PCF8591 AD-Wandler Analog-Digital
What .bin file have you installed on your ESP? Then I can fetch the same from the Github actions build.
Edit: The original PR has already been merged into the 'mega' branch (current active ESPEasy branch, comparable to the usually used 'master') but not yet released. I have also added a PR to enable 1..4 measured values instead of only 1, that you are very much invited to test
I'll provide a .bin from that instead.
Edit: The original PR has already been merged into the 'mega' branch (current active ESPEasy branch, comparable to the usually used 'master') but not yet released. I have also added a PR to enable 1..4 measured values instead of only 1, that you are very much invited to test

/Ton (PayPal.me)
Re: PCF8591 AD-Wandler Analog-Digital
I've guessed, based on earlier messages, that a ESP32_normal should do
(Removed the ELF file because of upload size restrictions)

(Removed the ELF file because of upload size restrictions)
/Ton (PayPal.me)
-
- Normal user
- Posts: 12
- Joined: 01 Aug 2021, 16:18
Re: PCF8591 AD-Wandler Analog-Digital
Hihi,
sorry for the late feedback but I must go to an job traveling.
I have tested the new version and I think the most things are ok.
I have a little problem that the channel 0 and 1 on the adress 0x48 change the value syncron and not seperatly.
The second problem was that the display 2004 on i2c stop the funktion after several days. If I cut the power the ESP32 funktion with the display ist ok for more days.
Thanks and regards
Franzel
sorry for the late feedback but I must go to an job traveling.
I have tested the new version and I think the most things are ok.
I have a little problem that the channel 0 and 1 on the adress 0x48 change the value syncron and not seperatly.
The second problem was that the display 2004 on i2c stop the funktion after several days. If I cut the power the ESP32 funktion with the display ist ok for more days.
Thanks and regards
Franzel
Re: PCF8591 AD-Wandler Analog-Digital
I've been working on other stuff, so this is a little bit neglected, I'm afraid. I'll see what I can do to investigate and possibly fix.
The I2C freezing can have several issues, and there is an open PR to detect and fix that, not sure when that will be picked up again, but it could be helpful here.
You are using pull-up resistors on both the I2C SDA and SCL lines, I assume? When they are not used, that could also cause bus-issues.
The I2C freezing can have several issues, and there is an open PR to detect and fix that, not sure when that will be picked up again, but it could be helpful here.
You are using pull-up resistors on both the I2C SDA and SCL lines, I assume? When they are not used, that could also cause bus-issues.
/Ton (PayPal.me)
Re: PCF8591 AD-Wandler Analog-Digital
I have done tests and a little investigation (browsing the chip specs), and the result is that for this device the 'Force Slow I2C Speed' checkbox must be enabled to get reliable measurements. At least when reading multiple ports, but as the chip specification states it has a max. I2C clock frequency of 100 kHz, it is safe to assume it doesn't support the ESPEasy standard I2C Clock Speed of 400 kHz. I've updated the documentation to reflect this.
/Ton (PayPal.me)
Who is online
Users browsing this forum: No registered users and 17 guests