Skip to content
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

PCA9685 PCF8547 add two checkboxes for the mode2 settings INVRT (Bit 4) and OUTDRV (Bit 2) #1940

Open
micropet opened this issue Oct 22, 2018 · 18 comments

Comments

5 participants
@micropet
Copy link

commented Oct 22, 2018

The PCA9685 board is the only way to run multiple Leddrivers with ESPEasy.

Unfortunately the possibility for mode2 settings INVRT (bit 4) and OUTDRV via a checkbox is still missing.

On 21 Dec 2017 ShardanX wrote the following:

The PCA9685 is an external PWM chip.
It can be set to different modes for direct LED use or for use with MOSFET or MOSFET/IGBT driver chip.
These modes are not accessible from the task setup in ESPEasy.

As LED stripes and such are daily used items to day this should be changed.

In the plugin init there is this line:
Plugin_022_writeRegister(PCA9685_MODE2, (byte)0x10); // set to output
It sets the output to inverted and open drain configurtation.

I suggest to use two checkboxes for the mode2 settings INVRT (Bit 4) and OUTDRV (Bit 2).
In the init create a variable mode2set for examle.
If OUTDRV is checked do a mode2set=mode2set + 4 (Sets bit 2 to 1)
If INVRT is checked do a mode2set=mode2set + 16 (Sets bit 4 to 1)
Then write the mode2set to the MODE2 register of the PCA9685

This makes the use of FET's and driver chip possible. They need non inverted output, direct driving of a MOSFET needs totem pole config of the outputs, some drivers might need that too. As tehere are driver chips inverting and non-inverting, this setting should be separate from the OUTDRV setting.

The INVRT should be added to the PCF8547 too if possible as the outputs are always inverted with the current settings.

@micropet micropet changed the title PCA9685/PCF8547 add two checkboxes for the mode2 settings INVRT (Bit 4) and OUTDRV (Bit 2) PCA9685 PCF8547 add two checkboxes for the mode2 settings INVRT (Bit 4) and OUTDRV (Bit 2) Oct 22, 2018

@giig1967g

This comment has been minimized.

Copy link
Contributor

commented Oct 22, 2018

@micropet: PCF8574 already has the inverted logic setting (I did it :))

@micropet

This comment has been minimized.

Copy link
Author

commented Oct 22, 2018

Aha.

Can you do it synonymous for the PCA9685?
That's the most important for me.

@giig1967g

This comment has been minimized.

Copy link
Contributor

commented Oct 22, 2018

Hi,
As I don't have a 9685 I can develop it, but you will have to test it before merging.

@micropet

This comment has been minimized.

Copy link
Author

commented Oct 22, 2018

Yes this is not a problem. :)

@giig1967g

This comment has been minimized.

Copy link
Contributor

commented Oct 22, 2018

ok. let me finish doubleclick and longpress for PCF and MCP and then I will look into it.

@micropet

This comment has been minimized.

Copy link
Author

commented Oct 22, 2018

OK, i will wait.

@TD-er

This comment has been minimized.

Copy link
Member

commented Oct 22, 2018

Maybe we should also have a discussion about what to do with internal/external GPIO handling.
Now we're implementing stuff several times and that's asking for bugs.

We should have a generic way of GPIO handling and I guess the comment I made earlier today about the Switch plugin also applies here.
For GPIO handling, we have:

  • input
  • state
  • output
@svmac

This comment has been minimized.

Copy link
Contributor

commented Oct 23, 2018

Micropet looks at PR #1944. It allows you to define MODE2 register.

@micropet

This comment has been minimized.

Copy link
Author

commented Oct 23, 2018

Wau, thank you. It compiles fine. Will check it later this day.

@TD-er

This comment has been minimized.

Copy link
Member

commented Oct 23, 2018

@micropet If that PR works out great, please add a comment to that PR too, then we can merge it.

P.S. I love it to see so much activity in bug hunting and progress in testing. :)

@micropet

This comment has been minimized.

Copy link
Author

commented Oct 23, 2018

Thank you. I will test today.

@micropet

This comment has been minimized.

Copy link
Author

commented Oct 23, 2018

I need help with the MODE2 register.
On the PCA9685 I connected a 50W Leddriver (LDD-1500L) with a 50 Watt Led.

I have MODE2 default on 0x10 (16) default.
When I send the following to WEMOS the Led is off:
mosquitto_pub -t ESP-218 / cmd -m 'pcapwm, 1.4095'

If I send:
mosquitto_pub -t ESP-218 / cmd -m 'pcapwm, 1,0'
the led is on.

Changes to the MODE2 settings do not change anything.

@uzi18

This comment has been minimized.

Copy link
Contributor

commented Oct 23, 2018

1,4095?

@micropet

This comment has been minimized.

Copy link
Author

commented Oct 23, 2018

I had not rebooted.

If I set MODE2 to 6 and send the following:
mosquitto_pub -t ESP-218 / cmd -m 'pcapwm, 1.4095'
is the led on

mosquitto_pub -t ESP-218 / cmd -m 'pcapwm, 1,0' turns it off.

Much better.

@micropet

This comment has been minimized.

Copy link
Author

commented Oct 23, 2018

1,4096 is not accepted

@micropet

This comment has been minimized.

Copy link
Author

commented Oct 23, 2018

Well, I could not figure out the meaning of the possible settings.

For the application with a Ledtreiber but it is enough.

MODE 2 to 6 inverts the default setting and I can dim my light from 0 to 4095 - perfect.

But maybe someone can explain the remaining MODE 2 settings.

@uzi18

This comment has been minimized.

Copy link
Contributor

commented Oct 23, 2018

some. lines of info log please

@micropet

This comment has been minimized.

Copy link
Author

commented Oct 23, 2018

What do you expect to see in the logfile?

@TD-er TD-er added this to In progress in GPIO handling Oct 23, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.