hi r1erick2
I use a PCA9685 (from Adafruit) to run the lighting effects on my fishing yak control system. If you have the patience to read through the Picaxe Basic code in the following link, there is everything you need to know to use the PCA9685 with any Picaxe that has I2C.
https://picaxeforum.co.uk/threads/picaxe-kayak-control-project.28063/
see also:
https://www.nxp.com/docs/en/data-sheet/PCA9685.pdf
Note that the proc (aka subroutine) “
LED.outputs_Set” shows how to set multiple PCA9685 channels with a single I2C write. All procs that control the PCA9685 begin with “
LED.” You may also want to look at the proc
init. Note that I only use the first 8 channels but the software would be easy to expand to all 16.
Note that when writing to multiple lights/servos there are 2 preceding zeros. This specifies an offset to keep multiple devices from bumping the power source at once (offsets not usually needed for servos, but for home lighting or electronic billboards may be an issue).
for example: (where AL AH are the low-byte hi-byte for the 0…4095 timing interval for the first channel, etc.)
hi2cout $6,(0,0,AL,AH,0,0,BL,BH,0,0,CL,CH,0,0,DL,DH,0,0,EL,EH,0,0,FL,FH,0,0,GL,GH,0,0,HL,HH)
You would need to modify the code to generate 1…2mS pulses rather than 0…100% lighting, but the basic reading/writing methods would be the same.
Pwm1_rw2_sch.pdf has some notes about how to generate the timing pulses for servos using the PCA9685.
I did not include the PCB artwork because I did not want to include an entire servo project under this post.
I also included my notes file to help you understand what the PCA9685registers do.
It occurs to me that it would be easy to adapt my code to run a 16 zone LED home lighting system.
Guess that would make a nice project. Anyone interested?
Would anyone be interested in a 16-channel Picaxe servo controller project?