Wiki

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
resources:eval:user-guides:eval-adicup3029:reference_designs:demo_cn0415 [29 Aug 2018 14:44] – [Setting up the Hardware] Andrei Drimbareanresources:eval:user-guides:eval-adicup3029:reference_designs:demo_cn0415 [19 Aug 2021 07:12] (current) – title word spell edit erbe reyta
Line 1: Line 1:
-====== Solenoind Closed Loop Control Demo ======+====== Solenoid 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**.+The **ADuCM3029_demo_cn0415** provides a solution for controlling and monitoring solenoid actuator currentusing an **EVAL-CN0415-ARDZ** shield installed on an **EVAL-ADICUP3029** base board. The user interface is implemented as a command line interface (CLI) through a serial UART connection. The project is created using **CrossCore Embedded Studio** and **GNU ARM compiler**.
 ===== General Description/Overview ===== ===== 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 applicationsa two-state driver (open/close) for loads such as solenoids and actuatorsand a linear driver for valvespositioners, heaters, and lampsIts wide supply rangeadjustable delay to **PWM** mode, and adjustable duty cycle make it suitable for wide range of applications Another is to monitor the proper operation of the plunger in valves controllers along with resistor current sensing circuit making it a close loop system application.  The target application is for automotive which addresses challenges in cold crankingload dumpingreverse polarity connection, transient immunity, and **EMI**.+The circuit can be divided into four parts for the purpose of analyzing interaction with the software projectThe supply blockthe sense blockthe actuator block, and the overcurrent fault / reset block. 
 + 
 +The supply block consists of DC-DC converters and protection circuits. This block does not interact with the software.  
 + 
 +Overcurrent fault and Overcurrent Reset blockcontrolled by general-purpose input/output (GPIO) pins on **ADICUP3029**. If the solenoid current exceeds a resistor-programmed thresholda comparator trips off the MOSFET gate driver and notifies software via GPIO signalThe user can then re-enable the driver once the fault condition is removed. 
 + 
 +The sense block, consisting of a 0.1Ω  current sense resistorsense amplifierfiltering, and 14-bit Analog to Digital converter (ADC)The ADC is connected to the ADICUP3029 via Serial Peripheral Interface (SPI)
  
-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: The voltage fed to the ADC with respect to current passing through the solenoid is given by the equation:
Line 27: Line 31:
 </code> </code>
  
-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 thatif integrated by the solenoids transfer functionit results in a current level.+The actuator block, consisting of a logic-level to MOSFET driver. The logic signal is driven by the **ADICUP3029**’s PWM peripheral, allowing the the effective voltage across the solenoid to be varied. 
 + 
 +The software implements several functions with the sense and actuator blocks. PWM frequency and duty cycle can be controlled directly. This mode of operation would normally be combined with an outer feedback loop in a control system. One example would be a system in which the solenoid controls  air pressurethat is in turn measured by a pressure sensor, which is then used to determine a new duty cycle value that brings the pressure closer to the desired setpoint. 
 + 
 +A PID control loop allows the solenoid current to be accurately controlled, compensating for variations in supply voltage and coil resistance. This mode of operation allows for optimum drive current for 2-state solenoids, minimizing power dissipation. An additional function allows a higher initial “pull in” current to be applied for short time, after which current drops back to a lower “hold” current.
  
 {{ :resources:eval:user-guides:eval-adicup3029:reference_designs:pid_controller_equation.png?nolink | PID equation}} {{ :resources:eval:user-guides:eval-adicup3029:reference_designs:pid_controller_equation.png?nolink | PID equation}}
Line 35: Line 43:
   - Start increasing **Ki** constant until the actuation time is reasonable and the current overshoot is within 5% of the wanted value.   - Start increasing **Ki** constant until the actuation time is reasonable and the current overshoot is within 5% of the wanted value.
   - Pick **Kd** as 25% (1/4) of **Ki**.   - Pick **Kd** as 25% (1/4) of **Ki**.
 +
 +A dither function allows a low-frequency AC signal to be superimposed, minimizing mechanical “stiction” in proportional solenoid applications.
  
 ===== Demo Requirements ===== ===== Demo Requirements =====
Line 52: Line 62:
     * Serial Terminal Program (Required for running in release mode only)     * Serial Terminal Program (Required for running in release mode only)
       * Such as Putty or Tera Term       * Such as Putty or Tera Term
 +    * [[https://github.com/analogdevicesinc/EVAL-ADICUP3029/tree/master/projects/ADuCM3029_demo_cn0415 | AduCM3029_demo_cn0415 demo application]]
  
 ===== Setting up the Hardware ===== ===== Setting up the Hardware =====
  
-  - Connect **EVAL-CN0415-ARDZ** board to the **EVAL-ADICUP3029**. {{ :resources:eval:user-guides:eval-adicup3029:reference_designs:cn0415_stacked_adicup3029.jpg?nolink | CN0415 stacked on ADICUP3029}}+  - Connect **EVAL-CN0415-ARDZ** board to the **EVAL-ADICUP3029**. {{ :resources:eval:user-guides:eval-adicup3029:reference_designs:cn0415_adicup3029_dock.jpeg | CN0415 docked on ADICUP3029 }}
   - Connect a micro-USB cable to **P10** connector of the **EVAL-ADICUP3029** and connect it to a computer.   - Connect a micro-USB cable to **P10** connector of the **EVAL-ADICUP3029** and connect it to a computer.
   - Connect a solenoid actuator to the **P8** connector with the positive wire on pin 1 and negative wire on pin 2.   - Connect a solenoid actuator to the **P8** connector with the positive wire on pin 1 and negative wire on pin 2.
-  - Connect a 12V power supply to the **P1** connector with the positive wire on pin 1 and negative wire on pin 2.{{ :resources:eval:user-guides:eval-adicup3029:reference_designs:powered_cn0415.jpg?nolink Powered CN0415 board with solenoid}}+  - Connect a 12V power supply to the **P1** connector with the positive wire on pin 1 and negative wire on pin 2.{{ :resources:eval:user-guides:eval-adicup3029:reference_designs:cn0415_fully_connected.jpeg | CN0415 power up }}
   - Turn on power supply.   - Turn on power supply.
 ===== Configuring the Software ===== ===== Configuring the Software =====
Line 65: Line 76:
  
 **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. **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.
 +
 +^ Supply voltage         ^ vref value  ^
 +| 3.3V                  | 2.048 |
 +| 12V                   | 4.096         |
 +
 <code> <code>
    /* Reference voltage of the ADC */    /* Reference voltage of the ADC */
Line 72: Line 88:
 ===== Outputting Data ===== ===== Outputting Data =====
  
-==== Serial Terminal Output ====+{{page>/wiki/common#serial_terminal_setup&nofooter&noheader}}
  
-The program outputs data and **CLI** interface to a serial terminal through **UART**.+==== Available commands ====
  
-  - In order to view the data, you must flash the program to the EVAL-ADICUP3029. +Typing **help** or **h** after initial calibration sequence will display the list of commands and their short versionsBelow is the short command list:
-  - Then follow the UART settings below with the serial terminal program.+
  
-Following is the UART configuration+^Type ^ Command                   ^ Description ^ 
-    Select COM Port +|System| //h//                  | Display available commands | 
-    Baud rate115200 +|  | //rst//                | Reset controller, parameters and faults |  
-    Data8 bit +|  | //stts//               | Show application status and parameters |  
-    Paritynone +|  | //clb//                | Run calibration sequence |  
-    Stop: 1 bit +|Control  | //f//\\ ex: **f 5000<enter>**\\ (set frequency to 5kHz)              | Set frequency to the specified value\\ <//freq//> = value of the new frequency\\ 1Hz to 4MHz frequency is possible.| 
-    Flow Controlnone +|  | //d//\\ ex: **d 5234<enter>**\\ (set duty cycle to 52.34%.)                  | Set duty cycle to the specified value\\ <//duty//> = value of the new duty cycle\\ The duty cycle is from 0 representing 0% and 10000 representing 100%| 
-\\ +|  | //r//                  | Read and display the value of the ADC | 
-The terminal program must interpret new line as **LF** and **local echo** must be enabled.+|  | //ad//                 | Activate PWM dither functionality |  
 +|  | //rd//                 | Deactivate PWM dither functionality |  
 +|  | //df//\\ ex**df 50<enter>**\\ (set dither freq. to 50Hz)                 | Set dither frequency to the given value\\ <//freq//> = value of the new frequency\\ Recommended maximum value of the PWM frequency divided by 10. |  
 +|  | //da//\\ ex**da 200<enter>**\\ (set dither amplitude to 2%)                 | Set dither amplitude\\ <//duty//> = value of the amplitude in duty cycle variation\\ Any value between 0 and 10000, same as duty cycle.\\ Recommended to be lower than the lowest value needed\\ for the duty cycle to be 0 or full scale. |  
 +|PID  | //ap//                 | Activate PID controller |  
 +|  | //rp//                 | Deactivate PID controller |  
 +|  | //kp//\\ ex**kp 5000.0<enter>**\\ (set kp to 5000)                 | Set PID Kp constant\\ <//kp//> = value of the new Kp constant\\ From zero to maximum number represented by a 32 bit float value. |  
 +|  | //ki//\\ ex**ki 1.5<enter>**\\ (set ki to 1.5)                 | Set PID Ki constant\\ <//ki//> = value of the new Ki constant\\ From zero to maximum number represented by a 32 bit float value. |  
 +|  | //kd//\\ ex**kd 0.25<enter>**\\ (set kd to 0.25)                 | Set PID Kd constant\\ <//kd//> = value of the new Kd constant\\ From zero to maximum number represented by a 32 bit float value. |  
 +|  | //spf//\\ ex: **spf 100<enter>**\\ (set sample freq. to 100Hz)                | Set PID sampling frequency\\ <//freq//> = value of the new frequency\\ Recommended to be at most equal with the dither frequency. |  
 +|  | //sps//\\ ex: **sps 2500<enter>**\\ (setpoint to 25%)                | Set PID set point(hold value)\\ <//sp//> = new hold value in A or 0.01%(duty cycle)\\ From 0 to 1 amperes or from 1 to 10000 as duty cycle. |  
 +|Digital  | //dson//               | Set digital solenoid high |  
 +|  | //dsof//               | Set digital solenoid low |  
 +|Proportional  | //pss//\\ ex: **pss 2500<enter>**\\ (setpoint to 25%)                | Set and activate proportional solenoid\\ <//val//> = value of the current or duty cycle\\ from 0 to 1 amperes
  
-==== 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:+{{ :resources:eval:user-guides:eval-adicup3029:reference_designs:wiki_pic.png?nolink | Terminal example}}
  
-^ Command                   ^ Description ^ +===== Obtaining the Software =====
-| //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+There are two basic ways to program the ADICUP3029 with the software for the CN0415. 
 +  Dragging and Dropping the .Hex to the Daplink drive 
 +  - Building, Compiling, and Debugging using CCES
  
-===== Obtaining the Source Code =====+Using the drag and drop method, the software is going to be a version that Analog Devices creates for testing and evaluation purposes.  This is the EASIEST way to get started with the reference design
  
-We recommend not opening the project directly, but rather import it into CrossCore Embedded Studios and make a local copy in your workspace+Importing the project into CrossCore is going to allow you to change parameters and customize the software to fit your needs, but will be a bit more advanced and will require you to download the CrossCore toolchain 
  
-The source code and include files of the FIXME!**ADuCM3029_demo_cn0415** can be found here:+The software for the **ADuCM3029_demo_cn0415** can be found here:
  
 <WRAP round 80% download> <WRAP round 80% download>
- +Prebuilt CN0415 Hex File 
-FIXME!   LINK +  * [[https://github.com/analogdevicesinc/EVAL-ADICUP3029/releases/download/Latest/ADuCM3029_demo_cn0415.hex| AduCM3029_demo_cn0415.Hex]] 
- +Complete CN0415 Source Files 
-[[https://gitlab.analog.com/Platformation/EVAL-ADICUP3029/tree/cn0415_demo_dev/projects/ADuCM3029_demo_cn0415| AduCM3029_demo_cn0415 at Github]]+  [[https://github.com/analogdevicesinc/EVAL-ADICUP3029/tree/master/projects/ADuCM3029_demo_cn0415| AduCM3029_demo_cn0415 Source Code]]
    
 </WRAP> </WRAP>
Line 147: Line 155:
 ==== Project Structure ==== ==== Project Structure ====
  
-FIXME!   Add textpicture, 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.+The program is composed of three main parts: 
 +  Board setupwith initialization; 
 +  - Calibration; 
 +  - Main process. 
 + 
 +{{ :resources:eval:user-guides:eval-adicup3029:reference_designs:cn0415_sw_main_flowchart.png?nolink | Software main flow chart}} 
 + 
 +The boards initial parameters can be given in the software in the main function or the **FLASH_INIT_PARAMETERS** define in the **config.h** file can be uncommented and the relevant parameters can be changed in program from the command line and the program will retain these parameters in the non-volatile memory. 
 +The program initializes timers and UART, SPI, GPIO and FLASH controllers. 
 + 
 +{{ :resources:eval:user-guides:eval-adicup3029:reference_designs:cn0415_sw_board_setup_flow.png?nolink | Software board setup flow chart}} 
 + 
 +**Calibration** is done to minimize full scale error. It sets control signal to **logic "1"** and measures the current, then prompts the user for a manual measurement with a precision toolThe difference between these two measurements is stored and used in calculating future values from ADC codes. 
 + 
 +{{ :resources:eval:user-guides:eval-adicup3029:reference_designs:cn0415_sw_calibration_flow.png?nolink | Software calibration flow chart}} 
 + 
 +The **main process** is the infinite loop in which the program implements **CLI**, **PID** and **dither** functionality. The **UART** is used for the **CLI** and three different timers implement the **PWM** signal, the **PID** periodic calculation and the **dither** functionality. 
 + 
 +{{ :resources:eval:user-guides:eval-adicup3029:reference_designs:cn0415_sw_process_flow.png?nolink | Software process flow chart}}
  
 // End of Document // // End of Document //
  
  
resources/eval/user-guides/eval-adicup3029/reference_designs/demo_cn0415.1535546674.txt.gz · Last modified: 29 Aug 2018 14:44 by Andrei Drimbarean