Skip to content

Position control of a simple pendulum (One DOF) with architecture implemented in LabVIEW FPGA and Python. A rotary encoder was used to know and manipulate the position and an H-bridge for servo motor control.

License

Notifications You must be signed in to change notification settings

nightcomnit/PositionControl-SimplePendulum

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PositionControl-SimplePendulum

Position control of a simple pendulum (One DOF) with architecture implemented in LabVIEW FPGA and Python through the nifpga-python library.

Methodology

A servomotor, controlled by means of an h-bridge is used for the change of rotation, to which a rotary encoder was included (Figure 1). Through this the desired pendulum position is controlled, in LabVIEW a module was implemented to read the pulses of the rotary encoder by means of an X4 coding and to be able to control the position of the servomotor with the help of the h-bridge.

Figure 1. Namiki rotary encoder servo motor.

A model was designed in CAD for the structure where the servomotor and circuits were mounted (Figure 2,3).

Figure 2. CAD design front view.

Figure 3. CAD design back view.

The programming in LabVIEW is oriented to graphic programming called "G", for which the programming was carried out in such a way that the signal of the rotary encoder is received, to know the position in which the axis of the servomotor is located. For this, in the programming logic, a calibration is performed to determine how many number of pulses of the rotary encoder correspond to 0 ° and 90 ° before entering a desired position in degrees. All this was done on a screen (Figure 4), using the LabVIEW PID module to control the position of the axis of the servomotor to which a bar is attached. By means of a PWM signal the speed of the motor shaft is controlled, this signal is generated based on the error and the PID.

Figure 4. Screen LabVIEW to controlled position and proof signals.

When the position control and test signals were performed on the LabVIEW Screen, the following steps were followed, taking as reference figure 4 for the virtual buttons:

  1. "Prueba On/Off" button must be off.
  2. Reset the encoder count value to 0 with "Reset Enc" button.
  3. Manually place the end of the bar in the 90 ° position (using a protractor).
  4. Press the "Calibrar" button to generate the conversion value
  5. Leave "qd" at 0.
  6. Turn on the "Prueba On/Off" button to return to position 0 automatically.
  7. Start test signals (Step, Sine Wave).

The same idea was carried out in Python with the nifpga-python library, for this it is required to generate a .lvbitx file of the main program to perform the same functions as the Screen but in the Python terminal. The Simple Pendulum - Python project when running the main file shows the following in the terminal:

Wave-Functions to simple pendulum
	1 - Sinusoidal Signal
	2 - Square Signal
	3 - Step Signal
	4 - Calibration Mode
	5 - Exit

Insert the number of the function to be tested:

About

Position control of a simple pendulum (One DOF) with architecture implemented in LabVIEW FPGA and Python. A rotary encoder was used to know and manipulate the position and an H-bridge for servo motor control.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages