PDA

View Full Version : Welcome the Louverduino!



SXRguyinMA
11-14-2010, 10:57 PM
It took 2 days of drawing and laying out in Fritzing and a couple hours to breadboard it but it works! Hopefully I'll get this puppy etched sometime soon and test her out! :banana:

I know the routing isn't pretty, and I HAD to use 1 jumper wire (it was unavoidable), but it should work!

If anyone thinks they can simplify it (while using a one-layer board) PM me and I'll shoot you the .fz file :D

Comments and suggestions welcome

http://i92.photobucket.com/albums/l11/sportrider12584/Tempest%20SXR/Louverduino.png

x88x
11-15-2010, 02:05 AM
Sweet! Looks like you could probably shift down to an even cheaper AVR chip if you wanted to...not sure the cost difference would really justify it unless you're making a lot of them though. :P

For the PCB design, if you did something along these lines you could get rid of that jumper line. Ground is ground, it doesn't really matter how it gets there as long as it doesn't blow out. :D
http://i428.photobucket.com/albums/qq3/x13931x/louverduino01.png

SXRguyinMA
11-15-2010, 10:04 AM
+rep and fixed :D Thanks!

http://i92.photobucket.com/albums/l11/sportrider12584/Tempest%20SXR/Louverduino_Rev_2.png

Oneslowz28
11-15-2010, 11:48 AM
How big is your code? You could run this on a $4 Atmega 8 if its not too big.

NightrainSrt4
11-15-2010, 11:51 AM
It looks pretty good to me, at least coming from a graph theory point of view. You could probably write an algorithm using incidence lists to draw/approximate possible graphs, or pcb layouts in your case. But aside from testing for planarity, which yours essentially is, the only other thing I could think of is to use a take on the shortest path problem to design a layout that used the minimal amount of pcb trace while still creating a planar graph.

Sorry, going all CS/Math on you. Been stuck designing algorithms for this type of stuff all year, and the last few weeks we've had a focus on graphs.

Looks good to me as it is. With a small design like this it tends to be more about the visuals and getting everything onto the pcb size that you want than to minimize trace material,etc. Looks good.

SXRguyinMA
11-15-2010, 12:04 PM
How big is your code? You could run this on a $4 Atmega 8 if its not too big.

here's the code, and I'm running it on a $4 Atmega 328 lol :D the smaller chip might be useful for space/trace routing reasons, and I've got a serial IC programmer, but the only programming I know is Arduino, so I'd have no idea how to transfer the coding :?

// Controlling a servo position using a temperature sensor
// by Michal Rinott <http://people.interaction-ivrea.it/m.rinott>
// edited 5-12-2010 by Will Lyon to include base setting for servo if voltage not detected on pin 7
// edited again 7-4-2010 by crenn to simplify the code a little
// edited yet again 7-5-2010 by crenn to add features
// edited again 7-21-2010 by Will Lyon - recalibrated servo positions
// edited again 10-15-2010 by crenn - slow down servo when computer is off
// edited again 10-15-2010 by Will Lyon, with new VarSpeedServo library to slow servo movement
// VarSpeedServo library from Korman on Arduino.cc forums

#include <VarSpeedServo.h>

VarSpeedServo myservo; // create variable speed servo object to control a servo

//Constants
const unsigned char CONTROL = 5; // digital pin used to detect if the system is on or off
const unsigned char TEMP_SENSOR = 0; // analog pin used to connect the temp sensor
const unsigned char MAX_SAMPLES = 10; // number of temp sensor samples to average
const unsigned char OFF_POSITION = 180; // position of servo when no voltage is detected on pin 5
const unsigned char LOW_POSITION = 160; // servo position for lowest temp
const unsigned char HIGH_POSITION = 135; // servo position for highest temp

//Main global varibles
char trigger = 0; // varible used to store the control pin value
unsigned int val = OFF_POSITION; // variable to read the value from the analog pin

unsigned int updateAvgtemp(){
static int history[MAX_SAMPLES]={0};
static unsigned char lastHist=0;
static unsigned char numHist=0;
unsigned int temp=0;
unsigned char counter=0;
unsigned char arcount=0;
history[lastHist] = analogRead(TEMP_SENSOR);
if(numHist<MAX_SAMPLES)
++numHist;
arcount=lastHist;
++lastHist;
if(lastHist>=MAX_SAMPLES)
lastHist=0;
temp=0;
counter=0;
do{
temp+=history[arcount];
arcount--;
if(arcount>MAX_SAMPLES)
arcount=(MAX_SAMPLES-1);
counter++;
}while(counter < numHist);
return (temp/numHist);
}

void setup()
{
pinMode (CONTROL, INPUT); // sets the control pin to input
myservo.attach(9, HIGH_POSITION, LOW_POSITION); // attaches the servo on pin 9 to the servo object
digitalWrite(CONTROL, LOW); // ensure internal pullup resistor is disabled.
}
void loop()
{
trigger = digitalRead(CONTROL); // read input of pin CONTROL and store it
if (trigger == HIGH){ // reads if pin CONTROL, if true, do this:
val = updateAvgtemp(); // read the value of the temp sensor (value with range of 1024)
val = map(val, 350, 700, LOW_POSITION, HIGH_POSITION); // scale it to use it with the servo (value between 160 and 120)
myservo.slowmove(val, 0); // sets the servo position according to the scaled value
}
else {
while(val<OFF_POSITION){
val++;
myservo.slowmove(val, 0);
delay(100);
}
myservo.slowmove(OFF_POSITION, 1); // sets servo position to 180 if above statment is false, at slowest speed
}
delay(125); // wait 25ms for the servo to move to it's new position and also 100ms until it gets the new value
}



It looks pretty good to me, at least coming from a graph theory point of view. You could probably write an algorithm using incidence lists to draw/approximate possible graphs, or pcb layouts in your case. But aside from testing for planarity, which yours essentially is, the only other thing I could think of is to use a take on the shortest path problem to design a layout that used the minimal amount of pcb trace while still creating a planar graph.

Sorry, going all CS/Math on you. Been stuck designing algorithms for this type of stuff all year, and the last few weeks we've had a focus on graphs.

Looks good to me as it is. With a small design like this it tends to be more about the visuals and getting everything onto the pcb size that you want than to minimize trace material,etc. Looks good.

Yea I basically tried to fit it all in in as little space as possible. The reason for the empty space @ top left is that the two 10F caps are going to lay flat in that space, so it works out nicely. That's also why the diode and resistor are in the center, so the caps come down to either side

SXRguyinMA
11-15-2010, 03:38 PM
well after a lot of messing around with the breadboard I found I could remove a lot of components that turned out to be completely unnecessary altogether. :D Here is Rev. 3:

http://i92.photobucket.com/albums/l11/sportrider12584/Tempest%20SXR/Louverduino_Rev_3.png

It turns out I didn't need the 5v Regulator, 5v relay, 15ohm resistor or the diode at all. These were put in to change 12v to 5v then charge the caps. However upon further testing the caps charge from the 5v line without these components installed.

Now the only issue I'm having is after the power supply is shut off, the servo moves to it's closed position slowly as it's supposed to. However, after 3 or 4 mins as the caps drain down, it starts to jitter then shoots almost 180º! This wouldn't be good at all, all I envision is parts breaking :eek: anyone have any ideas? :think:

x88x
11-15-2010, 03:46 PM
Sounds like that might be backflow from the caps. Put the diode back in, see if that fixes it. IMO, any time you're using caps you should have a diode, just to make sure they don't backflow into the circuit.

SXRguyinMA
11-15-2010, 04:55 PM
where in the circuit should I put it?

x88x
11-15-2010, 05:39 PM
Between the 5V source and the cap, allowing flow from the source to the caps.

SXRguyinMA
11-15-2010, 07:43 PM
didn't work. and now with the diode removed and the jumper wire reinstalled like it was the caps don't seem to be charging at all :?

:edit: it helps if you put the jumper wire into the right breadboard socket :facepalm:

I got it to work with the diode, but it still jitters and rotates as the caps discharge

x88x
11-15-2010, 07:54 PM
Doh! :facepalm: Sorry, I didn't even think to look back at what the circuit was originally.. You'll want the diode and resistor back in place, configured like they were. That portion of the circuit is, iirc, so that you don't overcharge the capacitors, not backflow. :facepalm: Not sure about the sudden discharge problem at the end, I'll take a better look at it once I get home.

dr.walrus
11-15-2010, 08:54 PM
once you finalise your circuit diagram, post it and I'll do my best to clean up your PCB layout

SXRguyinMA
11-15-2010, 09:11 PM
cool thanks!

SXRguyinMA
11-16-2010, 07:43 PM
crenn where ARRREEEE YYYYOOOOUUUUU!?!?!?!? :D

SXRguyinMA
11-16-2010, 08:20 PM
ok so upon further testing, at full charge the total cap voltage sits right @ 4.94VDC. when I turn the PSU off and the residual voltage bleeds out and the relay shuts, it takes 67 seconds for it to drop to 3.3VDC, at which point the servo does it's random 180º sweep :?

crenn
11-17-2010, 05:36 AM
I'm currently unavailable due to exams (Mmm.... Laplace Tranforms, State Space Anaylsis and other things I need to learn in a day)

SXRguyinMA
11-17-2010, 09:22 AM
good luck on your exams crenn!!!

I think I've figured it out. I simplified it quite a bit. I put the vreg, 15ohm resistor and diode back in, and took out the relays altogether. I've got it breadboarded exactly this way right and and it works fine! I did put a small ramsink on the vreg though, and even still that ramsink burnt my finger very quickly.

Here's the current layout. the only thing the 5v line does is hook to the sense pin to tell the atmega to run the code if the computer is on, and run the close code when it is off. The 12v line goes straight into the 5v reg, then off to the caps and the rest of the circuit. Now when I shut off the PSU, the servo makes a little noise from time to time as the caps drain, but it doesn't randomly sweep 180º anymore either :banana:

http://i92.photobucket.com/albums/l11/sportrider12584/Tempest%20SXR/Louverduino_Rev_4-1.png

x88x
11-17-2010, 10:56 AM
Good to hear. :D I've been meaning to ask, what are those dark green lines?

SXRguyinMA
11-17-2010, 11:18 AM
those are what firtzing thinks should be connections. It's retarded. If I make connections to all those green lines, the circuit will blow up lol. On that scren in fritzing it tells me I still have 5 connections left to make. Stupid program :facepalm:

x88x
11-17-2010, 12:12 PM
Yes, because tying together all the free pins of a uC is a good thing. :P

SXRguyinMA
11-17-2010, 07:23 PM
lol, as well as tying together every component with a 5v and ground :facepalm:

SXRguyinMA
11-19-2010, 09:31 PM
And here is revision 5! After a few days of testing to make sure the circuit would perform as intended, I went and rearranged some things to make it more compact and have a smaller footprint. I also made the traces bigger for etching's sake. I've been reading that narrow ones are tougher to do at home, so I beefed them up and spaced them accordingly to (hopefully) have as few issues as possible.

The reason for so much PCB space on the LH side is that the 10F caps are as long (in the body) as the atmega328 chip is, and I intend to have these laying down once they're soldered for cleanliness, and that's just a whisker more PCB than will be needed so they don't overhang.

Any and all comments/suggestions/hate mail is appreciated!

I also tried messing with the free version of Eagle, and even with looking online for tutorials and such I couldn't figure it out at all. I wanted to get it into a gerber to get a quote from a PCB fabhouse, but I'd still like to etch my own for giggles.

http://i92.photobucket.com/albums/l11/sportrider12584/Tempest%20SXR/Louverduino_Rev_5.png

SXRguyinMA
11-20-2010, 12:54 AM
alright so I spent a few hours and learned the basics for Eagle from Sparkfun's amazing tutorials :banana:

Here she is:

http://i92.photobucket.com/albums/l11/sportrider12584/Tempest%20SXR/louverduino_eagle.png

SXRguyinMA
11-20-2010, 09:06 PM
ok so I found some major issues with that last one, mainly the IC socket was wider than the atmega chip, so I had to swap it. Next, the in/out/ground for the vreg didn't match up from the schematic drawing to the PCB drawing, so I had to mess with wire connections until I found out what was actually what. OUT in the schematic is Ground in the PCB, ground in the schematic is IN in the PCB, and IN in the schematic is OUT in the PCB :facepalm:

http://i92.photobucket.com/albums/l11/sportrider12584/Tempest%20SXR/louverduino_eagle_rev_2.png

SXRguyinMA
12-21-2010, 12:56 PM
and I ordered it through batchpcb on 12/5, just got my email saying my board is on its way to me :banana: should be 2-3 days (read: hopefully before christmas) till I get it in! :banana:

x88x
12-21-2010, 04:20 PM
Nice! What's a single, single-layer board like that run with them?

SXRguyinMA
12-21-2010, 04:45 PM
$15.10 for the board, plus $10 setup fee and $5 shipping, so $30 all said and done. I should have ordered 3 or 4 to make up for the $10 setup fee (would have only paid it once) but it's probably better incase theres a design issue. that way I'm not stuck with 3 or 4 junk boards lol

:EDIT:

you can order one here: :D
http://batchpcb.com/index.php/Products/47020

dont until I get mine and verify it first lol

SXRguyinMA
12-23-2010, 07:31 PM
boards came in today! YES I said boardS. I ordered one, but got two, so it worked out to $15.05 each, with a total turnaround time of 18 days. The same price as getting the etching solution and a bare board and doing it myself, but a much better result :D


http://i92.photobucket.com/albums/l11/sportrider12584/Tempest%20SXR/louverduino-1.png

http://i92.photobucket.com/albums/l11/sportrider12584/Tempest%20SXR/louverduino-2.png

http://i92.photobucket.com/albums/l11/sportrider12584/Tempest%20SXR/louverduino-3.png

should have time to get one soldered up and tested this weekend! :banana:

SXRguyinMA
12-27-2010, 10:51 AM
soldered up:

http://i92.photobucket.com/albums/l11/sportrider12584/Tempest%20SXR/louverduino-4.png

http://i92.photobucket.com/albums/l11/sportrider12584/Tempest%20SXR/louverduino-5.png

4-pin to 3-pin adapter made:

http://i92.photobucket.com/albums/l11/sportrider12584/Tempest%20SXR/louverduino-6.png

And I found an error. One of the VCC pins on the chip was not connected to 5v, so I just soldered a piece in to fix that:

http://i92.photobucket.com/albums/l11/sportrider12584/Tempest%20SXR/louverduino-7.png

http://i92.photobucket.com/albums/l11/sportrider12584/Tempest%20SXR/louverduino-8.png

http://i92.photobucket.com/albums/l11/sportrider12584/Tempest%20SXR/louverduino-9.png

Now it kinda works. You plug it in, it turns on, and it seems like the servo does its slowmove to the closed position. It seems like it's not sensing the 5v input. Although the routing and coding are both correct. I made up this exact setup in a breadboard and it does the exact same thing. Today's project is to troubleshoot it and get it working properly.


http://i92.photobucket.com/albums/l11/sportrider12584/Tempest%20SXR/louverduino-10.png

SXRguyinMA
12-27-2010, 11:26 AM
ok in the breadboard setup, if I remove the 10k to ground for the temp sensor it works properly when the 5v is taken away. if I put it back in, nothing works

:EDIT:

I had a 100 Ohm instead of a 10k ohm in the breadboard, now the breadboard circuit works perfectly. I do have the 10k in the PCB though :?

:EDIT 2:

Ok it workes perfectly in the breadboard if I take away the 5v and leave the 12v connected. if I unplug it all, it doesn't work :?

crenn
12-27-2010, 07:34 PM
Leave the Louverduino plugged in for an hour before you try testing again.

SXRguyinMA
12-27-2010, 07:51 PM
will do

SXRguyinMA
12-27-2010, 10:00 PM
had it plugged in for almost 2 hours, no change

SXRguyinMA
01-01-2011, 11:33 PM
ok so in the breadboard setup it works. the servo moves based on temp sensor reading, but it moves to the off position ONLY if the 12v stays connected. if I unplug it all the LED dims and flickers and the servo makes a whining noise while attempting to move to the closed position. I need to remake my 4p to 3p adapter so I can test the board more

SXRguyinMA
01-01-2011, 11:44 PM
good news. I tried it in the circuit board again. and for some reason it's working 100% now :?

I'm going to try it out a few more times just to be sure though

Lothair
01-02-2011, 11:02 AM
I have no idea what I just read or what I looked at, but I was entirely fascinated throughout this entire thread. Pretty cool stuff you've got going on here, even if I don't understand a lick of it.

Good luck with the project, hope you get the kinks and bugs worked out.

SXRguyinMA
01-02-2011, 12:12 PM
lol thanks :D

it seems to be working pretty good so far, I'm going to do more testing today and make sure it's 100%.

If you want to see what this is for, check out my Tempest SXR worklog in my sig :D

SXRguyinMA
01-02-2011, 08:35 PM
ok so I lied. it's working 95% lol. When you first plug it in when the caps are completely drained, it doesn't want to do anything. if you unplug it and plug it back in a few times it works fine, and will continue to work fine as long as there's some juice in the caps :?

x88x
01-02-2011, 09:26 PM
Weird...did it do that with your original board?

SXRguyinMA
01-02-2011, 09:46 PM
Nope. It worked 100% in the original breadboard setup, and with the Adruino and the relay setup I used. The relay setup was only to disconnect power to the 5v, but I worked around that with only having the 5v for the sense, and using the 12v with the 5v reg for everything else. And when I breadboarded this setup before I had the PCBs made, it worked 100% as well.

Like I said though, once there's juice in the caps it works 100% all the time, until the caps are fully drained. Then it doesn't want to work when it's powered up again

SXRguyinMA
01-09-2011, 01:07 PM
I think I got it...there's a 12v Zener diode (4742) where a 5v Zener should be (4733). Will swap out later and report :D

SXRguyinMA
01-09-2011, 08:53 PM
well that didn't change anything, just wasted my time unsoldering and resoldering lol