Wiki

This version is outdated by a newer approved version.DiffThis version (29 Aug 2018 14:40) is a draft.
Approvals: 0/1

This is an old revision of the document!


Solenoind Closed Loop Control Demo

The ADuCM3029_demo_cn0415 provides a solution to control current using pulse width modulation(PWM) for solenoid actuators, for the EVAL-ADICUP3029 base board with additional EVAL-CN0415-ARDZ shield, created using CrossCore Embedded Studio and GNU ARM compiler. The demo uses a command line interface(CLI) on UART.

General Description/Overview

The ADuCM360_demo_cn0415 project uses the EVAL-CN0415-ARDZ shield which is a control module that uses PWM to control current in solenoid actuators. The end product is an Arduino compatible daughter board for rapid prototyping platform that can be deployed to a robust Industrial environment and application. Its design is optimized for two types of applications: a two-state driver (open/close) for loads such as solenoids and actuators, and a linear driver for valves, positioners, heaters, and lamps. Its wide supply range, adjustable delay to PWM mode, and adjustable duty cycle make it suitable for a wide range of applications. Another is to monitor the proper operation of the plunger in valves controllers along with a resistor current sensing circuit making it a close loop system application. The target application is for automotive which addresses challenges in cold cranking, load dumping, reverse polarity connection, transient immunity, and EMI.

The circuit can be divided into three parts for the purpose of analysis: the supply block, the sense block and the actuator block. The supply block consists of DC-DC converters and protection circuits. The main supply is a 12V and 1A limited source that must be connected to P1. This is compatible with most power supplies available in an automobile. Alternatively the controller can be powered from a regulated 3.3V source on the Arduino connector. The current sense block contains a sense resistor of 0.1Ω that converts the current passing through the solenoid into a voltage drop that is picked up by an instrumentation amplifier. The resulting voltage is fed to the ADC that converts it to a 14 bit value and sends it via SPI to the ADICUP3029.

The voltage fed to the ADC with respect to current passing through the solenoid is given by the equation:

       VADC = Isolenoid * Rsense * 20       Isolenoid - Current through solenoid    
                                            Rsense    - Sense resistor (0.1Ω)  

The code output by the ADC is then calculated:

                                            VADC - Voltage on the ADC input
       CODE = (VADC * 2^14) / Vref          CODE - Code output by the ADC
                                            Vref - Reference voltage of the ADC

Here Vref is the reference voltage of the ADC and depends on the chosen supply. If the 12V on P1 was selected the supply voltage of the ADC will be 5V and the corresponding reference is 4.096V. If the ADC is powered from Arduino with 3.3V the reference will be 2.048V.

So the ADC code with respect to current sense will be:

       CODE = (Isolenoid * Rsense * 20 * 2^14) / Vref

The actuator block consists of N-channel MOSFET gate driver, and over current protection IC and a N-MOSFET transistor that is the actuator. The controller generates a PWM signal that, if integrated by the solenoids transfer function, it results in a current level.

 PID equation

Using the data gathered form the sense block the a PID controller is implemented that can be used to set a specific current value or duty cycle. To use the PID controller it must be first tuned with the right values of Kp, Ki and Kd. Various methods can be used for tunning. The proposed method, which is easy, but does not yield perfect results, is:

  1. Start increasing Kp constant while keeping Ki and Kd at 0. Increase Kp until the actuation time is reasonable and the current overshoot is within 5% of the wanted value.
  2. Start increasing Ki constant until the actuation time is reasonable and the current overshoot is within 5% of the wanted value.
  3. Pick Kd as 25% (1/4) of Ki.

Demo Requirements

The following is a list of items needed in order to replicate this demo.

  • Hardware
    • EVAL-ADICUP3029
    • EVAL-CN0415-ARDZ
    • Mirco USB to USB cable
    • PC or Laptop with a USB port
    • Solenoid actuator
    • 12V and 1A limited power supply
  • Software
    • CrossCore Embedded Studio (2.6.0 or higher)
    • ADuCM302x DFP (2.0.0 or higher)
    • ADICUP3029 BSP (1.0.0 or higher)
    • Serial Terminal Program (Required for running in release mode only)
      • Such as Putty or Tera Term

Setting up the Hardware

  1. Connect EVAL-CN0415-ARDZ board to the EVAL-ADICUP3029. FIXME! - PICTURE
  2. Connect a micro-USB cable to P10 connector of the EVAL-ADICUP3029 and connect it to a computer.
  3. Connect a solenoid actuator to the P8 connector with the positive wire on pin 1 and negative wire on pin 2.
  4. Connect a 12V power supply to the P1 connector with the positive wire on pin 1 and negative wire on pin 2.FIXME! - PICTURE
  5. Turn on power supply.

Configuring the Software

The configuration parameters can be found in the config.h file.

vref - Reference voltage of the ADC set by supply method as described above. Set to 4.096 if the supply is the 12V on P1 or to 2.048 if supply is the Arduino 3.3V.

   /* Reference voltage of the ADC */
   float vref = 4.096;

Outputting Data

Serial Terminal Output

The program outputs data and CLI interface to a serial terminal through UART.

  1. In order to view the data, you must flash the program to the EVAL-ADICUP3029.
  2. Then follow the UART settings below with the serial terminal program.

Following is the UART configuration.

  Select COM Port
  Baud rate: 115200
  Data: 8 bit
  Parity: none
  Stop: 1 bit
  Flow Control: none


The terminal program must interpret new line as LF and local echo must be enabled.

Available commands

Typing help or h after initial calibration sequence will display the list of commands and their short versions. Bellow is the short command list:

Command Description
h Display available commands
f Set frequency to the specified value
<freq> = value of the new frequency
d Set duty cycle to the specified value
<duty> = value of the new duty cycle
r Read and display the value of the ADC
ad Activate PWM dither functionality
rd Deactivate PWM dither functionality
df Set dither frequency to the given value
<freq> = value of the new frequency
da Set dither amplitude
<duty> = value of the amplitude in duty cycle variation
ap Activate PID controller
rp Deactivate PID controller
kp Set PID Kp constant
<kp> = value of the new Kp constant
ki Set PID Ki constant
<ki> = value of the new Ki constant
kd Set PID Kd constant
<kd> = value of the new Kd constant
spf Set PID sampling frequency
<freq> = value of the new frequency
sps Set PID set point(hold value)
<sp> = new hold value in A or 0.01%(duty cycle)
dson Set digital solenoid high
dsof Set digital solenoid low
pss Set and activate proportional solenoid
<val> = value of the current or duty cycle
rst Reset controller, parameters and faults
stts Show application status and parameters
clb Run calibration sequence

FIXME! - PICTURE

Obtaining the Source Code

We recommend not opening the project directly, but rather import it into CrossCore Embedded Studios and make a local copy in your workspace.

The source code and include files of the FIXME!ADuCM3029_demo_cn0415 can be found here:

How to use the Tools

The official tool we promote for use with the EVAL-ADICUP3029 is CrossCore Embedded Studio. For more information on downloading the tools and a quick start guide on how to use the tool basics, please check out the Tools Overview page.

Importing

For more detailed instructions on importing this application/demo example into the CrossCore Embedded Studios tools, please view our How to import existing projects into your workspace section.

Debugging

For more detailed instructions on importing this application/demo example into the CrossCore Embedded Studios tools, please view our How to configure the debug session section.

Project Structure

FIXME! - Add text, picture, images, that describe the project structure. Any software flow diagrams or decision trees can be added her to help customers understand how the applications are structures.

End of Document

resources/eval/user-guides/eval-adicup3029/reference_designs/demo_cn0415.1535546456.txt.gz · Last modified: 29 Aug 2018 14:40 by Andrei Drimbarean