Computerized Nano, Mark II (LED Dimming 2-27-11) - Page 3
Planted Tank Forums
Your Tanks Image Hosting *Tank Tracker * Plant Profiles Fish Profiles Planted Tank Guide Photo Gallery Articles

Go Back   The Planted Tank Forum > Specific Aspects of a Planted Tank > DIY


Reply
 
Thread Tools Display Modes
Old 02-26-2011, 05:34 AM   #31
Robotguy
Planted Member
 
Robotguy's Avatar
 
PTrader: (4/100%)
Join Date: Jan 2010
Location: Sacramento, CA
Posts: 250
Default

Quote:
Originally Posted by Arctangent View Post
Very cool.
Thanks!

Quote:
Originally Posted by Arctangent View Post
I'm just now really getting into communications (wanting to do 802.11 too)
I love the idea of being able to connect without wires, but I am not really impressed with the WiFly. Granted it is an older, discontinued, model but I can't seem to keep it connected to the access point. Hopefully I just need to fiddle with the settings. It basically does telnet to serial, so I plan to do some CGI scripting on a Linux box I keep running as a server for my own access, and FTP a read only page to robotguy.net for public viewing.

Quote:
Originally Posted by Arctangent View Post
How do you plan to waterproof your DS18B20?
Good question. I'm thinking maybe casting it in a bit of Clear-Lite although I did manage to waterproof an LED for my volcano by coating the wire side with a dab of silicone and shoving it in some silicone air tubing. The wires ran through the tubing and out of the tank.

Quote:
Originally Posted by mistergreen View Post
1. They look like a combo regulator & needle valve. the 88 come with a bubble counter which is important to have.
2. They come with diffusers so you might not need the GLA diffuser. yeah, it should work in the filter.
3. How big is this tank? 2-3Gallons? 50W is a bit much. 10-15W should be perfect and smaller. From touching a heater while it's on, I'd say it's on around 150F - 200F. If plastic doesn't melt that that temperature, it should be fine.
Great! Thanks for the info. It's 3.5 gallons, so something like a Hydor mini would work? I love that they can run dry, just case...
__________________
Robotguy is offline   Reply With Quote
Sponsored Links
Advertisement
 
Old 02-27-2011, 02:03 AM   #32
Robotguy
Planted Member
 
Robotguy's Avatar
 
PTrader: (4/100%)
Join Date: Jan 2010
Location: Sacramento, CA
Posts: 250
Default

A bit of progress on the physical side. For some reason I am putting off the LED dimming setup, I'm not really sure why. My goal though is to have it done tomorrow. I am waiting for the glue to dry on my custom acrylic PCB standoffs right now.

Well here are the lights:


And mounted on the tank:




From the back:


Yes, that is a tutu behind the tank. While I'm out in the garage cutting and drilling, my wife is at the kitchen table snipping and sewing a tutu for my ballerina daughter. We're birds of a feather, hers are just a lot prettier and more frilly than mine
__________________
Robotguy is offline   Reply With Quote
Old 02-27-2011, 10:18 PM   #33
Arctangent
Algae Grower
 
PTrader: (0/0%)
Join Date: Feb 2010
Location: College Station, TX
Posts: 73
Default

I thought about using silicon of some sort too, but I'm worry about the thermal resistance being too high. I just don't know if it would be responsive enough to control a heater accurately. Hmmmmm, may look into Clear-Lite. Thanks.
Arctangent is offline   Reply With Quote
Old 02-28-2011, 05:20 AM   #34
Robotguy
Planted Member
 
Robotguy's Avatar
 
PTrader: (4/100%)
Join Date: Jan 2010
Location: Sacramento, CA
Posts: 250
Default

Quote:
Originally Posted by Arctangent View Post
I thought about using silicon of some sort too, but I'm worry about the thermal resistance being too high. I just don't know if it would be responsive enough to control a heater accurately. Hmmmmm, may look into Clear-Lite. Thanks.
I plan to leave most of the body of the device bare and just cover the leads with silicone in order to get a quicker response.

Actually, you know what works really well? A layer of Liquid Electrical Tape covered by a layer of GOOD electrical tape the self amalgamating type. The good stuff is expensive, but once you try it, vinyl electrical tape seems really cheesy. We use this method at work to splice cables that are rated for full ocean depth!



I finally got some PWM dimming going on. For some reason I had to force myself to get past this part, and I kept finding myself Yak Shaving. But now I have the PCB mounted in the tank, all three LED channels wired up on the PCB, and one channel with a completed driver and programming. The other two will be a snap.

As for the driver, I have found that a feedback resistance of 0.33 Ohms (three 1 Ohm resistors in parallel) will give me 750mA of drive current, so that's what I will get at full brightness. Here's the PCB (Man, this looks ugly magnified this much. I really need to clean the flux. ):


Pulling pin 2 above 2.0 volts enables the driver, below 0.8V will turn it off. Just keep it below VCC, but since max VCC is 23V, that shouldn't be too hard. I wired this to one of the output compare pins (3.3v) on my microcontroller. This allows me to do PWM in hardware and take the burden off of the processor.

Here's a gratuitous shot of the back of my PCB:


I built some acrylic standoffs to mount the PCBs in the rear of the tank without having to drill any holes.


I connected the standoffs loosely to the PCBs, put a dab of Weld-On 16 on each of them, then mounted the PCBs into the electronics section of the tank:


The adhesive doesn't take too long to dry so I cleaned up a little, ate dinner, then dragged the whole thing into the living room to do a little programming. In this shot you can see the Wifly that I am using to communicate with the board:


And, final result:
http://www.youtube.com/watch?v=TZ4AfE_G17Y

It actually works a little better than that, but it's hard to tell because of the auto-iris on the video camera. Not a whole lot better though since the PWM is linear, the light output is somewhat logarithmic, and our eyes respond according to a power law. I may grab the light meter at some point and graph lumens/PAR versus PWM duty cycle.

Here's the meat of the code if anyone is interested:
Code:
                OCR1AL=i; //set the PWM register
		if(i%10==0){ //print an update at multiples of 10
			printf_P(PSTR("Setting PWM to "));
			printf("%u\n",i);
		}
		i+=dir;
		if(i==255) dir=-1; //we hit the top, start counting down
		if(i==0) dir=1; //we hit the bottom, start counting up
		_delay_ms(20);
I am getting close to being able to fill this sucker up. Well, if I decide to fill it up. I am considering a dry-start HC carpet. I'm not sure if I have enough patience for that, though. Maybe I can do a context switch and work on the peristaltic pump for a while. Or my latest idea; The Marimo Factory, a circular nano with enough current to keep the little algae balls racing each other in circles all day long. I picked up a Marimo ball today and am quite enchanted with it.
__________________
Robotguy is offline   Reply With Quote
Old 02-28-2011, 02:23 PM   #35
JACimages
Algae Grower
 
JACimages's Avatar
 
PTrader: (0/0%)
Join Date: Jan 2011
Location: Santa Clarita,CA
Posts: 115
Default

this is so nerdy it hurts my brain
__________________
my Fluval Edge **SOLD**
Mr Aqua 11.4 **coming soon to a thread near you**
i have the BUG!
JACimages is offline   Reply With Quote
Old 02-28-2011, 07:38 PM   #36
Arctangent
Algae Grower
 
PTrader: (0/0%)
Join Date: Feb 2010
Location: College Station, TX
Posts: 73
Default

Lol @ toccata...it's alive. You get 'cool nerd' points for showing duty cycle on your oscilloscope!

Quote:
Originally Posted by Robotguy View Post
I wired this to one of the output compare pins (3.3v) on my microcontroller. This allows me to do PWM in hardware and take the burden off of the processor.
Can you elaborate on this? The processor is not timing the PWM?

The code you wrote was just an experimental fade up/down right? How do you plan on controling the value in practice? I was just gonna read/write a ref voltage across a pot.

Also, are you just using the three LEDs? What kind are they? Is that going to be enough to grow anything?

This is so cool, I can't wait to get started on mine. Just gotta wait for parts and free time...maybe spring break.
Arctangent is offline   Reply With Quote
Old 02-28-2011, 08:17 PM   #37
Robotguy
Planted Member
 
Robotguy's Avatar
 
PTrader: (4/100%)
Join Date: Jan 2010
Location: Sacramento, CA
Posts: 250
Default

Quote:
Originally Posted by Arctangent View Post
The code you wrote was just an experimental fade up/down right? How do you plan on controling the value in practice? I was just gonna read/write a ref voltage across a pot.
Yes, that was just a simple demo. I will eventually run the LEDs, and everything else, from timers and serial commands using the protocol mentioned in one of my previous posts.


Quote:
Originally Posted by Arctangent View Post
Can you elaborate on this? The processor is not timing the PWM?
Well, the processor is timing the PWM, but since it's done in hardware the firmware doesn't have to take care of every cycle. I'll describe a bit of PWM theory too, in case anyone's interested.

WARNING, SERIOUS GEEK DETAILS TO FOLLOW!!!!!

There is a timer (TIMER1) inside the chip that constantly counts from 0 to 255 then rolls over and starts again. Every time it rolls overs, it sets the output compare pin to a logic 1 (3.3v). Then when the timer value matches the value in OCR1A (Output Compare Register 1A), it sets the pin low (0v). So to set the LED to a certain dim level, say 50%, I set OCR1A to 128 (256*50%=128. 0-128 is on, 129-255 is off). That's it. No more code required, no interrupts. The firmware can go off and do anything else it wants and the hardware timer handles the set and reset 120 times a second (or a lot faster. I have the timer running at 1/256th speed because I don't want to interfere with the driver switching frequency which is 330kHz). Then later when a command comes in to set the dim level to 75%, I just set OCR1A to (256*75%=192. 0-192 is on, 193-255 is off) and then return to whatever I was doing before. Since the timer counts higher before turning the LED off, it is on for a larger percentage of the time and appears brighter. The microcontroller I am using has 3 output compare registers that run from TIMER1, so I can use OCR1A, OCR1B and OCR1C to drive my three LED channels.

If the chip didn't have hardware PWM, I could do a loop that looks something like this:

Code:
if(count==0) then set output high;
if(count==DimLevel) then set output low;
increment count;
if(count==Max) then count=0;
But if I wanted the LED to have a PWM period of say 100hz to reduce flicker and I wanted 100 different dim levels, the processor would have to stop whatever it was doing and run that little snippet of code 100*100=10000 times every second.

Microcontrollers with hardware PWM are nice.
__________________
Robotguy is offline   Reply With Quote
Old 03-07-2011, 07:16 AM   #38
Robotguy
Planted Member
 
Robotguy's Avatar
 
PTrader: (4/100%)
Join Date: Jan 2010
Location: Sacramento, CA
Posts: 250
Default

Small update, no pics.

All three LED channels are working and mapped to output channels 1,2 and 3.
Code:
SO,1,100                                                                        
Got command SO,1,100
Setting channel 1(led1) to 100
The led_fan is now controllable through output channel 4.
Code:
SO,4,100                                                                        
Got command SO,4,100
Setting channel 4(fan) to 100
And last, but certainly not least, after an entire day of troubleshooting the battery-backed RTC is finally working.
Code:
RTC,GET,1                                                                       
Got command RTC,GET,1
Time is 23:57:50 on Sunday
Next I need to add pump and CO2 control, tank and LED heatsink temp input, then start coding the real control protocol.
__________________
Robotguy is offline   Reply With Quote
Old 03-08-2011, 01:59 AM   #39
Budget aquarist
Algae Grower
 
PTrader: (0/0%)
Join Date: Feb 2011
Location: Naperville il
Posts: 105
Default

OH, now this is AWESOME! I WANT ONE!
__________________
BELIEVE IT!!!!!
new tank = new algae!

NIKON PIMP#43!!
Budget aquarist is offline   Reply With Quote
Old 03-09-2011, 05:46 AM   #40
VaultBoy
Planted Tank Obsessed
 
VaultBoy's Avatar
 
PTrader: (0/0%)
Join Date: Nov 2010
Location: Adelaide, South Australia
Posts: 320
Default

WOW... just WOW, you make me feel inadequate... i just recieved my first ever arduino in the mail today and plan on automating/computerizing my 29g RCS / Endlers tank.

Cant wait to see more of this project.
VaultBoy is offline   Reply With Quote
Old 03-14-2011, 07:43 AM   #41
Robotguy
Planted Member
 
Robotguy's Avatar
 
PTrader: (4/100%)
Join Date: Jan 2010
Location: Sacramento, CA
Posts: 250
Default

Quote:
Originally Posted by Budget aquarist View Post
OH, now this is AWESOME! I WANT ONE!
Thanks.
Quote:
Originally Posted by VaultBoy View Post
WOW... just WOW, you make me feel inadequate... i just recieved my first ever arduino in the mail today and plan on automating/computerizing my 29g RCS / Endlers tank.
No need to feel inadequate. Everyone starts somewhere. The only reason I can pull this off is that I am an old fart who has been playing with microcontrollers for almost 20 years. Arduinos are great way to get started. I look forward to seeing your project.

Another small update:

The RTC is now driving the triggers. I can set TIME and OFFSET triggers and they are stored to EEPROM so they don't get lost when I power down..

TIME triggers will set an output to a specific level at a predetermined time of day

OFFSET triggers will set an output to a specific level at a predetermined time after another trigger goes off

I have a demo setup running that lights the leds 1 and 3 in turn for 10 seconds. It gives me the following output (I turned the verbosity up to see what's going on. It normally isn't this gregarious):
Code:
Running trigger 1
Setting channel 1(led1) to 100
Trigger 1 has kicked off trigger 2
Set trigger_counter[2] to 10
Trigger 1 has kicked off trigger 3
Set trigger_counter[3] to 10
ISR - Trigger 1 fired!
Running trigger 4
Setting channel 3(led3) to 0
ISR - Trigger 4 fired!
Running trigger 2
Setting channel 1(led1) to 0
ISR - Trigger 2 fired!
Running trigger 3
Setting channel 3(led3) to 100
Trigger 3 has kicked off trigger 1
Set trigger_counter[1] to 10
Trigger 3 has kicked off trigger 4
Set trigger_counter[4] to 11
ISR - Trigger 3 fired!
So trigger 1 fires at startup and turns on led1. Ten seconds later triggers 2 and 3 go off which turn off led1 and turn on led3 respectively. ten seconds after that triggers 1 and 4 go off which turn on led 1 and turn off led3. Then the whole cycle starts over.

I can also set up a TIME trigger to go off at a specific time on multiple days of the week. For instance if I want to dose micros on tuesdays and thursdays at 7am for 12 seconds I can set trigger 5 to go off tuesdays and thursdays at 7am and turn on the dosing pump. Then I set trigger 6 to go off 12 seconds after trigger 5 and turn off the dosing pump.
__________________
Robotguy is offline   Reply With Quote
Old 01-14-2013, 12:28 AM   #42
blink
Planted Tank Enthusiast
 
PTrader: (0/0%)
Join Date: Feb 2012
Location: Edmonton, Alberta
Posts: 564
Default

What ever happened with this project?
blink is offline   Reply With Quote
Old 01-14-2013, 12:36 AM   #43
Robotguy
Planted Member
 
Robotguy's Avatar
 
PTrader: (4/100%)
Join Date: Jan 2010
Location: Sacramento, CA
Posts: 250
Default

I actually ended up using the electronics for wardian case I built, mostly because I needed a light controller:


Ward14 by Rbotguy, on Flickr
__________________
Robotguy is offline   Reply With Quote
Old 01-14-2013, 03:57 AM   #44
Maechael
Planted Tank Obsessed
 
PTrader: (0/0%)
Join Date: Sep 2012
Location: Michigan
Posts: 319
Default

You need to keep updating this, it appears to have been dormant for quite a bit.

Such interesting information, Glad I found this thread.
__________________
Each generation imagines itself to be more intelligent than the one that went before it, and wiser than the one that comes after it.

~George Orwell~


It is not the strongest of the species that survives, nor the most intelligent that survives. It is the one that is the most adaptable to change.

~Charles Darwin~
Maechael is offline   Reply With Quote
Old 01-14-2013, 04:26 AM   #45
blink
Planted Tank Enthusiast
 
PTrader: (0/0%)
Join Date: Feb 2012
Location: Edmonton, Alberta
Posts: 564
Default

That is pretty cool, I'd love to see the finished aquarium when it's done.
blink is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not 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

Forum Jump


All times are GMT. The time now is 01:23 AM.


Powered by vBulletin®
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Copyright Planted Tank LLC 2012