The Planted Tank Forum - Reply to Topic

Thread: Improved Arduino LED lighting code Reply to Thread
Title:
Message:
Trackback:
Send Trackbacks to (Separate multiple URLs with spaces) :
Post Icons
You may choose an icon for your message from the following list:
 

Register Now



In order to be able to post messages on the The Planted Tank Forum forums, you must first register.
Please enter your desired user name, your email address and other required details in the form below.

User Name:
Password
Please enter a password for your user account. Note that passwords are case-sensitive.

Password:


Confirm Password:
Email Address
Please enter a valid email address for yourself.

Email Address:
OR

Log-in









Human Verification

In order to verify that you are a human and not a spam bot, please enter the answer into the following box below based on the instructions contained in the graphic.



  Additional Options
Miscellaneous Options

  Topic Review (Newest First)
Today 03:18 AM
Arun.
how to change PWM frequency from 150hz to 2Khz ?

how to change PWM frequency ?
should I edit TimerOne library or changeTimer1.initialize(6666) to some higher value / lower value ?
Code:
void setup() {
  Serial.begin(115200); // Max for Arduino Uno
  setSyncProvider(RTC.get);
  Timer1.initialize(6666); // 150Hz PWM
  pinMode(kChan0Pin, OUTPUT);     
  Timer1.pwm(kChan0Pin, 0);
  pinMode(kChan1Pin, OUTPUT);     
  Timer1.pwm(kChan1Pin, 0);
}
Thanks.
04-08-2016 08:08 PM
pjayyy Hi, I used the code from the first page.

I uploaded it on a Arduino Nano microUSB v3 168.

My problem is, the light doesnt dim on estimated time, it switches the light hard on/off. The timer works right, but it simply doesnt dim on time. After switching on the arduino first the light is at 1024 and after 2 seconds (the loop begins) I see it does dimm to my selected value (900). So thats right. But it doesn't dim on time.

what can be the fault?

wiring:
PWM to Arduino Pin Digital 9
VPin 12V
simple led stripe 50cm long powered by the pwm controller.


My PWM Controller is this:
3W 700mA DC DC 7.0 30V to 1.2 28V LED lamp Driver Support PWM Dimmer-in Other Electronic Components from Electronic Components & Supplies on Aliexpress.com | Alibaba Group
02-22-2016 11:54 PM
salty joe Thanks ichy for that reply.
I did manage to get the libraries installed. It took me a real long time, but it's done.

I am using Arduino 1.6.7. What is SDK?

Post 39 in this thread has a download for Python that gets the RTC 3231 set. I downloaded the Python program but when I try to install Pserial, it finds Python version 2.7 so I click 'next'. Says it's ready to install so I click 'next'. I get an error that says 'could not create key'. I click OK. Another error that says 'could not set key value'. I say OK, then another 'could not set key value'. I click OK then it says it loads. But I can't get it to set the time on this sketch.

I've spent hours trying to get this Pserial to work-IDK if it's an issue with my computer or what.

Anyway, is it possible to manually set the time on this sketch?
02-22-2016 12:20 AM
ichy
Quote:
Originally Posted by salty joe View Post
I've been looking around for awhile for a sketch like this-this is perfect but I can't get it loaded on my Arduino Uno.

I downloaded the latest version and library bundle from sink's first post to my computer. I have the 3231 timer so I deleted the 1307 from the library bundle.

On Arduino 1.6.7, I went to Sketch, Include Library, then Add .Zip Library. When I select the libraries folder and click 'open' then click 'open' again, I get the error 'A subfolder of your sketchbook is not a valid library'.

If anyone is willing to help me get this sorted out, it would be very much appreciated.
You have to UNZIP the library folder. Once done unzipping, there should a be folder inside the unzipped folder. Copy the entire folder, not individual files..into the Library folder for your Arduino SDK installation.

If it is installed correctly you can select it from the Add Library menu.
If the library has examples you can open a sample Sketch from the EXAMPLES menu and it will compile if correctly installed.
02-21-2016 09:02 PM
salty joe Just for the heck of it I'm gonna take another stab at this thread.

After much head scratching/pounding I got sink's sketch and the libraries installed on the Arduino program and it compiles. Yes! Thank you sink for putting that out there-that's very generous.

I downloaded the Python program from post 39 but Pserial has become problematic. I have the RTC 3231. It was mentioned in this thread that daylight savings time could be adjusted for manually.

Can the time and date be added manually? If so, can anyone please get me headed in the right direction? I put the time and date a couple places where I thought it might belong and downloaded a few times, but nothing. So I returned the sketch to original. I watched a bunch of YouTube videos on the 3231-no help there. So close, but so far away. Honestly, just knowing if it's possible to add time and date manually with this sketch would be helpful.

Anybody? Please?
02-18-2016 12:04 PM
salty joe I've been looking around for awhile for a sketch like this-this is perfect but I can't get it loaded on my Arduino Uno.

I downloaded the latest version and library bundle from sink's first post to my computer. I have the 3231 timer so I deleted the 1307 from the library bundle.

On Arduino 1.6.7, I went to Sketch, Include Library, then Add .Zip Library. When I select the libraries folder and click 'open' then click 'open' again, I get the error 'A subfolder of your sketchbook is not a valid library'.

If anyone is willing to help me get this sorted out, it would be very much appreciated.
05-31-2015 07:24 PM
MrSpiffy Any recommendations on cooling fans that will work with Arduino PWM? I noticed it's in the code, but it will not control the fans I purchased (Arctic F8 PWM). Looking for some suggestions.
04-26-2015 01:57 PM
Gisimo
help

i found the mistakes and now it is working
04-23-2015 06:52 PM
kman ^^ Arduino has updated their software from 1.0.6 to 1.6.3 or something like that, and there are a LOT of sketches that won't compile correctly until the new version without making changes. You might want to try the previous software version and see if that helps. The old versions are still available on the Arduino.cc website.
04-23-2015 12:20 PM
Gisimo
help

hi guys im trying to make lights for my aquarium but this time i am going to use a hc-05 eller 06 bluetooth. i have triet the code for arduino 1.0 but it dosent work(it wont compile) so i tried the origional one but i cant get it to work with 1.0!!! is there one of you here who have the original code but for 1.0??(without lcd,fan ect)
The resen is the Arduino 0022 dont se the bluetooth com port... if you no of a way to get the 0022 to find the com-port please tell
03-20-2015 04:02 AM
MrSpiffy Looks like the common ground was my problem. The dining works at night. Haven't gotten to test the sunrise portion, yet. Perhaps it's also the issue with the fans..?
03-18-2015 10:21 PM
MrSpiffy Those are all great to know. Thanks for sharing! However, it doesn't address the concern of joining the ground pin of the Arduino to the ground pin of the PSU for the LEDs.
03-18-2015 09:59 PM
kman http://www.ruggedcircuits.com/10-way...oy-an-arduino/
03-18-2015 09:56 PM
MrSpiffy I'm using a separate power supply for the Arduino via micro-USB. That should be a standard 5V supply.

I was referring to protecting the Arduino from connections to the 24V LED supply, even via ground. Sounds like some people had heard from a guy who heard from another guy that you can fry your Arduino by doing that. I'm guessing that's just mumbo jumbo.
03-18-2015 06:02 PM
O2surplus
Quote:
Originally Posted by MrSpiffy View Post
Yeah, there's definitely been a learning curve with the Arduino. But it's been interesting, despite the frustration.

I read somewhere that some people recommend a resistor or diode, or some other method, to protect the Arduino unit from the PSU power. Is that something you've found to be necessary, as well?
The Arduino's on board regulator tends to overheat, if it's forced to drop too much voltage. I don't recommend powering the Arduino with more than 12V. Using 7 to 9V is optimal.
This thread has more than 15 replies. Click here to review the whole thread.

Posting Rules  
You may post new threads
You may post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

 
For the best viewing experience please update your browser to Google Chrome