Adding support for 16 channel PWM expansion to libraries
Re: Adding support for 16 channel PWM expansion to libraries
The default address is 0x40 for the Adafruit Servo Breakout board and 0x41 with A0 jumper soldered. So the board should work without any kind of modifications to it or the library then correct. Thanks for the input/help.
Re: Adding support for 16 channel PWM expansion to libraries
Quick update on this. The code all compiles and is in my github repo. I've pulled down the upstream stuff from Roberto and merged it all in. I'm going to load it on my RA+ tonight and see what it does over the next couple of days. One thing I discovered is that C++ doesn't like defined names to start with numbers, so I had to replace "16" with "SIXTEEN" everywhere, heh.
Also, Roberto, if you read this, if I changed the RA_Net size from 26 to 42 to accommodate 16 channels of dimming expansion in Globals.h will that break stuff?
Also, Roberto, if you read this, if I changed the RA_Net size from 26 to 42 to accommodate 16 channels of dimming expansion in Globals.h will that break stuff?
Re: Adding support for 16 channel PWM expansion to libraries
If you are going to provide complete compatibility for all 16 channels, there is a lot more to it than just the RANet size.
Anything related to PWM will need to be updated, including a few that pops my mind: PWM channels, PWM override, wifi xml, wifi json, RANet array, LCD screens and internal memory locations.
Anything related to PWM will need to be updated, including a few that pops my mind: PWM channels, PWM override, wifi xml, wifi json, RANet array, LCD screens and internal memory locations.
Roberto.
Re: Adding support for 16 channel PWM expansion to libraries
OK. Got PWM channels and PWM override already in. I added it in a few small spots of LCD screens variables and internal memory locations, but don't know exactly what I'm doing with those. Didn't do anything to RANet array or the wifi stuff. Will at least look at that.
Thanks.
Thanks.
Re: Adding support for 16 channel PWM expansion to libraries
What do you think would need to be stuck in the internal memory locations, by the way? I don't see much in there for the regular 6 channel PWM expansion.
Basically I'm finding places where the 6 channel one is referenced and defines for PWMEXPANSION and doing the same thing for the 16 channel one everywhere I can.
Basically I'm finding places where the 6 channel one is referenced and defines for PWMEXPANSION and doing the same thing for the 16 channel one everywhere I can.
Re: Adding support for 16 channel PWM expansion to libraries
Yes, the internal memory has 3 locations for each channel.
Code: Select all
#define Mem_B_PWMSlopeStart0 VarsStart+58
#define Mem_B_PWMSlopeEnd0 VarsStart+59
#define Mem_B_PWMSlopeDuration0 VarsStart+60
#define Mem_B_PWMSlopeStart1 VarsStart+61
#define Mem_B_PWMSlopeEnd1 VarsStart+62
#define Mem_B_PWMSlopeDuration1 VarsStart+63
#define Mem_B_PWMSlopeStart2 VarsStart+64
#define Mem_B_PWMSlopeEnd2 VarsStart+65
#define Mem_B_PWMSlopeDuration2 VarsStart+66
#define Mem_B_PWMSlopeStart3 VarsStart+67
#define Mem_B_PWMSlopeEnd3 VarsStart+68
#define Mem_B_PWMSlopeDuration3 VarsStart+69
#define Mem_B_PWMSlopeStart4 VarsStart+70
#define Mem_B_PWMSlopeEnd4 VarsStart+71
#define Mem_B_PWMSlopeDuration4 VarsStart+72
#define Mem_B_PWMSlopeStart5 VarsStart+73
#define Mem_B_PWMSlopeEnd5 VarsStart+74
#define Mem_B_PWMSlopeDuration5 VarsStart+75
Roberto.
Re: Adding support for 16 channel PWM expansion to libraries
Ah, right. I didn't make the connection that there were three for each channel.
Re: Adding support for 16 channel PWM expansion to libraries
These are in and seem to be working well for my custom dimming module. I submitted a pull request against /dev tonight after a few months of work off and on on various things that I considered to be prerequisites to making these work how I wanted them to work. They work in DCPump, PWM, with all of the overrides, and also report over Wifi.
They are currently in https://github.com/amunter/Libraries/tree/issue161 if someone wanted to download the .zip and play, but it should be in the dev branch soon, I imagine.
I recommend that if someone is really interested in seeing what this little controller can do they should take a crack at adding something to the code. I "get it" way more than I would have if I hadn't set out to add a feature and feel pretty confident now that I'll like what I get it to do. 8)
They are currently in https://github.com/amunter/Libraries/tree/issue161 if someone wanted to download the .zip and play, but it should be in the dev branch soon, I imagine.
I recommend that if someone is really interested in seeing what this little controller can do they should take a crack at adding something to the code. I "get it" way more than I would have if I hadn't set out to add a feature and feel pretty confident now that I'll like what I get it to do. 8)
Re: Adding support for 16 channel PWM expansion to libraries
Oh, and the cool thing is that binder already has it pretty much working in the Android app beta! Talk about service!
-
- Posts: 74
- Joined: Mon Aug 05, 2013 3:16 am
Re: Adding support for 16 channel PWM expansion to libraries
I would really love to have this. Is it completely up and running now? Can all 16 channels be addressed and be dimmed at 12 bit resolution? How can I purchase one and for how much?
THANKS!
THANKS!
Re: Adding support for 16 channel PWM expansion to libraries
12 bit resolution is in the dev libraries and working great. You now get full 8 bit resolution on the built-in ports and 12 bit on the current dimming modules. Some older ones may still he 8 bit. PM Roberto (rimai) to purchase a 16channel module.
Re: Adding support for 16 channel PWM expansion to libraries
Could someone post a guide on how to work the 12 bit dimming?
Thanks,
--Colin
Thanks,
--Colin
Re: Adding support for 16 channel PWM expansion to libraries
If your using InternalMemory you don't have to do anything. If your setting them manually with the parabola or slope functuons you can just add HighRes to the function name.
For set and get functions, just add Raw at the end.
For set and get functions, just add Raw at the end.
Re: Adding support for 16 channel PWM expansion to libraries
How does that work with the standard PWM ports? Still use PWMSlopeHighRes? How will it know the difference between, say, 50% and 50?
I guess the Portal and the RA Status app still use bytes to store the values for the PWM Expansion module? They're rolling over every 255.
Thanks,
--Colin
I guess the Portal and the RA Status app still use bytes to store the values for the PWM Expansion module? They're rolling over every 255.
Thanks,
--Colin
Re: Adding support for 16 channel PWM expansion to libraries
Yes GetValue() and the portal will get the byte value. But if you want to write a high res number then you'd use SetDaylightRaw(). Then when it writes it will scale it down to 0-255. The HighRes functions all output 0-4095 (12 bit range)
Re: Adding support for 16 channel PWM expansion to libraries
Disregard the second half of my previous statement. I was doing it wrong.
Got it running, but I've noticed I can't dim below a raw value of 21 with my LDD drivers. At 20 they shut off. Hardware limitation or software issue?
--Colin
Got it running, but I've noticed I can't dim below a raw value of 21 with my LDD drivers. At 20 they shut off. Hardware limitation or software issue?
--Colin
Re: Adding support for 16 channel PWM expansion to libraries
Thats pretty damn good. All drivers need some amount of voltage in order to get going. The LDDs are low for sure. 21 is like .005v
Re: Adding support for 16 channel PWM expansion to libraries
Yeah, I think that is the minimum that your driver will take, which is pretty good in my opinion.
How does the LED look at 21?
How does the LED look at 21?
Roberto.
Re: Adding support for 16 channel PWM expansion to libraries
A little too bright for a moonlight, but I have 40 LED's on that channel.
--Colin
--Colin
Re: Adding support for 16 channel PWM expansion to libraries
Cool. I've never driven mine down that low on purpose, but I should try with some Raw commands. I know I used to do a slope from 0% to 3% over 3 hours using HiRes functions and it was really really dim at first. I don't know what the raw value was, though.
I owe Roberto a users guide to how the new dimming stuff works and how you'd access it if you wanted to get to it from the .ino file.
I owe Roberto a users guide to how the new dimming stuff works and how you'd access it if you wanted to get to it from the .ino file.
Re: Adding support for 16 channel PWM expansion to libraries
OK, so I've figured out that this really isn't a raw value of 21. I'm using the RANet dimming module which works off of an 8 bit value scaled up to 12 bits (multiplied by 40.95). So 21 is probably the break point between 0 and 1%.cosmith71 wrote:Disregard the second half of my previous statement. I was doing it wrong.
Got it running, but I've noticed I can't dim below a raw value of 21 with my LDD drivers. At 20 they shut off. Hardware limitation or software issue?
--Colin
What I'd like to do is use the bytes in the RANet packet normally used for the 16 channel dimmer for some sweet 12 bit dimming action.
What would be the best way, with a 6 channel dimming module defined, to send along some 16 channel data? I think plucking it out on the RANet receiver side would be easy enough. From what I've seen, you can have a 6 or a 16, but not both.
Maybe just define as a 16 channel and re-write the receiver code to translate to 6 channels?
--Colin
Re: Adding support for 16 channel PWM expansion to libraries
Damn... You are digging it deep huh? I like it.
I doubt this is the case.
21 in the RANet packet is really 21%.
Just to make sure we are talking about the same number, go to your dimming channels in your RA and look at the % for that channel.
Is it 21% or 1%?
I doubt this is the case.
21 in the RANet packet is really 21%.
Just to make sure we are talking about the same number, go to your dimming channels in your RA and look at the % for that channel.
Is it 21% or 1%?
Roberto.
Re: Adding support for 16 channel PWM expansion to libraries
It's 1%. But I'm writing a raw value of 21, which I'm guessing is converted to 1%, sent to the RANet receiver, which then converts it to 1*40.95 and sends it on to the dimming module, right? So my end result is a raw value of 40.
--Colin
--Colin
Re: Adding support for 16 channel PWM expansion to libraries
Yeap. You are correct then.
I think the only way we will be able to achieve this is to make the RANet payload bigger and send int values instead of byte values.
Can you open an issue in the github?
I think the only way we will be able to achieve this is to make the RANet payload bigger and send int values instead of byte values.
Can you open an issue in the github?
Roberto.
Re: Adding support for 16 channel PWM expansion to libraries
Done.
Isn't an int 4 bytes? We only really need 2 (or even 1.5). Not sure how big the payload can be.
--Colin
Isn't an int 4 bytes? We only really need 2 (or even 1.5). Not sure how big the payload can be.
--Colin
Re: Adding support for 16 channel PWM expansion to libraries
Doh! I misread. Of course it is.
Re: Adding support for 16 channel PWM expansion to libraries
I did a little work on this, and got GitHub working.
Something is still wrong. I changed the payload to 68 bytes to accommodate 2 bytes for each expansion dimming and 16 channel expansion dimming and changed the RANet receiver software to read it. None of the channels are working as expected and I'm not really sure how to debug it.
My repositories are cosmith71/Libraries and cosmith71/RANet-Reciever. Not sure if that is what you need to find them?
Thanks,
--Colin
Something is still wrong. I changed the payload to 68 bytes to accommodate 2 bytes for each expansion dimming and 16 channel expansion dimming and changed the RANet receiver software to read it. None of the channels are working as expected and I'm not really sure how to debug it.
My repositories are cosmith71/Libraries and cosmith71/RANet-Reciever. Not sure if that is what you need to find them?
Thanks,
--Colin
Re: Adding support for 16 channel PWM expansion to libraries
Thanks. Made a couple of changes this morning, but still not correct. I'm wondering if I have my MSB's and LSB's reversed some how.
--Colin
--Colin