From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Closed loop simulation using arduino uno

Solved!
Go to solution

Hello I am working on a project where I want to make a closed loop simulation using arduino UNO. Is it possible to do so ? I am using accelerometer as a sensor and stepper motor. I am familiar to labview and I have made a programming for accelerometer to read using arduino it works great and I also have my stepper motor working. My goal is to make accelerometer read the acceleration and give it to stepper motor to make it work. Can anyone help me ASAP ?

0 Kudos
Message 1 of 7
(3,988 Views)
Solution
Accepted by topic author sandeepganti

Hello there,

 

Thanks for using the NI Discussion Forums! If you are looking to make closed loop simulations with arduino, I recommend you to try out the NI LabVIEW Interface for Arduino Toolkit. You can try out the “Stepper Motor Example” and combine it with the “Analog Read Pin” VI example.

 

I hope this helps.

Regards,
Daniel REDS
RF Systems Engineer

Help us grow.
If a post solves your question, mark it as The Solution.
If a post helps, give Kudos to it.
0 Kudos
Message 2 of 7
(3,957 Views)

Hello Daniel,

 

thanks for your help. I did install the vipm as well as the interface for arduino longback.I have my own programming for the MMA7361accelerometer to read and now I am working on the stepper motor and a closed loop connection. I am little bit confused how the "Arduino Input Pin" example will be connected to the stepper motor.vi  example as it divided into number of parts. It consists of "stepper write" , "stepper configure", "stepper to go". I am not really sure how and where it should go and connect.

 

 

0 Kudos
Message 3 of 7
(3,941 Views)

Hello,

 

I would recommend you to follow the Producer/Consumer architecture to implement both examples. In your case, your producer loop would be the “Arduino Input Pin” example and your consumer will be the whole “Servo Example.vi” plus the logic to set the angle depending on the acceleration read.

 

Regards,
Daniel REDS
RF Systems Engineer

Help us grow.
If a post solves your question, mark it as The Solution.
If a post helps, give Kudos to it.
0 Kudos
Message 4 of 7
(3,934 Views)

In the acclerometer output waveform graph, the x-axis stand for time in milliseconds and the y-axis stands for amplitude. So what does the units for this mean whether should I take them as in G's or in m/sec^2 as sometimes the values start from 2 and reach til 150 in y-axis. 

0 Kudos
Message 5 of 7
(3,827 Views)

If you drill into the Analog Read Pin VI, you find that there is a "Send Receive" VI. The comments say that after the processing done, you read in volts. The MMA7361L datasheet says that the sensitivity is software selectable, either 800 mV/g (if you select 1.5g) or 206 mV/g (if you select 6g). If your sensitivity is 800 mV/g and your voltage is 150 V, your acceleration would be 150 V / (0.8V/g) = 187.5 g. Obviously the y axis value isn’t scaled.

 

Volts Read [V] / Sensitivity [V/g] = Acceleration [g]

 

What I’d recommend is to read in a known voltage, like a battery. If the voltage is not what you’re expecting, try to modify the “Volts Per AtoD Bit” constant so get the value you expect. After that, you can make the voltage to acceleration conversion like I described above.

 

Analog Read Pin.PNG

Regards,
Daniel REDS
RF Systems Engineer

Help us grow.
If a post solves your question, mark it as The Solution.
If a post helps, give Kudos to it.
0 Kudos
Message 6 of 7
(3,820 Views)

Might work with state machines, this Mamera trajas structured manner, ie for example you could do the reading first and then the engine control is just one sujerencia, I hope you serve

 

http://www.ni.com/white-paper/3024/en/

0 Kudos
Message 7 of 7
(3,759 Views)