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
Charles Ford
Nov 27, 2004

The Earth is a farm. We are someone else’s Ford Focus.

Exitlights posted:

The next step is to figure out how to switch this with a transistor or relay using a microcontroller. I'm concerned about flyback voltage, which looks like it's going to be a problem with my starter.

I think in most cars you'd operate the starter motor via some sort of chunky relay, because it draws incredible current. However, you'd operate that relay with a transistor as per your diagram, if what you're doing is what I think you're doing (I was confused by the placement of the uC in the diagram, where it's powered from, etc.)

I think the location of the diode is fine for handling the inductive load too.

Edit: Oh, and if the signal's coming straight out an MCU/digital logic you'll want a resistor before the base of the transistor so as to not stuff too much current into its gaping maw.

Charles Ford fucked around with this message at 21:16 on Oct 6, 2010

Adbot
ADBOT LOVES YOU

Exitlights
Dec 25, 2006
Calmly and clearly announce that the building must be evacuated.

Charles Ford posted:

I think in most cars you'd operate the starter motor via some sort of chunky relay, because it draws incredible current. However, you'd operate that relay with a transistor as per your diagram, if what you're doing is what I think you're doing (I was confused by the placement of the uC in the diagram, where it's powered from, etc.)

I think the location of the diode is fine for handling the inductive load too.

Edit: Oh, and if the signal's coming straight out an MCU/digital logic you'll want a resistor before the base of the transistor so as to not stuff too much current into its gaping maw.

Yeah, that makes a lot of sense... it would be odd if I had access to two wires that powered the starter directly that are running into the wireless module. Sorry for the vagueness about the uC, that's just a digital control line (+) and ground (-), but the uC will just be powered by the car's battery.

As far as the resistor goes, if I pull the + line coming out of the MCU high, will my MCU encounter any resistance in the transistor? Or is that why I need the resistor?

Delta-Wye
Sep 29, 2005

Exitlights posted:

Yeah, that makes a lot of sense... it would be odd if I had access to two wires that powered the starter directly that are running into the wireless module. Sorry for the vagueness about the uC, that's just a digital control line (+) and ground (-), but the uC will just be powered by the car's battery.

As far as the resistor goes, if I pull the + line coming out of the MCU high, will my MCU encounter any resistance in the transistor? Or is that why I need the resistor?

Ib on a transistor is going to be somewhere in the ballpark of (Vin-0.7)/Rb - the Vbe relationship is similar to that of a diode, when forward biased there is a certain Vbe voltage, I usually use .7 to simplify the calculations. There are some physical limitations in place, without a resistor you run the chance of drawing a shitton of current. You want enough Ib to drive the transistor into saturation fast, but not too much to hurt your microcontroller. Assuming its a 5V micro, you may want something like:

10 mA = (5-.7) / Rb, Rb = 5-.7 / 10ma = 430 ohm. A 470 ohm resistor is common and should be in the acceptable range.

AbsentMindedWelder
Mar 26, 2003

It must be the fumes.
Any recommendations on a 20-30 amp diode for my application of preventing back feeding into a power supply?

insta
Jan 28, 2009

Exitlights posted:

Yeah, that makes a lot of sense... it would be odd if I had access to two wires that powered the starter directly that are running into the wireless module. Sorry for the vagueness about the uC, that's just a digital control line (+) and ground (-), but the uC will just be powered by the car's battery.

As far as the resistor goes, if I pull the + line coming out of the MCU high, will my MCU encounter any resistance in the transistor? Or is that why I need the resistor?

On that note of "how much power will a transistor's base draw unattended", I got a plain TO-92 2N2222 transistor to set fire to a potentiometer through the base current alone. :) I added a 1k resistor after that.

Keebler
Aug 21, 2000
Does anyone have any good places online to purchase wires with female terminals pre-crimped onto an end? Something where I could take like 10 of them and snap them into a plastic 2x5 connector to hook onto a pc board header.

I've found these:

http://www.pololu.com/catalog/category/71

But they're 2.54mm pitch and I'm looking for 2.0mm

Exitlights
Dec 25, 2006
Calmly and clearly announce that the building must be evacuated.
OK, tested my circuit out today, and had a bit of a problem. First, here's the circuit I put together:



Transistor is a 2N4401, FWIW. The way my car works is that + and - on the door lock/unlock/car start, when connected, activates whichever system it's for. So, connect + and - to each other for the door lock, and the doors lock.

So, I hooked up the + and - terminals on the car's door lock terminals to the + and - on the door lock part of my circuit, and connected the + and - on the uC part of my circuit to the 5v and ground on my MCU. This lit the transistor on fire (in particular, the emitter terminal looks like it was what lit on fire, since it's missing a leg now...). What happened?

I've got a couple guesses, but some insight would be great. I'm thinking that the 5v on the 2N4401 wasn't enough to *fully* close the collector-emitter connection, so the remaining resistance between the two was enough to light the transistor on fire. Another alternative is that I don't really understand transistors too thoroughly, and it's impossible to get rid of enough resistance to channel all the current my car needs to control these systems through a pretty cheap transistor. Or some third thing that I didn't consider.

So, I need a new transistor, or need to switch to a relay (may need a transistor to switch the relay, ugh). Which is it?

Edit: here's a thought, since I'm worried about the amount of current my MCU is putting out to control the collector-emitter path: should I use a Darlington transistor instead?

Edit2: looking at the specs for the transistor I got, I really shouldn't have been surprised when it melted, collector current is rated at 600mA, and I'm trying to run an air compressor off of that. I'm thinking the TIP120 should be sufficient for what I need: http://www.fairchildsemi.com/ds/TI/TIP120.pdf

Exitlights fucked around with this message at 20:48 on Oct 10, 2010

randyest
Sep 1, 2004

by R. Guyovich

Keebler posted:

Does anyone have any good places online to purchase wires with female terminals pre-crimped onto an end? Something where I could take like 10 of them and snap them into a plastic 2x5 connector to hook onto a pc board header.

I've found these:

http://www.pololu.com/catalog/category/71

But they're 2.54mm pitch and I'm looking for 2.0mm
I don't know about pre-crimped wires, but I got a bunch of terminals and a crimper pretty cheaply from Digikey.com . The stuff was cheaper there than my local store (U-do-it).

Scarboy
Jan 31, 2001

Good Luck!

randyest posted:

I don't know about pre-crimped wires, but I got a bunch of terminals and a crimper pretty cheaply from Digikey.com . The stuff was cheaper there than my local store (U-do-it).

Can you please provide item numbers. Whenever I look for crimping stuff I find ridiculously expensive Tyco/Amp tools that cost $800 to perform the most simple function.

Keebler
Aug 21, 2000
That's the reason I was looking for pre-crimped wires too, all the crimping tools that I could find were too expensive considering the amount of use I expected to get out of them.

ante
Apr 9, 2005

SUNSHINE AND RAINBOWS
Look up crimpers at http://www.dealextreme.com/
You can get some cheap as hell ones that'll last you a couple weeks, which is all you need. Free shipping, too.

CptAJ
Sep 15, 2007
El Capitanisimo
Uh... lil' help >_>

So I was messing around building a silly 60 second binary LED timer to get my feet wet programming MCUs. I'm using a PIC12F509 to light up some leds. Simple project.

Well, I found out the hard way that I should read the datasheet more thoroughly when my LED on GP3 wasn't working since it turns out that pin is input only. But now I have a more complicated issue. The pin on GP2 isn't working either and according to the datasheet that IS a regular, bidirectional IO pin. I've checked the led by lighting it up with my tester and it works. All the connections seem fine.

Here's the schematic from the whole project. I know now that the GP3 LED is wrong. Also, I realize I'm probably doing something stupid and fully admit that I'm an ignorant newbie that should read more before doing this stuff, but I can't help it. I need to get my hands dirty to learn :lol: So please, do enlighten me as to whatever else I'm doing wrong:



Here's the simplified TEST code. I'm using the CCS compiler and libraries. This code brings me no joy (reads: no light from the LED):

code:
#include <12f509.h>
#use delay (clock=4000000, internal)
#fuses INTRC,NOWDT,NOPROTECT

void main(){
   delay_ms(1000);
   while(TRUE){
      output_high(PIN_B2);
      delay_ms(2000);
      output_low(PIN_B2);
      delay_ms(2000);
   }
}
Here's the datasheet:
LINK

Hope thats enough. Thank you for your time in advance =)

Keebler
Aug 21, 2000
My only experience is with AVRs, not PICs but I believe you probably need to put GP2 into output mode:

quote:

On Reset, all I/O ports are defined as input (inputs are at high-impedance) since the I/O control registers are all set.

I think you need to do this through the TRISGPIO register.

CptAJ
Sep 15, 2007
El Capitanisimo
Keep in mind that the other LEDs DO light up (even though they're not in the simplified code version). I think the output_high() function does the setup automatically.

EDIT: Just in case, I changed the test code to use another pin and it does indeed light up. No settings required.

So yeah, what the hell is up with the GP2 pin? Faulty chip?

CptAJ fucked around with this message at 17:04 on Oct 11, 2010

Charles Ford
Nov 27, 2004

The Earth is a farm. We are someone else’s Ford Focus.

CptAJ posted:

Keep in mind that the other LEDs DO light up (even though they're not in the simplified code version). I think the output_high() function does the setup automatically.

It'd still be worth either investigating the C startup code your compiler is using or looking at the source to the output_* functions, who knows what they're doing. Perhaps before it calls your main it configures your chip with some outputs out and some in for some demo dev board. Do that or try explicitly setting the output anyway before deciding it's a dud chip or anything.

Mill Town
Apr 17, 2006

CptAJ posted:

Keep in mind that the other LEDs DO light up (even though they're not in the simplified code version). I think the output_high() function does the setup automatically.

EDIT: Just in case, I changed the test code to use another pin and it does indeed light up. No settings required.

So yeah, what the hell is up with the GP2 pin? Faulty chip?

GP2 is the MCLR pin, which is used to reset the PIC into programming mode. If you have it configured as the reset pin, it won't work as an output.

You should set it as a regular IO rather than as a reset, but if you do that right at the start of your code, you will no longer be able to program the device. To get around this, at the start of your code, you should set all devices as inputs and then pause for a second. After the pause, configure your outputs normally. This pause will give the programmer a chance to apply the programming voltage to MCLR and put it into programming mode.

You should also disconnect that LED while programming because the programming voltage is 13V which might burn out the LED.


Edit: oh wait i read that wrong. You already realized there was a problem with GP3 since it's input only. Let me get back to you about GP2.

Edit: Try clearing T0CS (bit 5) of the OPTION register.

datasheet posted:

Note: If the T0CS bit is set to ‘1’, it will override the TRIS function on the T0CKI pin

Mill Town fucked around with this message at 18:54 on Oct 11, 2010

babyeatingpsychopath
Oct 28, 2000
Forum Veteran


CptAJ posted:

Keep in mind that the other LEDs DO light up (even though they're not in the simplified code version). I think the output_high() function does the setup automatically.

EDIT: Just in case, I changed the test code to use another pin and it does indeed light up. No settings required.

So yeah, what the hell is up with the GP2 pin? Faulty chip?

If you think a function does something, it doesn't, unless it provably does. This is doubly true for setting pin I/O states. I hate the PIC libraries so bad that I end up writing almost all the setup in assembler.

Before your loop, explicitly set everything the way it needs to be.

BattleMaster
Aug 14, 2000

Yeah I almost never use hardware-specific library functions when programming PICs in C. I don't know about your compiler, but the official Microchip compilers define variables in the processor-specific header files mapped to special function registers. I always consult the datasheets and set up the hardware as needed through those. It's a tiny bit more work but at least you know what state the hardware is in at any given point.

Edit: Oh yeah I have my own question:

I'm powering a robotics project with a 12V battery. It needs 3.3V for the logic and about 5-6V for servos and DC motors. To save space on the board I'm going to use the main microcontroller (a dsPIC) to control a buck converter to get the lower voltage for the motors rather than to use a dedicated IC for that. The dsPIC itself will be powered by a linear regulator, but the current draw is so low that the high voltage drop shouldn't be a big deal. The buck converter will use a PWM generator and ADC channel on the PIC and will be regulated by software.

I've got the hardware designed and I don't think there are any issues with it, but what algorithm should I use to control the buck converter? I'm pretty decent at embedded programming but power control is new territory for me so I don't know where to begin with programming that.

BattleMaster fucked around with this message at 22:48 on Oct 11, 2010

CptAJ
Sep 15, 2007
El Capitanisimo
Aaaand Mill Town takes the cake. Thanks dude. That did it. Had to learn a bit of assembly there to set it up :pseudo:

Thanks for the advice guys. I'll keep it in mind next time =)

TacoHavoc
Dec 31, 2007
It's taco-y and havoc-y...at the same time!

BattleMaster posted:

I've got the hardware designed and I don't think there are any issues with it, but what algorithm should I use to control the buck converter? I'm pretty decent at embedded programming but power control is new territory for me so I don't know where to begin with programming that.

Go to http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=2524&param=en539690 and sort the device type to the appropriate dsPic family. There are a few different DC/DC code examples for different feedback types. That should get you started.

BattleMaster
Aug 14, 2000

TacoHavoc posted:

Go to http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=2524&param=en539690 and sort the device type to the appropriate dsPic family. There are a few different DC/DC code examples for different feedback types. That should get you started.

You know what the awesome thing is? I knew full well about the application notes library that Microchip has and I knew full well that they push the dsPIC for power control but for some reason I never bothered to check it out for help with this. drat I'm stupid.

Thanks for jogging my memory!

Mill Town
Apr 17, 2006

CptAJ posted:

Aaaand Mill Town takes the cake. Thanks dude. That did it. Had to learn a bit of assembly there to set it up :pseudo:

Thanks for the advice guys. I'll keep it in mind next time =)

No problem. For future reference you should be able to twiddle register bits from within C without using any assembly, with the bitwise AND and bitwise OR operators:

OPTION = OPTION & 0x11011111;

This will turn off the 5th bit and leave every other bit unchanged.

You can do the opposite (set a bit to 1) like so:

OPTION = OPTION | 0x00100000;

Extra fun trick: You can toggle a bit to the opposite of its previous state with ^, the XOR operator. Let's say you want to switch the output on GP0 to the opposite of its previous value, you would do:
GPIO = GPIO ^ 0x00000001

For explanation as to why this all works, see here: http://www.cprogramming.com/tutorial/bitwise_operators.html

SnoPuppy
Jun 15, 2005

Exitlights posted:

OK, tested my circuit out today, and had a bit of a problem. First, here's the circuit I put together:



Transistor is a 2N4401, FWIW. The way my car works is that + and - on the door lock/unlock/car start, when connected, activates whichever system it's for. So, connect + and - to each other for the door lock, and the doors lock.

So, I hooked up the + and - terminals on the car's door lock terminals to the + and - on the door lock part of my circuit, and connected the + and - on the uC part of my circuit to the 5v and ground on my MCU. This lit the transistor on fire (in particular, the emitter terminal looks like it was what lit on fire, since it's missing a leg now...). What happened?

I've got a couple guesses, but some insight would be great. I'm thinking that the 5v on the 2N4401 wasn't enough to *fully* close the collector-emitter connection, so the remaining resistance between the two was enough to light the transistor on fire. Another alternative is that I don't really understand transistors too thoroughly, and it's impossible to get rid of enough resistance to channel all the current my car needs to control these systems through a pretty cheap transistor. Or some third thing that I didn't consider.

So, I need a new transistor, or need to switch to a relay (may need a transistor to switch the relay, ugh). Which is it?

Edit: here's a thought, since I'm worried about the amount of current my MCU is putting out to control the collector-emitter path: should I use a Darlington transistor instead?

Edit2: looking at the specs for the transistor I got, I really shouldn't have been surprised when it melted, collector current is rated at 600mA, and I'm trying to run an air compressor off of that. I'm thinking the TIP120 should be sufficient for what I need: http://www.fairchildsemi.com/ds/TI/TIP120.pdf

Since no one has addressed this yet - yeah, your LED lit up like a candle because your solenoid looks just like a short under DC conditions (it is a wire after all).

So you were pretty much shorting your battery to ground through the transistor.

I'd get a bigger transistor (or better yet, a MOSFET) and put a small series resistance in the current path to prevent shorting under steady state.

BattleMaster
Aug 14, 2000

Mill Town posted:

No problem. For future reference you should be able to twiddle register bits from within C without using any assembly, with the bitwise AND and bitwise OR operators:

OPTION = OPTION & 0x11011111;

This will turn off the 5th bit and leave every other bit unchanged.

You can do the opposite (set a bit to 1) like so:

OPTION = OPTION | 0x00100000;

Extra fun trick: You can toggle a bit to the opposite of its previous state with ^, the XOR operator. Let's say you want to switch the output on GP0 to the opposite of its previous value, you would do:
GPIO = GPIO ^ 0x00000001

For explanation as to why this all works, see here: http://www.cprogramming.com/tutorial/bitwise_operators.html

The bonus is that the C compilers are smart enough to turn those into the appropriate BCF, BSF, and BTG instructions rather than using a MOVLF and ANDWF/IORWF/XORWF pair.

And of course I don't know about non-Microchip compilers but the Microchip headers define bitwise structures that let you do the same things without having to remember bitmasks. Be sure to look into that, maybe yours will let you access bits like that, too.

CptAJ
Sep 15, 2007
El Capitanisimo

Mill Town posted:

No problem. For future reference you should be able to twiddle register bits from within C without using any assembly, with the bitwise AND and bitwise OR operators:

OPTION = OPTION & 0x11011111;

This will turn off the 5th bit and leave every other bit unchanged.

You can do the opposite (set a bit to 1) like so:

OPTION = OPTION | 0x00100000;

Extra fun trick: You can toggle a bit to the opposite of its previous state with ^, the XOR operator. Let's say you want to switch the output on GP0 to the opposite of its previous value, you would do:
GPIO = GPIO ^ 0x00000001

For explanation as to why this all works, see here: http://www.cprogramming.com/tutorial/bitwise_operators.html

Yeah, I'm familiar with bitwise operations. I just didn't know how to get to the register from C so I just looked up the asm instructions since it was kinda simple. I didn't see OPTION defined anywhere.

ANIME AKBAR
Jan 25, 2007

afu~

SnoPuppy posted:

Since no one has addressed this yet - yeah, your LED lit up like a candle because your solenoid looks just like a short under DC conditions (it is a wire after all).

So you were pretty much shorting your battery to ground through the transistor.

I'd get a bigger transistor (or better yet, a MOSFET) and put a small series resistance in the current path to prevent shorting under steady state.
Most solenoids have resistance built in so that they draw the proper current at their rated voltage. You should only need to add resistance if you're driving it at a higher voltage than its rating. But yeah, using a decent mosfet should work much better than a little BJT. A IRF510 or similar part should work fine.

Mill Town
Apr 17, 2006

CptAJ posted:

Yeah, I'm familiar with bitwise operations. I just didn't know how to get to the register from C so I just looked up the asm instructions since it was kinda simple. I didn't see OPTION defined anywhere.

It should be defined in 12f509.h although it may be called something else.

CapnBry
Jul 15, 2002

I got this goin'
Grimey Drawer

Scarboy posted:

Can you please provide item numbers. Whenever I look for crimping stuff I find ridiculously expensive Tyco/Amp tools that cost $800 to perform the most simple function.
So true. I ended up just buying the crimper from Pololu. As far as the pins and receptacles and all, they're impossibly hard to find due to each brand and size falling under a different category. For instance, the 2.54mm molex female crimp terminal is under Interconnects > Rectangular Connectors > Headers & Wire Housings then select Termination Style = Crimp and Product Type = Contact. However, the 2.0mm molex female crimp terminal is under Interconnects > Terminals then Product = Crimp Terminals. I usually go through their Silverlight "enhanced catalog" and go page by page until I stumble across the right page.

I have a question too, which I sort of hit on a few pages back. If I wanted to convert a 5V 500Hz PWM to a 5V-12V output 250mA max (I also have a 12V line), how would I achieve this goal. I thought I'd be able to do it like a switching power supply with a logic-level N-channel MOSFET, an inductor, capacitor and a diode, but when applied to my load the results are the same as without the inductor (except with bigger voltage spikes on the PWM pulse edges). I keep thinking I'm going about this all wrong because it seems like something simple enough to do, convert the duty cycle directly to a proportional voltage.

CptAJ
Sep 15, 2007
El Capitanisimo
Anyone got a link to a good writeup on PIC data communications? I want to try out some pic-to-pic communication excercises but I can't find the right documentation. I see a lot of talk about USART modules for RS232 serial communication but... can't the regular I/O pins on most of these MCUs be used for data transfer and even serial communications?

Zo
Feb 22, 2005

LIKE A FOX
Yes you can program a serial module in software but the UART modules do that for you, greatly simplifying the amount of work you have to do (down to basically nothing).

Just read the datasheet of whatever PIC you're using, it's usually pretty easy to get it start working. If you run into a problem 90% of the time it's because you set up the protocol wrong (ie not 9800-8-n-1).

I recommend getting a USB breakout board for early testing from PC to PIC, like http://www.sparkfun.com/commerce/product_info.php?products_id=718

CapnBry posted:

I have a question too, which I sort of hit on a few pages back. If I wanted to convert a 5V 500Hz PWM to a 5V-12V output 250mA max (I also have a 12V line), how would I achieve this goal. I thought I'd be able to do it like a switching power supply with a logic-level N-channel MOSFET, an inductor, capacitor and a diode, but when applied to my load the results are the same as without the inductor (except with bigger voltage spikes on the PWM pulse edges). I keep thinking I'm going about this all wrong because it seems like something simple enough to do, convert the duty cycle directly to a proportional voltage.
I don't know, you can drop a low pass filter there but you'll be fighting with the various parameters to get your ripple, time constant etc to where you want it. What do you need it for anyways? It's usually easier to design from the end backwards.

SnoPuppy
Jun 15, 2005

CapnBry posted:

I have a question too, which I sort of hit on a few pages back. If I wanted to convert a 5V 500Hz PWM to a 5V-12V output 250mA max (I also have a 12V line), how would I achieve this goal. I thought I'd be able to do it like a switching power supply with a logic-level N-channel MOSFET, an inductor, capacitor and a diode, but when applied to my load the results are the same as without the inductor (except with bigger voltage spikes on the PWM pulse edges). I keep thinking I'm going about this all wrong because it seems like something simple enough to do, convert the duty cycle directly to a proportional voltage.

You should just be able to do it passively - use a diode and an LC filter to smooth the output (or no diode, but that puts more requirements on the filter).

5V 500 Hz and 250 mA is going to be tough - you will need big inductors/caps in the LC filter to smooth out the voltage (like mH and mF). There is a reason why most switchers operate in the 100s of kHz to MHz range.

How fast do you need to respond to duty cycle changes? And how much resolution do you need?

Charles Ford
Nov 27, 2004

The Earth is a farm. We are someone else’s Ford Focus.

Zo posted:

I recommend getting a USB breakout board for early testing from PC to PIC, like http://www.sparkfun.com/commerce/product_info.php?products_id=718

I'd also recommend the pure simulator in MP-LAB. It freaks out a lot, and doesn't support a lot of complex modules like the PIC USB stuff (which I use regularly) but it does simulate RS232 (reading to/from files) and supports simulated input and logic analyzer display for I/O pins, meaning you can test your bit-banging code entirely in the PC before trying it out in the real world. I've done this a number of times with lots of success, it's extremely handy (most recently to debug some PWM assembler not starting up properly)

BattleMaster
Aug 14, 2000

Zo posted:

I recommend getting a USB breakout board for early testing from PC to PIC, like http://www.sparkfun.com/commerce/product_info.php?products_id=718


If you feel like you're serious enough about working with PICs, consider getting an ICD3 for exactly that reason. I'm a big fan of breakpoints and watch variables to make sure stuff gets executed properly.

randyest
Sep 1, 2004

by R. Guyovich

Scarboy posted:

Can you please provide item numbers. Whenever I look for crimping stuff I find ridiculously expensive Tyco/Amp tools that cost $800 to perform the most simple function.
I'm searching for my packing slip or order confirmation but I'm not having much luck so far. I'll browse the site to see if I can find the exact one I got, but digikey can be a maze. I'm pretty sure it's Aven brand, and was about $20.

CptAJ
Sep 15, 2007
El Capitanisimo
Thanks for the advice. I haven't really gotten into debuggers yet. Maybe when I move to more complicated projects, but right now it hasn't been that much of a necessity. My code is pretty simple.

So, back to bit banging. Its much easier finding info now that I know the name of what I'm looking for :argh:

This is great. So... how about PWM, can I do that with software too?

CapnBry
Jul 15, 2002

I got this goin'
Grimey Drawer

SnoPuppy posted:

You should just be able to do it passively - use a diode and an LC filter to smooth the output (or no diode, but that puts more requirements on the filter).

5V 500 Hz and 250 mA is going to be tough - you will need big inductors/caps in the LC filter to smooth out the voltage (like mH and mF). There is a reason why most switchers operate in the 100s of kHz to MHz range.
Yeah I've been messing around with doing an asynchronous buck converter design, and calculated that I'd need... I forget, but around 1mH and even that would have a pretty high ripple current at the cap. I thought that there might be a prepackaged component to convert PWM to a proportional output, or a "just set up 2 transistors like so". Thanks for the response confirming what I thought about the values of the components. I think I'm going to avoid the problem altogether by redesigning part of my solution.

Charles Ford
Nov 27, 2004

The Earth is a farm. We are someone else’s Ford Focus.

CptAJ posted:

This is great. So... how about PWM, can I do that with software too?

That's how I do it. I made a board to make the screen go up and down in my Mazda RX-8's OEM satnav hood - I got it with all the electronics missing, except the buttons and motor. I made a USB interface to these using a PIC, and the PIC uses PWM out of three inputs to control the brightness of the LEDs for each button (independently, so you could have open throb or whatever) as well as the brightness of the LCD backlight LED. The PIC has a PWM module but instead I just used a timer to generate a timebase. When the interrupt appears, I decrement a counter. If it hits 0, I toggle the state, and load the amount of time to keep the new state into the counter (the amount of time 'on' is the opposite of the amount of time 'off'). Works perfectly :)

Gorfob
Feb 10, 2007
I haven't done any thing like this ever before.

My eventual aim is to make some solar powered gear for camping. Aiming to run a 5w CFL for a few hours at night and provide LED strip lighting for in the tent.

What should I be looking at?

EDIT: Basically this http://www.jaycar.com.au/productView.asp?ID=MP4552 but built from scratch.

Gorfob fucked around with this message at 09:23 on Oct 14, 2010

edmund745
Jun 5, 2010
I have a quick question maybe somebody knows...

I have a grinder tool that I want to clock the RPMs of, which is 35,000 or so.

I have a multimeter with a frequency counter function that goes to 10 MHz, and have a photocell cut from an automatic dusk-to-dawn light fixture. The multimeter needs .8V to trip, and the photocell drops in resistance, from a couple thousand ohms to a hundred or so.

What I am wondering is if I can just run the photocell in series (or parallel) with a 1.5V battery, to the frequency counter? The multimeter's internal voltmeter resistance is 7.5Mohms, but it doesn't say what the figure is for the frequency function....
~

Adbot
ADBOT LOVES YOU

ante
Apr 9, 2005

SUNSHINE AND RAINBOWS
If it requires a voltage to trip, then the multimeter should be using the voltmeter function to count.




So I just got given a big bag of LEDs that are "burnt out."

What's a fun project that uses about 100 UV LEDs?

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