Time for additional Ethernet add-on with PWM output

Expansion modules and attachments
User avatar
DrewPalmer04
Posts: 818
Joined: Tue May 29, 2012 2:12 pm
Location: Christopher, IL

Re: Time for additional Ethernet add-on with PWM output

Post by DrewPalmer04 »

Yep. Time is correct. I have it syncing only once a day now too.
Out for now...but not over.

VISIT: Ethernet Module/Wifi Alternative
User avatar
DrewPalmer04
Posts: 818
Joined: Tue May 29, 2012 2:12 pm
Location: Christopher, IL

Re: Time for additional Ethernet add-on with PWM output

Post by DrewPalmer04 »

Could the milli() in the Ethernet side of the code you provided me be using up all of my RAM?
Out for now...but not over.

VISIT: Ethernet Module/Wifi Alternative
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Time for additional Ethernet add-on with PWM output

Post by rimai »

millis() is a unsigned long variable size, which means it only consumes 4 bytes.
Roberto.
User avatar
DrewPalmer04
Posts: 818
Joined: Tue May 29, 2012 2:12 pm
Location: Christopher, IL

Re: Time for additional Ethernet add-on with PWM output

Post by DrewPalmer04 »

Hmm. Any other thoughts?
Out for now...but not over.

VISIT: Ethernet Module/Wifi Alternative
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Time for additional Ethernet add-on with PWM output

Post by rimai »

Serial.print is your friend....
Debugging is part of coding :)
Roberto.
User avatar
DrewPalmer04
Posts: 818
Joined: Tue May 29, 2012 2:12 pm
Location: Christopher, IL

Re: Time for additional Ethernet add-on with PWM output

Post by DrewPalmer04 »

Haha ok. I'll work on it more.
Out for now...but not over.

VISIT: Ethernet Module/Wifi Alternative
User avatar
DrewPalmer04
Posts: 818
Joined: Tue May 29, 2012 2:12 pm
Location: Christopher, IL

Re: Time for additional Ethernet add-on with PWM output

Post by DrewPalmer04 »

Maybe you can help me talk through this. The PWM is sapzing but I have full control from the iPhone app. This would mean the issue is in the PWM part of the code?
Out for now...but not over.

VISIT: Ethernet Module/Wifi Alternative
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Time for additional Ethernet add-on with PWM output

Post by rimai »

Yeah, I think it is in your PWM section of your code.
Here is what I would suggest:
No more than 1 analogWrite() per channel. I see you have several instances of it.
Change the global variable (blue1,white1,blue2,white2) and apply it at the end of the loop by calling the analogWrite().
This way, you can Serial.print what you are sending and know exactly what is going on.
Roberto.
User avatar
DrewPalmer04
Posts: 818
Joined: Tue May 29, 2012 2:12 pm
Location: Christopher, IL

Re: Time for additional Ethernet add-on with PWM output

Post by DrewPalmer04 »

Thanks very much for that help :)

Before I had byte sec min etc. then getDS1307RTC for every section of fade in. Then fade out etc. I had it all sectioned off. But now the code is all connected by dayMinute (hour() * 60 + minute()). I think this is getting confused because its not sectioned like it was before.
Out for now...but not over.

VISIT: Ethernet Module/Wifi Alternative
User avatar
DrewPalmer04
Posts: 818
Joined: Tue May 29, 2012 2:12 pm
Location: Christopher, IL

Re: Time for additional Ethernet add-on with PWM output

Post by DrewPalmer04 »

Moonrise confirmed working. Must be in other part of code.
Fade in confirmed working.
Out for now...but not over.

VISIT: Ethernet Module/Wifi Alternative
User avatar
DrewPalmer04
Posts: 818
Joined: Tue May 29, 2012 2:12 pm
Location: Christopher, IL

Re: Time for additional Ethernet add-on with PWM output

Post by DrewPalmer04 »

Issue is in fade out...trying to narrow it down...all other modes are working perfectly.
Out for now...but not over.

VISIT: Ethernet Module/Wifi Alternative
User avatar
DrewPalmer04
Posts: 818
Joined: Tue May 29, 2012 2:12 pm
Location: Christopher, IL

Re: Time for additional Ethernet add-on with PWM output

Post by DrewPalmer04 »

Baffled by the fade out. It looks good to me but im crossed eyed lol. Can anyone spot anything wrong in "fade out?" :(
Out for now...but not over.

VISIT: Ethernet Module/Wifi Alternative
User avatar
DrewPalmer04
Posts: 818
Joined: Tue May 29, 2012 2:12 pm
Location: Christopher, IL

Re: Time for additional Ethernet add-on with PWM output

Post by DrewPalmer04 »

I believe I'll re build this using the Time library. This way it will calculate everything based on time frames instead of long formulations. I may be able to simplify the code this way and have it better partitioned in periods of time instead of a large loop. Thoughts?
Out for now...but not over.

VISIT: Ethernet Module/Wifi Alternative
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Time for additional Ethernet add-on with PWM output

Post by lnevo »

Sounds like a good plan.

The opposition would sound like this...

"I think i should continue banging my head against the wall and continue trying to troubleshoot the ntp, read rtc, glob of code thats been driving me crazy..."
User avatar
DrewPalmer04
Posts: 818
Joined: Tue May 29, 2012 2:12 pm
Location: Christopher, IL

Re: Time for additional Ethernet add-on with PWM output

Post by DrewPalmer04 »

Lol I built it originally with RTC in mind which didn't utilize Time.h but now I'm using NTP. So I'm going to scrap my old code and start fresh with the Time library.
Out for now...but not over.

VISIT: Ethernet Module/Wifi Alternative
User avatar
DrewPalmer04
Posts: 818
Joined: Tue May 29, 2012 2:12 pm
Location: Christopher, IL

Re: Time for additional Ethernet add-on with PWM output

Post by DrewPalmer04 »

I like to think that I've saved someone out there a lot of time by NOT recommending trying to hook into RA RTC. It doesn't like to be read. Lol I never tried master, slave config but save yourself time and just use NTP
Out for now...but not over.

VISIT: Ethernet Module/Wifi Alternative
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Time for additional Ethernet add-on with PWM output

Post by rimai »

Hum...
Both RTC and NTP routes use the same Time library....
I'm not sure why you have problems, but the dimming module shares the same RTC with RA and the dimming module can read RTC just fine.
That's how the dimming module syncs in time. It reads the RA RTC on start-up and resyncs every hour.
In either cases, why not just use the RA libraries for your ethernet board?
Or at least just copy the PWMSlope function from Globals and use it instead of trying to recreate the wheel.
Roberto.
User avatar
DrewPalmer04
Posts: 818
Joined: Tue May 29, 2012 2:12 pm
Location: Christopher, IL

Re: Time for additional Ethernet add-on with PWM output

Post by DrewPalmer04 »

That's a good point. I can do that IF I figure out how to read the internal memory of the controller. I know it's possible because the serial pinout allows for Tx Rx but I just don't know how to do this. The issue lies in the lack of my experience and "trying" to make a PWMslope with what knowledge I have :( if you could guide me in how to read the internal memory with my ethernet board I could try and make this happen :)
Out for now...but not over.

VISIT: Ethernet Module/Wifi Alternative
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Time for additional Ethernet add-on with PWM output

Post by rimai »

Why do you need internal memory?
Use hard code values:

Code: Select all

blue1=PWMSlope(10,0,21,0,0,100,60,0);
Roberto.
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Time for additional Ethernet add-on with PWM output

Post by rimai »

Actually, since you are using the whole range, you need this:

Code: Select all

blue1=PWMSlope(10,0,21,0,0,255,60,0);
Roberto.
User avatar
DrewPalmer04
Posts: 818
Joined: Tue May 29, 2012 2:12 pm
Location: Christopher, IL

Re: Time for additional Ethernet add-on with PWM output

Post by DrewPalmer04 »

Ohhh hard code it. Well I'll take the blame on not thinking about that. Duh! Much appreciated Roberto
Out for now...but not over.

VISIT: Ethernet Module/Wifi Alternative
User avatar
DrewPalmer04
Posts: 818
Joined: Tue May 29, 2012 2:12 pm
Location: Christopher, IL

Re: Time for additional Ethernet add-on with PWM output

Post by DrewPalmer04 »

When I attempt to use Globals.h for PWMSlope:

I get:
In file included from messwiththis.ino:5:
/Users/apalmer/Documents/Arduino/libraries/Globals/Globals.h:883: error: 'OneWire' does not name a type

I add OneWire.h

Get this:










core.a(new.cpp.o): In function `__cxa_guard_acquire':
/Users/apalmer/Desktop/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino/new.cpp:13: multiple definition of `__cxa_guard_acquire'
Globals/Globals.cpp.o:/Users/apalmer/Documents/Arduino/libraries/Globals/Globals.cpp:209: first defined here
core.a(new.cpp.o): In function `__cxa_guard_release':
/Users/apalmer/Desktop/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino/new.cpp:14: multiple definition of `__cxa_guard_release'
Globals/Globals.cpp.o:/Users/apalmer/Documents/Arduino/libraries/Globals/Globals.cpp:210: first defined here
core.a(new.cpp.o): In function `__cxa_guard_abort':
/Users/apalmer/Desktop/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino/new.cpp:15: multiple definition of `__cxa_guard_abort'
Globals/Globals.cpp.o:/Users/apalmer/Documents/Arduino/libraries/Globals/Globals.cpp:211: first defined here
core.a(new.cpp.o): In function `__cxa_pure_virtual':
/Users/apalmer/Desktop/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino/new.cpp:17: multiple definition of `__cxa_pure_virtual'
Globals/Globals.cpp.o:/Users/apalmer/Documents/Arduino/libraries/Globals/Globals.cpp:207: first defined here
Out for now...but not over.

VISIT: Ethernet Module/Wifi Alternative
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Time for additional Ethernet add-on with PWM output

Post by rimai »

You have to either use all of the RA libraries or copy the PWMSlope function into your code.
Roberto.
User avatar
DrewPalmer04
Posts: 818
Joined: Tue May 29, 2012 2:12 pm
Location: Christopher, IL

Re: Time for additional Ethernet add-on with PWM output

Post by DrewPalmer04 »

Thanks got it...just copied the code instead of all the entire library!
Out for now...but not over.

VISIT: Ethernet Module/Wifi Alternative
User avatar
DrewPalmer04
Posts: 818
Joined: Tue May 29, 2012 2:12 pm
Location: Christopher, IL

Re: Time for additional Ethernet add-on with PWM output

Post by DrewPalmer04 »

It's working great. I'll be the first to admit. I was reinventing the wheel. :( updates to
Come soon
Out for now...but not over.

VISIT: Ethernet Module/Wifi Alternative
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Time for additional Ethernet add-on with PWM output

Post by lnevo »

Awesome! How many PWM ports does that board have?
User avatar
DrewPalmer04
Posts: 818
Joined: Tue May 29, 2012 2:12 pm
Location: Christopher, IL

Re: Time for additional Ethernet add-on with PWM output

Post by DrewPalmer04 »

Out for now...but not over.

VISIT: Ethernet Module/Wifi Alternative
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Time for additional Ethernet add-on with PWM output

Post by lnevo »

Sorry, I'm electronically inept...does that mean 4 channels or 2?
User avatar
DrewPalmer04
Posts: 818
Joined: Tue May 29, 2012 2:12 pm
Location: Christopher, IL

Re: Time for additional Ethernet add-on with PWM output

Post by DrewPalmer04 »

Four channels :) there are a lot of different Ethernet boards. So I supplied the link.
Out for now...but not over.

VISIT: Ethernet Module/Wifi Alternative
User avatar
DrewPalmer04
Posts: 818
Joined: Tue May 29, 2012 2:12 pm
Location: Christopher, IL

Re: Time for additional Ethernet add-on with PWM output

Post by DrewPalmer04 »

lnevo wrote:Sorry, I'm electronically inept...does that mean 4 channels or 2?

Should have also mentioned that it's NOT boosted. Meaning anyone thinking about doing this youll only output about 5v instead of 10v for most drivers. Keep that in mind if you want 100% brightness. This, as is, will only supply roughly 50% brightness without boosting the output of the PWM pins
Out for now...but not over.

VISIT: Ethernet Module/Wifi Alternative
Post Reply