Go Down

Topic: Using Arduino instead of a TL494 (Read 5 times) previous topic - next topic

fardox

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

Thanks.

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

dc42

#1
Aug 31, 2011, 07:50 pm Last Edit: Aug 31, 2011, 08:00 pm by dc42 Reason: 1
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.
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.

fardox

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.
Se ritieni che la mia risposta ti abbia aiutato a risolvere il problema non esitare! ringraziami dandomi il Karma! ;)
_-_-_-_-_-_-_-_-_-_-_-

retrolefty

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

Grumpy_Mike

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.

fardox

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
Se ritieni che la mia risposta ti abbia aiutato a risolvere il problema non esitare! ringraziami dandomi il Karma! ;)
_-_-_-_-_-_-_-_-_-_-_-

fardox

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
Se ritieni che la mia risposta ti abbia aiutato a risolvere il problema non esitare! ringraziami dandomi il Karma! ;)
_-_-_-_-_-_-_-_-_-_-_-

Gadget999

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

dc42

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.
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.

fardox

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. :)
Se ritieni che la mia risposta ti abbia aiutato a risolvere il problema non esitare! ringraziami dandomi il Karma! ;)
_-_-_-_-_-_-_-_-_-_-_-

dc42

#10
Sep 01, 2011, 03:43 pm Last Edit: Sep 01, 2011, 03:48 pm by dc42 Reason: 1
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.
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.

fardox

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
Se ritieni che la mia risposta ti abbia aiutato a risolvere il problema non esitare! ringraziami dandomi il Karma! ;)
_-_-_-_-_-_-_-_-_-_-_-

AWOL

Quote
What is the 128?

Half of 256.
The Arduino's PWM is eight bit/
"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.

fardox

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

Grumpy_Mike

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

Go Up