DS1307 and PWM problems

Post here to let others know of a project you're working on.

Moderators: Chuckt, Garth, bitfogav

Post Reply [phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable
User avatar
Saimaster13
I practically live here!
I practically live here!
Posts: 176
Joined: Mon Aug 13, 2012 4:23 am
Location: Sarasota, Florida
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

DS1307 and PWM problems

Post by Saimaster13 » Sat Dec 08, 2012 3:16 am

I made a clock with a lot of components crammed on a protoboard: an Arduino, DS1307, piezo buzzer, 2 buttons, 1 potentiometer, 1 red LED controlled by PWM, 4 RGB LEDs connected together each color being controlled by pwm, and 3 two digit seven segment displays being driven by 2 '595 shift registers.

Everything works fine unless one or more colors of the RGB lights is using pwm (the analogWrite function) and the Arduino is asking the RTC for data (DateTime now = RTC.now();) .

The red LED using pwm does not mess up the clock.

When an RGB pwm function and the RTC are both being run, the RGBs sometimes flash at random and some of the segments of the 7 segment displays flash at random too (random segments at random times when they are not supposed to light up) and at a random time the RGB lights freeze in place and the LED display turns off. (I had the Arduino send the computer Serial data, but when the Arduino messes up like that, it stops sending Serial data {freezes completely}).

If the RGB LEDs are set to HIGH or LOW when the DateTime now = RTC.now(); function is used, there is no problem.




Any idea of what could be the problem? I was thinking I should put some 0.1uf caps between the +5V and ground especially near the RTC to filter out any noise made by the pwm function.
Joshua

User avatar
brad
Site Admin
Site Admin
Posts: 2578
Joined: Fri Mar 26, 2010 10:30 pm
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: DS1307 and PWM problems

Post by brad » Sun Dec 09, 2012 9:33 pm

I was also thinking about caps. Although it might be one of those really annoying - hard to figure out problems that might require you to delve into the include files to solve the issue.

Perhaps your first port of call is how the Arduino PWM functions perform their operation.

Have you tried letting it run the code but have the LED's disconnected to see if the fault is still there? This would most probably rule out a hardware issue.

User avatar
bitfogav
Moderator
Moderator
Posts: 915
Joined: Sun Mar 28, 2010 9:03 pm
Location: United Kingdom
Contact:

Re: DS1307 and PWM problems

Post by bitfogav » Sun Dec 09, 2012 10:16 pm

I would always use 0.1uF bypass cap near the power pins regardless. And like Brad as pointed out your might have to look into what the included files are doing to the port pins.

When an RGB pwm function and the RTC are both being run, the RGBs sometimes flash at random and some of the segments of the 7 segment displays flash at random too
The other thing I was thinking, are the RGB leds using interrupts? So when the data is being sent to the RTC the data is getting corrupted because the Interrupt is triggering half way through a RTC data output?. (just an idea).
If you don't know what Voltage your country is using, you shouldn't be doing electronics ;-)

User avatar
brad
Site Admin
Site Admin
Posts: 2578
Joined: Fri Mar 26, 2010 10:30 pm
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: DS1307 and PWM problems

Post by brad » Mon Dec 10, 2012 5:37 am

Good point bitfogav, interrupts can certainly ruin your day if you don't backup your variables!

Post Reply
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Who is online

Users browsing this forum: No registered users and 3 guests