PCA9685_SetFreqency will set the frequency of one device that has a valid constant as shown above and repeated below for clarity. Where [, device IC2 Address] is an optional value. Where device IC2 Address is a valid I2C address.
OK. It could have waited 'till after your hols,sorry to disturb.
Are #define PCA9685_ADDRESS_1 0x80
#define PCA9685_ADDRESS_2 0x82
0x84, 0x86 only used?
as the first extra board I soldered A0 link so it's address is 0x81....should I have soldered link 2 instead,so it's address is 0x82?
I'm using :#define PCA9685_ADDRESS_1 0x80 and #define PCA9685_ADDRESS_1 0x81.
0x80 is working not second board,0x81
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The "solder address jumper" on board 2 is normal and tech griff says it give device A0 soldered base address plus one. This is necessary??
one device was easy to use with your subs then include. I am assuming the second device is working but no idea of correct commands to apply to use 2nd board ... presuming same led 0 to 15 for 2nd board.
Please correct me as to hi2c use..no points for me trying clueless.
At least you have a gcb tester. If I could sort it my self I would.
errors on this please
OK. Here goes. Seriously thankful you are willing to test.
Remove the devices from the I2C bus. Run I2C discovery you should have NO I2C devices shown.
Take one device and attach to the I2C bus. Run I2C discovery you should one I2C device shown. Note this down - we will call this information PCA9685_ADDRESS_1
Remove the device from the I2C bus.
Take the oher device and attach to the I2C bus. Run I2C discovery you should one I2C device shown. Note this down - we will call this information PCA9685_ADDRESS_2
What is really, really important at this point is that these address are at least two address apart. Where the theory is ABS( PCA9685_ADDRESS_2 - PCA9685_ADDRESS_1) > 1. You current have ABS( 0x81 - 0x81) with the result of 1, so, your addressing is invalid. But, completing steps 2 and 4 this will confirm the I2C address for each device.
Remove the device from the I2C bus.
Take device with the address PCA9685_ADDRESS_1. Attach to I2C bus. Test using the PWM code. Ensure the constant PCA9685_ADDRESS_1 is defined as determined at step #2.
#chip mega328p,16#option Explicit#include<PCA9685.h>#define PCA9685_ADDRESS_1 0x80 'validate from step 2#define PCA9685_ADDRESS_2 0x82 'validate from step 4#define hi2c_BAUD_RATE 100#define hi2c_DATA PORTC.4#define hi2c_CLOCK PORTC.5hi2cModeMaster'ThecallISrequiredtosetupthedevicePCA9685_Initialise'SetthefrequencyusingtheGreatCowBASICPWMconstant#define PWM_Freq 50 '50Hz for servoPCA9685_SetFreqency(50,PCA9685_ADDRESS_1)PCA9685_SetFreqency(50,PCA9685_ADDRESS_2)dimservoasbytedimservoposasword;servoangledimdeg0,deg180asworddeg180=520;2.41mSdeg0=110;85=400mS140=650msservo=0;servodegreeswantedservopos=scale(servo,0,179,deg0,deg180)PCA9685_WriteChannel(PCA9685_LED0,0,servopos,PCA9685_ADDRESS_1)PCA9685_WriteChannel(PCA9685_LED15,0,servopos,PCA9685_ADDRESS_1)PCA9685_WriteChannel(PCA9685_LED15,0,servopos,PCA9685_ADDRESS_2)doloop
Note the results. Did it work? Do things happen as expected? If not we have an issue. No point in proceeding. Create a ZIP of the project - Source, ASM. LST file. Rename as PCA9685Device_1_Report.zip. Goto to step 11.
Remove the device from the I2C bus.
Take device with the address PCA9685_ADDRESS_2 Attach to I2C bus. Test using the PWM code. Ensure the constant PCA9685_ADDRESS_2 is defined as determined at step #4.
Note the results. Did it work? Do things happen as expected? If not we have an issue. No point in proceeding. Create a ZIP of the project - Source, ASM. LST file. Rename as PCA9685Device_2_Report.zip. Goto to step 11.
Add the second device from the I2C bus.
Ensure the constantsdetermined at step #2 and #4 are correct.
Note the results. Did it work? Do things happen as expected? If not stop here. No point in proceeding. Create a ZIP of the project - Source, ASM. LST file. Rename as PCA9685Device_12_Report.zip
Lots to do. :-)
If you do get issues at step 6 or 8 then I want you to repeat the tests. Within only one device device attached using the old .h, update the address - does that work?
Even more to do.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
first board i2c write 0x80,read 0x81.
second board with A0 soldered write 0x81,read 0x82.
unsoldered A0 and soldered A1. i2c address write 0x82,read 0x83
neither board works with new pca9685.h
The boards cannot have overlapping addresses. Change until the addresses are not overlapping. At the moment they do. Needs to be always an even and odd address per device.... you have second board on 0x81 & 0x82 needs to be changed.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
define PCA9685_ADDRESS_1 0x80 --- board 0 no soldered links
define PCA9685_ADDRESS_2 0x82 --- board 1 A1 link soldered.
this caused syntax error but copy pasting identical line that passed syntax sorted.
PCA9685_WriteChannel (PCA9685_LED15 ,0, servopos, PCA9685_ADDRESS_2 )
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The boards cannot have overlapping addresses. Change until the addresses are not overlapping. At the moment they do.
board 0 0x80 , board 1 0x82.
is that ok? it is used in zip file as in
define PCA9685_ADDRESS_1 0x80 --- board 0 no soldered links
define PCA9685_ADDRESS_2 0x82 --- board 1 A1 link soldered.
Remove the devices from the I2C bus. Run I2C discovery you should have NO I2C devices shown. You have not told me that you have proven the address using I2C discovery - are you using the board to estimate the address? and, do this with only one device attached
Take one device and attach to the I2C bus. Run I2C discovery you should one I2C device shown. Note this down - we will call this information PCA9685_ADDRESS_1
Remove the device from the I2C bus.
Take the oher device and attach to the I2C bus. Run I2C discovery you should one I2C device shown. Note this down - we will call this information PCA9685_ADDRESS_2 You have not told me that you have proven the address using I2C discovery - are you using the board to estimate the address? and, do this with only one device attached
What is really, really important at this point is that these address are at least two address apart. Where the theory is ABS( PCA9685_ADDRESS_2 - PCA9685_ADDRESS_1) > 1. You current have ABS( 0x81 - 0x81) with the result of 1, so, your addressing is invalid. But, completing steps 2 and 4 this will confirm the I2C address for each device.
Remove the device from the I2C bus.
Take device with the address PCA9685_ADDRESS_1. Attach to I2C bus. Test using the PWM code. Ensure the constant PCA9685_ADDRESS_1 is defined as determined at step #2. You used your own code. It has errors and is not the based code I recommended you use.
#chip mega328p,16#option Explicit#include<PCA9685.h>#define PCA9685_ADDRESS_1 0x80 'validate from step 2#define PCA9685_ADDRESS_2 0x82 'validate from step 4#define hi2c_BAUD_RATE 100#define hi2c_DATA PORTC.4#define hi2c_CLOCK PORTC.5hi2cModeMaster'ThecallISrequiredtosetupthedevicePCA9685_Initialise'SetthefrequencyusingtheGreatCowBASICPWMconstant#define PWM_Freq 50 '50Hz for servoPCA9685_SetFreqency(50,PCA9685_ADDRESS_1)PCA9685_SetFreqency(50,PCA9685_ADDRESS_2)dimservoasbytedimservoposasword;servoangledimdeg0,deg180asworddeg180=520;2.41mSdeg0=110;85=400mS140=650msservo=0;servodegreeswantedservopos=scale(servo,0,179,deg0,deg180)PCA9685_WriteChannel(PCA9685_LED0,0,servopos,PCA9685_ADDRESS_1)PCA9685_WriteChannel(PCA9685_LED15,0,servopos,PCA9685_ADDRESS_1)PCA9685_WriteChannel(PCA9685_LED15,0,servopos,PCA9685_ADDRESS_2)doloop
Note the results. Did it work? Do things happen as expected? If not we have an issue. No point in proceeding. Create a ZIP of the project - Source, ASM. LST file. Rename as PCA9685Device_1_Report.zip. Your ZIP is not using the reference code above and one contain a two device test - one device please
Remove the device from the I2C bus.
Take device with the address PCA9685_ADDRESS_2 Attach to I2C bus. Test using the PWM code. Ensure the constant PCA9685_ADDRESS_2 is defined as determined at step #4.
Note the results. Did it work? Do things happen as expected? If not we have an issue. No point in proceeding. Create a ZIP of the project - Source, ASM. LST file. Rename as PCA9685Device_2_Report.zip.
Your ZIP is not using the reference code above and one contain a two device test - one device please
Add the second device from the I2C bus.
Ensure the constantsdetermined at step #2 and #4 are correct.
Note the results. Did it work? Do things happen as expected? If not stop here. No point in proceeding. Create a ZIP of the project - Source, ASM. LST file. Rename as PCA9685Device_12_Report.zip Your ZIP is not using the reference code above
If you do get issues at step 6 or 8 then I want you to repeat the tests. Within only device device attached using the old .h, update the address - does that work? You sad it does not work. Does not work with only one device attached?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
hi2c finder gives address as 0x80 for board 0 -- PCA9685_ADDRESS_1 -- no links soldered.
hi2c finder gives address as 0x82 for board 1 -- PCA9685_ADDRESS_2 -- A1 link soldered.
The code does nothing with board 0, board 1 or both.
In the new pca9685.h...is this containing typo?
Sub PCA9685_WriteChannel( _localregister as byte, _localValueOn as word, _localValueOff as word, Optional In _localDevice as byte = PCA9685_ADDRESS_1 )
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Optional In _localDevice as byte = PCA9685_ADDRESS_1
elsewhere _localDevice is used.
Sub PCA9685_WriteChannel( _localregister as byte, _localValueOn as word, _localValueOff as word, Optional In _localDevice as byte = PCA9685_ADDRESS_1 )
'Requires Mode1.AI=1 and Mode1.OCH = 0 - these ARE MANDATED
~~~
#ifdef HI2C_DATA
do
HI2CRESTART
HI2CSend( _localDevice)
~~~
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Sub PCA9685_WriteChannel( _localregister as byte, _localValueOn as word, _localValueOff as word, Optional In _localDevice as byte = PCA9685_ADDRESS_1 )
I am not being dim. But,.... Optional In _localDevice as byte = PCA9685_ADDRESS_1 )
why is it defined as PCA9685_ADDRESS_1 ?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Success!
The i2c address solder links info could be clarified.
This code attatchment works.runs a servo off each board. https://youtu.be/HFPG7Ra0uVQ
with only 2 boards, changing/soldering the second boards address might be non conclusive without more boards on the bus...so I didn't bother. 32 servos is enough.??
following on.. #define PWM_Freq 50,PCA9685_ADDRESS_1 ;50Hz for servo
please clarify PCA9685_ADDRESS_1 from your previous description.
I have this in working code
'Set the frequency using the Great Cow BASIC PWM constant
#define PWM_Freq 50,PCA9685_ADDRESS_1 ;50Hz for servo
PCA9685_SetFreqency ( 50,PCA9685_ADDRESS_1 )
PCA9685_SetFreqency ( 50,PCA9685_ADDRESS_2 )
the line - #define PWM_Freq 50,PCA9685_ADDRESS_1 ;50Hz for servo
can be erased - not needed.
I hope this is all relevant. would others have made the same errors as me?
I followed the instructions,read addresses weren't mentioned.data for arduino not relevant..but there.
thanks again for the pca9685.h and support time for users.
from my code you can see me trying different values to calibrate the servo. .... you have to experiment with servos to comment. yawn
Let users be wary of good intentioned arduino guides for this board. They don't take account of read addresses... but they're available.
The advice for the solder links is first extra board solder A0.
next extra board solder A1.
next extra board solder A0 and A1.
Using 2 boards -- first board don't solder any links. second board solder A0.
connect both boards and use i2c finder to find addresses of both boards and use those values.
... or you'll be on a fools errand.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
that works but is tedious for lots of leds.
I tried
dim pca9685_channel as word ; why word?
for pca9685_channel = 0 to 2
PCA9685_WriteChannel (PCA9685_channel ,0, servopos, PCA9685_ADDRESS_1 )
PCA9685_WriteChannel (PCA9685_channel ,0, servopos, PCA9685_ADDRESS_2 )
next
doesn't work..gives zero ie servos swing total one way.
I looked at the include code.
I've been building a hexbot. Drill bit snapped and went through my thumb nail.
Bought aluminium trim from screwfix..more on order. handy stuff.
More pictures when the legs finished.
Hope it's ok for feed back here ..not open a topic.
sometimes it locks up,needs arduino reset button pressed.
first test https://youtu.be/YtKqmKKk4gk
Thanks again for your time working on this Evan.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
PCA9685_Initialise will init all devices that have a valid constant as shown above and repeated below for clarity.
This example would init two devices on address 0x80 and x82.
PCA9685_SetFreqency will set the frequency of one device that has a valid constant as shown above and repeated below for clarity. Where [, device IC2 Address] is an optional value. Where device IC2 Address is a valid I2C address.
PCA9685_SetFreqency ( frequency_wordvalue [, device IC2 Address] )
And, you have replace the .h file in your include folder? If not, do replace with the new version.
Do us a favor. DO NOT POST code like that. Apart from the fact that it is incomplete code - I cannot view the post on my phone.
Last edit: Anobium 2018-07-23
OK. It could have waited 'till after your hols,sorry to disturb.
Are #define PCA9685_ADDRESS_1 0x80
#define PCA9685_ADDRESS_2 0x82
0x84, 0x86 only used?
as the first extra board I soldered A0 link so it's address is 0x81....should I have soldered link 2 instead,so it's address is 0x82?
I'm using :#define PCA9685_ADDRESS_1 0x80 and #define PCA9685_ADDRESS_1 0x81.
0x80 is working not second board,0x81
You are kidding. Each device has two adresses and you have that totally wrong. Each device would be two addresses apart.
And, always, always, always check the address with only one device on the i2c bus using i2c discovery to your serial terminal.
So, comfirm addresses. Then, retry.
The "solder address jumper" on board 2 is normal and tech griff says it give device A0 soldered base address plus one. This is necessary??
one device was easy to use with your subs then include. I am assuming the second device is working but no idea of correct commands to apply to use 2nd board ... presuming same led 0 to 15 for 2nd board.
Please correct me as to hi2c use..no points for me trying clueless.
At least you have a gcb tester. If I could sort it my self I would.
errors on this please
using new include
Last edit: stan cartwright 2018-07-23
OK. Here goes. Seriously thankful you are willing to test.
What is really, really important at this point is that these address are at least two address apart. Where the theory is ABS( PCA9685_ADDRESS_2 - PCA9685_ADDRESS_1) > 1. You current have ABS( 0x81 - 0x81) with the result of 1, so, your addressing is invalid. But, completing steps 2 and 4 this will confirm the I2C address for each device.
Note the results. Did it work? Do things happen as expected? If not we have an issue. No point in proceeding. Create a ZIP of the project - Source, ASM. LST file. Rename as PCA9685Device_1_Report.zip. Goto to step 11.
Note the results. Did it work? Do things happen as expected? If not we have an issue. No point in proceeding. Create a ZIP of the project - Source, ASM. LST file. Rename as PCA9685Device_2_Report.zip. Goto to step 11.
Note the results. Did it work? Do things happen as expected? If not stop here. No point in proceeding. Create a ZIP of the project - Source, ASM. LST file. Rename as PCA9685Device_12_Report.zip
Lots to do. :-)
Even more to do.
first board i2c write 0x80,read 0x81.
second board with A0 soldered write 0x81,read 0x82.
unsoldered A0 and soldered A1. i2c address write 0x82,read 0x83
neither board works with new pca9685.h
The boards cannot have overlapping addresses. Change until the addresses are not overlapping. At the moment they do. Needs to be always an even and odd address per device.... you have second board on 0x81 & 0x82 needs to be changed.
I thought I zipped file with #include <PCA9685.h>
define PCA9685_ADDRESS_1 0x80 --- board 0 no soldered links
define PCA9685_ADDRESS_2 0x82 --- board 1 A1 link soldered.
this caused syntax error but copy pasting identical line that passed syntax sorted.
PCA9685_WriteChannel (PCA9685_LED15 ,0, servopos, PCA9685_ADDRESS_2 )
Nope. I have no idea what the post above is about.
The boards cannot have overlapping addresses. Change until the addresses are not overlapping. At the moment they do.
board 0 0x80 , board 1 0x82.
is that ok? it is used in zip file as in
the big print just happened, forgot ~~~
https://learn.adafruit.com/assets/2223 but using A1 for second board
Last edit: stan cartwright 2018-07-24
OK.Repeat what I said yesterday.
What is really, really important at this point is that these address are at least two address apart. Where the theory is ABS( PCA9685_ADDRESS_2 - PCA9685_ADDRESS_1) > 1. You current have ABS( 0x81 - 0x81) with the result of 1, so, your addressing is invalid. But, completing steps 2 and 4 this will confirm the I2C address for each device.
You used your own code. It has errors and is not the based code I recommended you use.
Note the results. Did it work? Do things happen as expected? If not we have an issue. No point in proceeding. Create a ZIP of the project - Source, ASM. LST file. Rename as PCA9685Device_1_Report.zip.
Your ZIP is not using the reference code above and one contain a two device test - one device please
Note the results. Did it work? Do things happen as expected? If not we have an issue. No point in proceeding. Create a ZIP of the project - Source, ASM. LST file. Rename as PCA9685Device_2_Report.zip.
Your ZIP is not using the reference code above and one contain a two device test - one device please
Note the results. Did it work? Do things happen as expected? If not stop here. No point in proceeding. Create a ZIP of the project - Source, ASM. LST file. Rename as PCA9685Device_12_Report.zip Your ZIP is not using the reference code above
hi2c finder gives address as 0x80 for board 0 -- PCA9685_ADDRESS_1 -- no links soldered.
hi2c finder gives address as 0x82 for board 1 -- PCA9685_ADDRESS_2 -- A1 link soldered.
The code does nothing with board 0, board 1 or both.
In the new pca9685.h...is this containing typo?
Sub PCA9685_WriteChannel( _localregister as byte, _localValueOn as word, _localValueOff as word, Optional In _localDevice as byte = PCA9685_ADDRESS_1 )
Where is the error? I cannot see it.
Optional In _localDevice as byte = PCA9685_ADDRESS_1
elsewhere _localDevice is used.
Sub PCA9685_WriteChannel( _localregister as byte, _localValueOn as word, _localValueOff as word, Optional In _localDevice as byte = PCA9685_ADDRESS_1 )
'Requires Mode1.AI=1 and Mode1.OCH = 0 - these ARE MANDATED
~~~
#ifdef HI2C_DATA
do
HI2CRESTART
HI2CSend( _localDevice)
~~~
I am not being dim. But, cannot make out the difference. Ping me on Google
Sub PCA9685_WriteChannel( _localregister as byte, _localValueOn as word, _localValueOff as word, Optional In _localDevice as byte = PCA9685_ADDRESS_1 )
I am not being dim. But,.... Optional In _localDevice as byte = PCA9685_ADDRESS_1 )
why is it defined as PCA9685_ADDRESS_1 ?
That is the default value. Optional means that is you do not provide that parameter then the value will be set to address_1
I have used throughout to ensure that if you had one device all will work.
I have inspected your ASM in the Zip. Everything looks ok but it is clearly not. Ping me on Google Chat so others do not to track our conversation.
Success!
The i2c address solder links info could be clarified.
This code attatchment works.runs a servo off each board.
https://youtu.be/HFPG7Ra0uVQ
with only 2 boards, changing/soldering the second boards address might be non conclusive without more boards on the bus...so I didn't bother. 32 servos is enough.??
following on.. #define PWM_Freq 50,PCA9685_ADDRESS_1 ;50Hz for servo
please clarify PCA9685_ADDRESS_1 from your previous description.
I have this in working code
the line - #define PWM_Freq 50,PCA9685_ADDRESS_1 ;50Hz for servo
can be erased - not needed.
I hope this is all relevant. would others have made the same errors as me?
I followed the instructions,read addresses weren't mentioned.data for arduino not relevant..but there.
Last edit: stan cartwright 2018-07-25
thanks again for the pca9685.h and support time for users.
from my code you can see me trying different values to calibrate the servo. .... you have to experiment with servos to comment. yawn
Good news. New library works.
I will promote the new library to the release code tomorrow.
Well done Stan.
Let users be wary of good intentioned arduino guides for this board. They don't take account of read addresses... but they're available.
The advice for the solder links is first extra board solder A0.
next extra board solder A1.
next extra board solder A0 and A1.
Using 2 boards -- first board don't solder any links. second board solder A0.
connect both boards and use i2c finder to find addresses of both boards and use those values.
... or you'll be on a fools errand.
Not understanding why this doesn't work
that works but is tedious for lots of leds.
I tried
doesn't work..gives zero ie servos swing total one way.
I looked at the include code.
I've been building a hexbot. Drill bit snapped and went through my thumb nail.
Bought aluminium trim from screwfix..more on order. handy stuff.
More pictures when the legs finished.
It's not working as it should. No one as one for comparison.
psu for servos and psu for arduino??
diy is not fun .. image
Hope it's ok for feed back here ..not open a topic.
sometimes it locks up,needs arduino reset button pressed.
first test https://youtu.be/YtKqmKKk4gk
Thanks again for your time working on this Evan.