Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
enotnert
Jun 10, 2005

Only women bleed

Wild EEPROM posted:

box update 2: I built a bigger, stronger (and much heavier) box





that's a pretty nice box.

Adbot
ADBOT LOVES YOU

Bensa
Aug 21, 2007

Loyal 'til the end.

Sagebrush posted:

i don't think i even own anything that still uses rs-232

we have a couple of old cnc machines i want to get working w/ new computers but they use whatever the ieee 1284 parallel port is actually called

somewhere i do have My First Arduino, which was an original model with all through hole components and a serial port and i assembled it myself. that was cool. but that's all i have

Most of the equipment I work with interfaces via RS232 or GPIB (1960's tech). Several of these devices cost six figures, and the reason for sticking to those standards is the ease at which you can make your own software and diagnose faults. You're no longer reliant on manufacturers staying in business or providing support for old devices. I'm able to look at documentation or previous code and can get a thirty year old Japanese scientific instrument to work in hours instead of paying a hundred grand for a new one.

Captain Cool
Oct 23, 2004

This is a song about messin' with people who've been messin' with you

echinopsis posted:

code:
if (millis() > t+risedelay+delayinjection);
    {
    	//Serial.print(millis());
    	//Serial.print(" ");
    	//Serial.println(t+risedelay+delayinjection);
    	t=millis();
    	 	 	
    	
    	delayinjection=0;
    	gain=gain+iterator;

    	if (gain<0)
    	{
    		iterator = iterator *-1;
			//risedelay = risedelay*stallfactor;
			delayinjection=500;
		}
		else if (gain>maxgain)
		{
			iterator = iterator *-1;	
		}
		


	}
this seems to be escuting over and over and over and not at the interval i want. i cant fuckin work it out at all
this code looks ok to me, as long as gain doesn't start out of bounds and the variables aren't modified elsewhere

Corla Plankun posted:

make sure all of those variables are the same type

for an arduino i think they should all be unsigned long

i have made that mistake before.
iterator and gain need to be signed

Corla Plankun
May 8, 2007

improve the lives of everyone
i just meant the ones in the comparison to millis but you are right i should have been more specific

Bloody
Mar 3, 2013

echinopsis posted:

code:
if (millis() > t+risedelay+delayinjection);
    {
    	//Serial.print(millis());
    	//Serial.print(" ");
    	//Serial.println(t+risedelay+delayinjection);
    	t=millis();
    	 	 	
    	
    	delayinjection=0;
    	gain=gain+iterator;

    	if (gain<0)
    	{
    		iterator = iterator *-1;
			//risedelay = risedelay*stallfactor;
			delayinjection=500;
		}
		else if (gain>maxgain)
		{
			iterator = iterator *-1;	
		}
		


	}
this seems to be escuting over and over and over and not at the interval i want. i cant fuckin work it out at all

im the poorly named variables

movax
Aug 30, 2008

Bloody posted:

what like rad-hard or high-temp or?

yes

echinopsis
Apr 13, 2004

by Fluffdaddy

Bloody posted:

im the poorly named variables

you dont need to project your childhood insecurities onto my code!

Corla Plankun posted:

i just meant the ones in the comparison to millis but you are right i should have been more specific

word is that I am mean to put L at the end of long variables?

Luigi Thirty
Apr 30, 2006

Emergency confection port.

so I have 4 points that make a square on my scope. in pwm world (127,127) is the middle. how would I math my way into recalculating the coordinates of the four points to make them rotate around the center?

Bloody
Mar 3, 2013

you would use trigonometry

Corla Plankun
May 8, 2007

improve the lives of everyone

echinopsis posted:

you dont need to project your childhood insecurities onto my code!


word is that I am mean to put L at the end of long variables?

its related to that but it happens at the beginning when you declare those three variables

when you declare t and risedelay and delayinjection you just say

code:
unsigned long t;
unsigned long risedelay;
unsigned long delayinjection;
otherwise really weird stuff happens when you try to add millis() to a normal int or whatever number you are using right now

Sagebrush
Feb 26, 2012

Corla Plankun posted:

when you declare t and risedelay and delayinjection you just say

code:
unsigned long t;
unsigned long risedelay;
unsigned long delayinjection;

also you do

code:
unsigned long t, risedelay, delayinjection;
because programmers lazy, save typing whenever can

Sagebrush
Feb 26, 2012

Luigi Thirty posted:

so I have 4 points that make a square on my scope. in pwm world (127,127) is the middle. how would I math my way into recalculating the coordinates of the four points to make them rotate around the center?

you're making a swastika aren't you

overeager overeater
Oct 16, 2011

"The cosmonauts were transfixed with wonderment as the sun set - over the Earth - there lucklessly, untethered Comrade Todd on fire."



Luigi Thirty posted:

so I have 4 points that make a square on my scope. in pwm world (127,127) is the middle. how would I math my way into recalculating the coordinates of the four points to make them rotate around the center?

short version:

x' = 127 + (x-127) * cos a - (y-127) * sin a
y' = 127 + (x-127) * sin a + (y-127) * cos a

echinopsis
Apr 13, 2004

by Fluffdaddy

Luigi Thirty posted:

so I have 4 points that make a square on my scope. in pwm world (127,127) is the middle. how would I math my way into recalculating the coordinates of the four points to make them rotate around the center?

i worked this out when i was 12 loving around with cos() and sin(). i dont know how i fuckin did it but i did. i knew nothing about what trig even was or anything but i knew the BASIC language had those maths functions and it was kinda cool.


i tried to make a projectile firing game like worms or whatever and for my projectile trajectory i wish i had known physics and poo poo and had x being constant and y subject to acceleration but instead i was tring to make the method be soething like move the projectile in a direction based on an angle and that angle would change over time. god it was a faiure

Corla Plankun posted:

its related to that but it happens at the beginning when you declare those three variables

when you declare t and risedelay and delayinjection you just say

code:
unsigned long t;
unsigned long risedelay;
unsigned long delayinjection;
otherwise really weird stuff happens when you try to add millis() to a normal int or whatever number you are using right now

i'll give that a shot thanks

Luigi Thirty
Apr 30, 2006

Emergency confection port.

Bloody posted:

you would use trigonometry

i think i failed that in high school but okay

Luigi Thirty
Apr 30, 2006

Emergency confection port.

Sagebrush posted:

you're making a swastika aren't you

that would be more than 4 points (i calculated it)

Woolwich Bagnet
Apr 27, 2003



thanks to the people that recommended the pcb fab place a few pages back. finally pushed me over the edge to design a pcb to have printed. this is my first attempt but i don't think it came out too bad.



hopefully i didn't gently caress up the grounding and whatnot too badly. will probably look over it again and again for the next few weeks before sending it off, still missing a few minor things for the atmega i think. going to be nervous as gently caress soldering it. almost $200 in ICs.

Base Emitter
Apr 1, 2012

?

Stealth Like posted:

almost $200 in ICs.

are those cans on the same board as an atmega? now i'm all curious

Woolwich Bagnet
Apr 27, 2003



Base Emitter posted:

are those cans on the same board as an atmega? now i'm all curious

yep. one is an opa128, still the best precision opamp you can buy (but pricey at over $60 each) . fun fact: TI stopped making them something like a decade ago, and began pushing a 'replacement' for them that was in no way an equal. within the last year they've started manufacturing them again. i ordered some samples of the new ones that i look forward to comparing with the old ones.

echinopsis
Apr 13, 2004

by Fluffdaddy
i got 5 from-china packages in the mail! i am stoked with the fake pro-mini. it was like $2.50 or so and i worked out i have to manually hold reset to upload to it but who cares it works and its so small!

i also got my led drivers for my "10w" rgb led

now this led appears to be common anode. so does that mean all three led drivers are going to have their +ve terminals connected? and then drain the -ve through a mosfet to control current..?


well thats what i am going to try to do nonetheless :q:

echinopsis
Apr 13, 2004

by Fluffdaddy
in fact the only thing i can't work out is that usually in these instances you connect all your 0v together right? bt wont that defeatt he purpose of having individual drivers for each element? oh gently caress my brain.

syscall girl
Nov 7, 2009

by FactsAreUseless
Fun Shoe

Stealth Like posted:

thanks to the people that recommended the pcb fab place a few pages back. finally pushed me over the edge to design a pcb to have printed. this is my first attempt but i don't think it came out too bad.



hopefully i didn't gently caress up the grounding and whatnot too badly. will probably look over it again and again for the next few weeks before sending it off, still missing a few minor things for the atmega i think. going to be nervous as gently caress soldering it. almost $200 in ICs.

i know gently caress all about what you're doing but i'm impressed and kinda interested to see how this turns out

echinopsis
Apr 13, 2004

by Fluffdaddy
how thre gently caress can i keep fuckin up mosfets so bad. i simply dont get what i am doing


im using a n-type so that means im operating on the negative side right? putting 5v to the gate SHOULD allow the current from the source to the drain to flow amiright? and cutting off the gate (pulling it to 0v) should cut the mosfet right?

echinopsis
Apr 13, 2004

by Fluffdaddy
ugh i als dont know how im killing these hings because i wire it up very simply with led just to test if i am doing correct and switch mosfet and it all works fine

Woolwich Bagnet
Apr 27, 2003



echinopsis posted:

how thre gently caress can i keep fuckin up mosfets so bad. i simply dont get what i am doing


im using a n-type so that means im operating on the negative side right? putting 5v to the gate SHOULD allow the current from the source to the drain to flow amiright? and cutting off the gate (pulling it to 0v) should cut the mosfet right?

mosfet has 3 pins, with the flat back facing away from you, they are gate drain source. for an n type, you want your +V --> load(LED or w/e, if it is, make sure you have a current limiting resistor) --> drain. source will go to ground. +5v should be fine on the gate. put a resistor between gate and source as a pulldown resistor so it turns off when you put 0v on the gate, as they have a capacitance and will stay energized even if you remove the gate voltage source. if you're using a voltage source that isnt coming from the microcontroller, you need to make sure that the source pin is grounded with both your microcontroller and the one driving the load. MAKE SURE YOU PUT A 100k RESISTOR BETWEEN THE GROUND ON THE SOURCE AND YOUR MICROCONTROLLERS GROUND. if you dont do this and accidentally disconnect the ground to your other voltage source and not the microcontroller you will most likely fry it if its on.

echinopsis
Apr 13, 2004

by Fluffdaddy

Stealth Like posted:

mosfet has 3 pins, with the flat back facing away from you, they are gate drain source. for an n type, you want your +V --> load(LED or w/e, if it is, make sure you have a current limiting resistor) --> drain. source will go to ground. +5v should be fine on the gate. put a resistor between gate and source as a pulldown resistor so it turns off when you put 0v on the gate, as they have a capacitance and will stay energized even if you remove the gate voltage source. if you're using a voltage source that isnt coming from the microcontroller, you need to make sure that the source pin is grounded with both your microcontroller and the one driving the load. MAKE SURE YOU PUT A 100k RESISTOR BETWEEN THE GROUND ON THE SOURCE AND YOUR MICROCONTROLLERS GROUND. if you dont do this and accidentally disconnect the ground to your other voltage source and not the microcontroller you will most likely fry it if its on.

thanks. i knew about the pulldown resistor but i was connecting that to thegnd on the arduino. i worked out that yeah if i connected gnd on arduino to source it works

the problem i am having is flickering when it's "off"... pwm works well until smaller amounts and then it flickers. i dont know why this is



also what am i doing thats killing my mosfets? whats an easys way to kill them?

Woolwich Bagnet
Apr 27, 2003



echinopsis posted:

thanks. i knew about the pulldown resistor but i was connecting that to thegnd on the arduino. i worked out that yeah if i connected gnd on arduino to source it works

the problem i am having is flickering when it's "off"... pwm works well until smaller amounts and then it flickers. i dont know why this is



also what am i doing thats killing my mosfets? whats an easys way to kill them?

if you're below ~40-44 Hz with the on off of the LEDs you'll be able to see them flicker. LEDs have an extremely fast on off time (in the ns region).

not sure how youre managing to kill mosfets. when it happens are they getting extremely hot? may be that youre passing too much current through them. if you have a multimeter that does current you can check (make sure it can do something like 1-10 amps though or you'll damage/blow a fuse in it).

Base Emitter
Apr 1, 2012

?

echinopsis posted:

the problem i am having is flickering when it's "off"... pwm works well until smaller amounts and then it flickers. i dont know why this is

what pwm frequency are you running at? if its too high it might be messing with the driver and making it unstable. most of these drivers are basically switching power supplies that regulate current instead of voltage, and you generally have to pwm them at fairly low frequencies.

Base Emitter
Apr 1, 2012

?

Stealth Like posted:

if you're below ~40-44 Hz with the on off of the LEDs you'll be able to see them flicker. LEDs have an extremely fast on off time (in the ns region).

in case it sounds like conflicting advice when i said pwm at a low freq, 40Hz is too low. :) i was thinking somewhere around 100Hz, definitely don't run them at KHz frequencies though.

EMILY BLUNTS
Jan 1, 2005

I'm told you can somehow dim things like LED and FL lights and this will work if it's switching at a high frequency

but how? it dims because the total time is still less, and eventually that has to be noticeable.

Woolwich Bagnet
Apr 27, 2003



EMILY BLUNTS posted:

I'm told you can somehow dim things like LED and FL lights and this will work if it's switching at a high frequency

but how? it dims because the total time is still less, and eventually that has to be noticeable.

basically your eyes have a refresh rate, which is ~30-40 times a second. anything above that will appear to be solidly on, but in reality its still turning off and on. the slower it turns off and on, the less photons it produces and therefor it appears dimmer. it will be noticeable if you drop below ~45 Hz (ive tested before and I can see flicker up to 48 hz whereas a friend of mine could see to 42).

and you can drive leds as basically any frequency you want, but the difference in the khz range wont be detectible by your eyes. leds have extremely fast on off times, talking nanoseconds.

theadder
Dec 30, 2011


echinopsis posted:

i got 5 from-china packages in the mail!

post the whatever device

echinopsis
Apr 13, 2004

by Fluffdaddy
so i dont know what this means BUT if i connect the gate to arduino 5v it goes fully on and them remove that and its all but BUT it also lights up if i connect the gate to arduino ground which is connected to the source 0v via resistors, but it flickers. if i connect the gate to any pin it flickers regardless of being HIGH or LOW or 0 or 255, except if i put a diode coming out the pin in which case it lights up fully regardless of whether the pin is high or low


i really dont get this at all.

echinopsis
Apr 13, 2004

by Fluffdaddy

Stealth Like posted:

basically your eyes have a refresh rate, which is ~30-40 times a second. anything above that will appear to be solidly on, but in reality its still turning off and on. the slower it turns off and on, the less photons it produces and therefor it appears dimmer. it will be noticeable if you drop below ~45 Hz (ive tested before and I can see flicker up to 48 hz whereas a friend of mine could see to 42).

and you can drive leds as basically any frequency you want, but the difference in the khz range wont be detectible by your eyes. leds have extremely fast on off times, talking nanoseconds.

yeah pwm is key for rgb leds and making different colours


the neopixels pull this off amazingly


so far i am a failed miserable dog. i cant work it out. its almost like the led drivers just cant handle the pwm but its also weird that they flicker from the 5v outputs on the pins but are ok with thr 5v rail voltage

echinopsis
Apr 13, 2004

by Fluffdaddy
welp i give up


even without mosfets or anything, applying resistance to the driver on the led causes flickering. i dont know what to do about it other than use some kind of capacitor to flatten it out but i only have 1000uf ones and they dont do the job

its hosed up. and it gets really hot too. and now the elements are loving out by themselves :/

Woolwich Bagnet
Apr 27, 2003



echinopsis posted:

welp i give up


even without mosfets or anything, applying resistance to the driver on the led causes flickering. i dont know what to do about it other than use some kind of capacitor to flatten it out but i only have 1000uf ones and they dont do the job

its hosed up. and it gets really hot too. and now the elements are loving out by themselves :/

youre putting way too much current through them, which is why youre messing up the mosfets too. post a schematic of what youre doing and the part numbers

coffeetable
Feb 5, 2006

TELL ME AGAIN HOW GREAT BRITAIN WOULD BE IF IT WAS RULED BY THE MERCILESS JACKBOOT OF PRINCE CHARLES

YES I DO TALK TO PLANTS ACTUALLY

Luigi Thirty posted:

got the measurements of my 7-segment wrong, wasted $35 on 3 boards that won't work
measure twice order once

Bloody
Mar 3, 2013

Stealth Like posted:

thanks to the people that recommended the pcb fab place a few pages back. finally pushed me over the edge to design a pcb to have printed. this is my first attempt but i don't think it came out too bad.



hopefully i didn't gently caress up the grounding and whatnot too badly. will probably look over it again and again for the next few weeks before sending it off, still missing a few minor things for the atmega i think. going to be nervous as gently caress soldering it. almost $200 in ICs.

good poo poo. without seeing your schematics, i've only got one note:
keep trace angles as small as possible - 90 degree angles are okay, but two 45 degrees are better. similarly, be mindful of how traces exit pads. generally you want them to come straight out of the pad; if they must come out at an angle, try and come from a corner. the basic problem we're trying to avoid here are acid traps - little pockets where chemical residue and poo poo can build up during the fab process and make your board shittier

also are you comfortable soldering small things? looks like you might have some 0402s or 0201s in there which a lot of hobbyists are terrified by

Bloody
Mar 3, 2013

Stealth Like posted:

post a schematic of what youre doing and the part numbers

also psa that http://www.linear.com/designtools/software/#LTspice is you're friend

Adbot
ADBOT LOVES YOU

Woolwich Bagnet
Apr 27, 2003



Bloody posted:

good poo poo. without seeing your schematics, i've only got one note:
keep trace angles as small as possible - 90 degree angles are okay, but two 45 degrees are better. similarly, be mindful of how traces exit pads. generally you want them to come straight out of the pad; if they must come out at an angle, try and come from a corner. the basic problem we're trying to avoid here are acid traps - little pockets where chemical residue and poo poo can build up during the fab process and make your board shittier

also are you comfortable soldering small things? looks like you might have some 0402s or 0201s in there which a lot of hobbyists are terrified by

cool thanks i knew that you were supposed to use as few 90 degree angles but i didnt know why. theres some 0402s but no 0201s on it. i havent actually soldered components that small but im not too worried, ive worked with much smaller things before. ill prob practice with a some before doing the main board

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply