07-14-2013 09:41 AM
Hello,
This is my first labview project so i have lots of questions.
I want to use a mx2125 accelerometer for a school project with an USB 6218 NI DAQ.
I want to read the tilt angle from the accelerometer and than control 2 servo motors to those angles.
I am having problems reading the duty cycle of the mx2125 with daq assistant and pulse measurement block. On a flat surface it should read 500m but it seems to vary from 495 to 505 is it normal?
Also setting up the daq assistant seems tricky I do not fully understand how to use sample rate and number of samples and if it should be continous samples or n samples ?
I am currently using a rate of 10k HZ with 1k samples is this ok?
07-15-2013 12:23 AM
Hi milupus,
I have check the manual for MX2125 from the internet.
http://www.parallax.com/Portals/0/Downloads/docs/prod/sens/28017-Memsic2Axis-v2.0.pdf
Seems like there is a range of 48.7% to 51.3% tolerance on this.
Meanwhile, the axis output should be 100Hz PWM signal, so the period will be 10ms, the duty cycle will be vary around 5ms instead, please correct me if I am wrong?
Regards,
KwokHow
07-15-2013 02:22 AM
This is what I get on a flat surface. Values of -3.5656 , 0 and +3,5656 but I think it is normal. What I want to do now is to program 2 servos to move to those angles, any idea how to do that and have a smooth movement? Thanks!
07-15-2013 03:40 PM
Any ideas on how to control servos? I think i need to output a pwm signal but i don't know how to do it, should i use a digital output or an analog output?
07-15-2013 03:58 PM
PWM for servo control? What servos are you using? Usually you just need a DC analog voltage...
07-15-2013 04:53 PM
This is my first labview project so I am not sure how to do it properly.
I am using 2 x TowerPro SG90 9G servos but i am unable to find their datasheets.
07-15-2013 05:04 PM
No datasheet? Well that does present a challenge, doesn't it?
According to http://www.hobbypartz.com/topromisesg9.html , the operating voltage is 4.0-7.2 volts. These are analog values.
From your description, you need to create a conditional statement that sends the appropriate servo a voltage within this range when the accelerometer indicates that your device has tilted one way or the other. You could use a case structure to accomplish this.
As for what voltage to use... You'll have to experiment.
07-19-2013 11:25 AM - edited 07-19-2013 11:33 AM
This is the output of my arduino with a working servo code. First graph is for position 0 second one is for 180 degrees.
I have wired the digital pin used for signal on arduino directly to an input on my daq and got these graphs. I have used only one wire.
How to obtain those signals in labview and control my servo?
07-19-2013 01:33 PM
I checked with an oscilloscope and I am using the same signals from my Arduino(where it works) and from my DAQ Analog output(where it doesnt). However when I connect the servo to the USB 6128 NI DAQ I hear the pwm inside the motor, changing the duty cycle also changes the buzz frequency. Could this mean the DAQ can not provide enough current to move the servo?
The input pwm signal is fixed at least.
07-20-2013 06:30 AM
Ok, I tried with an external power source and it works. It seems like the USB 6218 is not providing enough current to the servo. How come a 10$ arduino board can do this and this National Instruments expensive board can't?