Pages: [1] 2   Go Down
Author Topic: Using Arduino instead of a TL494  (Read 4828 times)
0 Members and 1 Guest are viewing this topic.
Italy
Offline Offline
Full Member
***
Karma: 0
Posts: 158
Arduino = Tecnologia
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

It's possible use Arduino instead of a TL494 to make this Circuit:
How it's possible to emulate the TL494???

Thanks.

Logged

Se ritieni che la mia risposta ti abbia aiutato a risolvere il problema non esitare! ringraziami dandomi il Karma! smiley-wink
_-_-_-_-_-_-_-_-_-_-_-

United Kingdom
Offline Offline
Tesla Member
***
Karma: 224
Posts: 6619
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

The only problem I can see with using an Arduino instead is that the response time of the feedback loop may be a little slower; but I don't think that should be a problem. You'll need to read the Hall sensor and the pot from analog pins. Replace the thermistor by a temp sensor and read that from an analog pin too, so that you don't need the comparator.

Change the 68 ohm resistor to 120 ohm and the 820 ohm resistor to 10K. I suggest replacing the BUZ31L mosfet with another that has a lower Rds(on) at Vgs=5v so that it runs cooler.
« Last Edit: August 31, 2011, 01:00:49 pm by dc42 » Logged

Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

Italy
Offline Offline
Full Member
***
Karma: 0
Posts: 158
Arduino = Tecnologia
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes, i'm thinking that the slow response it isn't a problem...
But how i can use arduino to emulate the TL494 characteristic???
Thanks.
Logged

Se ritieni che la mia risposta ti abbia aiutato a risolvere il problema non esitare! ringraziami dandomi il Karma! smiley-wink
_-_-_-_-_-_-_-_-_-_-_-

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17294
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Rather then think about how to emulate the TL494, think about what an arduino would need to accomplish the same task. The output of the arduino could generate a PWM output signal using analogWrite() commands wired to a 'logic level' mosfet to control the current supplied to the magnet. The Arduino would also need a sensor input to be able to detect (measure) the distance that the object if from the magnet face, and that would use some sensor that can generate a 0-5vdc measurement value for wiring to a arduino analog input pin.

The rest is all just software. As the object gets closer to the magnet the PWM command would lower the duty cycle value and as the object gets further away the PWM could increase the PWM duty cycle. Looks like a interesting project.

Lefty
 
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 627
Posts: 34246
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I once had a student do this for me for his final year degree project in physics. Note that the electronics is the simplest part of this. He did get it working but the mechanics was the most difficult part. It is very tricky getting it "just right".
Good luck.
Logged

Italy
Offline Offline
Full Member
***
Karma: 0
Posts: 158
Arduino = Tecnologia
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes, I believe that the mechanical part is not to be neglected at all.
The measure of distance is apparently regulated by the potentiometer which in turn handles the change of the PWM signal sent to the MOSFET, so the more the object is close to the electromagnet will be low as the PWM duty cycle and vice versa ...

But then, that is the function of the hall effect sensor??

Now I'm wondering if there is a procedure for doing Arduino to do this work.

Thanks
Logged

Se ritieni che la mia risposta ti abbia aiutato a risolvere il problema non esitare! ringraziami dandomi il Karma! smiley-wink
_-_-_-_-_-_-_-_-_-_-_-

Italy
Offline Offline
Full Member
***
Karma: 0
Posts: 158
Arduino = Tecnologia
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

alternatively if the circuit is easier I could build this ...




But how can I get the same function without using the OP-AMP and using Arduino???
Thanks
Logged

Se ritieni che la mia risposta ti abbia aiutato a risolvere il problema non esitare! ringraziami dandomi il Karma! smiley-wink
_-_-_-_-_-_-_-_-_-_-_-

UK
Offline Offline
Sr. Member
****
Karma: 4
Posts: 331
Arduino - very interesting !
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

looks like an interesting project

do you want the metal object to float in the air ?

i suggest you use a steel ball that has a uniform mass and density to start with and pwm the coil using a potentiometer

you can then find out what roughly pwm duty cycle the device needs to remain stable

then you can fine tune the pwm using software from that point in closed loop

can you show us some pics of the parts you are using for the electromagnet
Logged

United Kingdom
Offline Offline
Tesla Member
***
Karma: 224
Posts: 6619
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

To emulate the TL494 in that circuit, your main loop will need to look something like this:

read temp sensor
if temp is too high then turn mosfet off
else read Hall sensor
   adjust offset and scale reading to get a value in the range 0 to 1023 for values of the height you want
   read pot
   compare pot reading with adjusted Hall sensor value
   use difference to adjust PWM output to mosfet (there are various ways of doing this, but a PID algorithm is the most flexible)

If you haven't used an Arduino before, I suggest you work through the tutorials, in particular how to use analogRead and analogWrite and how to set up the pins to the correct mode.
Logged

Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

Italy
Offline Offline
Full Member
***
Karma: 0
Posts: 158
Arduino = Tecnologia
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for the replies very fast and rich in content,  smiley-eek
@ dc42:
reading the temperature sensor has already been made.
I do not know as they once compared the signal between the sensor and the potentiometer how to adjust the intensity of the PWM, I'd need something simple that can make it clear.

in other words, after comparing the two signals (compared how??) in a manner that resulted in sending the result to the change in PWM MOSFET? smiley-red

Thank you. smiley
Logged

Se ritieni che la mia risposta ti abbia aiutato a risolvere il problema non esitare! ringraziami dandomi il Karma! smiley-wink
_-_-_-_-_-_-_-_-_-_-_-

United Kingdom
Offline Offline
Tesla Member
***
Karma: 224
Posts: 6619
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

To adjust the PWM, use something like this:

int oldError = error;
error = potReading - adjustedHallValue;
accumulatedError += error;
int pwmOutput = 128 + P * error + D * (error - oldError) + I * accumulatedError;
analogWrite(outputPin, (pwmOutput < 0) ? 0 : (pwmOutput > 255) ? 255 : pwmOutput);

where P, D and I are constants you need to adjust to get it stable. Start with D = 0 and I = 0. I'd suggest starting with P about 10. Too low and and the solenoid will probably drop the load; too high and it will be unstable i.e. too much height oscillation.

Depending on the sense of the error signal, you may need to negate 'error' at the start (you want 'error' to increase when the solenoid needs to pull more strongly). You can use the serial interface to display on the PC the readings from the Hall sensor and the pot, and the error and output values, so that you can see what is going on. However, calling Serial.print in the loop will slow it down, so if/when you remove it, you will need to decrease the value of D if it is not zero, or else insert a dely call in place of the Serial.print calls.
« Last Edit: September 01, 2011, 08:48:16 am by dc42 » Logged

Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

Italy
Offline Offline
Full Member
***
Karma: 0
Posts: 158
Arduino = Tecnologia
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The P and D constants are a user defined costants or Potentiometer constants.

i don't understands this two lines of codes:

Quote
int pwmOutput = 128 + P * error + D * (error - oldError) + I * accumulatedError;
analogWrite(outputPin, (pwmOutput < 0) ? 0 : (pwmOutput > 255) ? 255 : pwmOutput);

What is the 128?
It's possible to regulate the P D and I constants automatically???
you may better describe the three variables P D and I?


Thanks
Logged

Se ritieni che la mia risposta ti abbia aiutato a risolvere il problema non esitare! ringraziami dandomi il Karma! smiley-wink
_-_-_-_-_-_-_-_-_-_-_-

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 303
Posts: 26354
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
What is the 128?
Half of 256.
The Arduino's PWM is eight bit/
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Italy
Offline Offline
Full Member
***
Karma: 0
Posts: 158
Arduino = Tecnologia
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Sorry!!!
 smiley-red smiley-red smiley-red

Logged

Se ritieni che la mia risposta ti abbia aiutato a risolvere il problema non esitare! ringraziami dandomi il Karma! smiley-wink
_-_-_-_-_-_-_-_-_-_-_-

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 627
Posts: 34246
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

You do know that the levitation distance from the magnet is going to be very small, in the order of a couple of mm.
Logged

Pages: [1] 2   Go Up
Jump to: