Show Posts
Pages: 1 ... 16 17 [18]
256  Forum 2005-2010 (read only) / Bugs & Suggestions / Re: Please update OneWire page for DS18B20 on: April 20, 2008, 01:04:09 pm
So I am very excited because I plugged a DS18B20 into my arduino and it worked.  It is happily spitting out these values.

R=28 9E 91 8C 1 0 0 A6 P=1 A2 1 4B 46 7F FF E 10  CRC=D8

I know next to nothing about programming and got this to work by simply copying and pasting the code from this page and changing the family code to 0X28 and adding the one wire library to the arduino programming environment.  The next thing I would like to know is how to write the code to have the arduino convert the hex data above to a readable temperature format (i.e. 35 degrees C or something.....better yet....a farenheit conversion)
257  Forum 2005-2010 (read only) / Syntax & Programs / Re: Creating AC from DC using PWM on: July 29, 2008, 08:56:56 pm
You can get PWM frequencies much faster than 490 Hz.  Look at the ATmega168 datasheet or search this forum for posts I've made about generating PWMs with arbitrary frequencies (searching for posts by bens containing "PWM frequency" should probably bring them up).

As far as what you're planning on doing, I'm not sure how you expect to get a PWM pin to output a negative voltage.  I assume your plan is to use MOSFETs or transistors to deliver the current to the motor (since the mega168 most likely cannot deliver what will be needed), and I guess you will be using a negative regulator to generate the negative half of the sine wave?

- Ben

Yes the plan would be to use the arduino to handle the switching and use transistors to handle the actual current.  I am very novice with this so the plan was to try it out on a small 12V AC motor first so that I don't kill myself playing with the full 120V outlets.
258  Forum 2005-2010 (read only) / Syntax & Programs / Re: Creating AC from DC using PWM on: July 28, 2008, 01:29:45 pm
Sure.  I am looking to control the speed of an AC motor (low power....far less than 1 amp) and I want the arduino to control the speed.  With an AC motor I know that the speed is really a function of the frequency of the AC and the number of poles (windings).  I want to vary the frequency and voltage to slow the motor down or speed it up.  I have read that you can create a pseudo sine wave with pulse width modulation.  In other words the duty cycle would be low where the sine wave crosses zero volts and then increase as the sine wave reaches its apex and then decrease back through 0 volts and then increase again (except using a negative voltage (possibly on a different pin) as the sine wave reaches its trough and then decreases again through 0 volts.  I probably don't need to break up the sine wave into 40 steps to achieve what I am trying to do but I was thinking higher resolution would create a closer approximation of a sine wave.
259  Forum 2005-2010 (read only) / Syntax & Programs / Creating AC from DC using PWM on: July 27, 2008, 06:21:27 pm
I am trying to use PWM to create an AC current from a DC source.  I was hoping to use about 40 steps per cycle.  The issue I am thinking about is that a standard wall outlet is 60 HZ so if I use 40 steps per HZ that will equal 2400 total steps and the PWM pins on the Arduino operate at 490 HZ.  Correct me if I am wrong but the program will be incrementing about 5 steps for every pulse that comes out of the PWM pins.  Do I just have to use less steps or is there a trick that I can use to get the frequency of the PWM signal up?
260  Forum 2005-2010 (read only) / Syntax & Programs / Re: attachInterrupt question on: July 21, 2008, 09:25:04 am
That looks pretty good.  I'm gonna try it.  Thanks!
261  Forum 2005-2010 (read only) / Syntax & Programs / attachInterrupt question on: July 20, 2008, 09:34:45 pm
I am using a DS18B20 temperature sensor to display temperature data onto a serial LCD.  I have a simple push button that I use to toggle back and forth between celsius and farenheit.  I am using the attachInterrupt command to read the push button.  My problem is that the pushbutton seems to need some sort of debounce because occassionally it will toggle from celsius to farenheit and back to celsius on one push.  Would the debounce routine go somewhere in the function that is called by the interrupt?  
262  Forum 2005-2010 (read only) / Troubleshooting / Re: rs-232 wire gets warm on: July 22, 2008, 07:11:10 am
I seem to recall reading somewhere that it was unwise to do that.


Do you remember what the reasons were for that?  Like I said above....I am very new to all of this.
263  Forum 2005-2010 (read only) / Troubleshooting / Re: rs-232 wire gets warm on: July 21, 2008, 09:02:31 am
Oh geez I bet you are right.  I didn't even think of that.  I am getting the nine volts from the power supply by using the +12V and +3.3V wires.  The rs-232 is expecting a true ground and my 9V is referenced to a +3.3V ground.  I'm surprised I didn't fry my serial port or worse my entire mother board.  I'm really new to this hobby so unfortunately I will probably make many more of these mistakes.
264  Forum 2005-2010 (read only) / Troubleshooting / rs-232 wire gets warm on: July 20, 2008, 10:03:08 am
I have noticed that if I run my freeduino (NKC Electronics Serial V.1)  from a 9V wall wart everything is fine but if I run 9 volts (voltmeter shows 8.71V) from a computer power supply through the Vin and Gnd, the rs232 line gets noticeably warm.  Is there a current limiting resistor that I should be running in between the power supply and the Vin on the board?  Looking at the schematic for this board, it seems that the input from the wall wart and the Vin are electrically common except for a 1N4004 diode that runs between them.  Any ideas on why this may be happening?

265  Forum 2005-2010 (read only) / Interfacing / Re: GPS on: July 22, 2008, 07:13:39 am
Is this what you are looking for?
266  Forum 2005-2010 (read only) / Interfacing / Re: precision timing with the arduino on: April 23, 2008, 06:49:24 am
Excellent!  Thanks both of you for clearing that up for me.
267  Forum 2005-2010 (read only) / Interfacing / Re: precision timing with the arduino on: April 22, 2008, 04:59:33 pm
well there is never a "perfect" 50 mils, it's gonna be very close, probably more like 50.43296 ms, but you can't tell the diffrence! so don't worry, and i don't belive that the code stalls to execute, it just runs what it need to run , but then again you could always test it to make sure...

He's talking about the microsecond delay function though, so being off by 0.432ms, is about 800% off.

But when you say "truly delaying for 50 microseconds" there is no such thing.  You have a finite level of precision in any timing device.

In this case, the answer in the documentation is "This function works very accurately in the range 3 microseconds and up. We cannot assure that delayMicroseconds will perform precisely for smaller delay-times."  

I would hope that for values greater than 3uS, it will get you within a uS.

So the compiler is taking into account the time it takes to actually run through the lines of code in the routine delaymicroseconds and working out the calculations necessary to achieve the requested time delay(plus or minus some reasonable error).  Is that a correct statement?
268  Forum 2005-2010 (read only) / Interfacing / precision timing with the arduino on: April 22, 2008, 03:49:25 pm
This is probably a simple question but I am trying to write an application that requires very precise timing.  When we write the line of code:

delaymicroseconds (50);

are we truly delaying for 50 microseconds or is it 50 plus however much time it takes to run the routine called delaymicroseconds?
Pages: 1 ... 16 17 [18]