1 / 13

Arduino DC motor driver L239 H-Bridge Arduino GUI vs Atmel Studio

Arduino DC motor driver L239 H-Bridge Arduino GUI vs Atmel Studio. Stefan Pirvu ADCES 2015. Content. Arduino board review Serial communication, writing C# app in order to communicate over serial - code Using H-Bridge to power DC motors PWM vs. continuous voltage drive Arduino GUI - code

toni
Download Presentation

Arduino DC motor driver L239 H-Bridge Arduino GUI vs Atmel Studio

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Arduino DC motor driverL239 H-BridgeArduino GUI vs Atmel Studio Stefan Pirvu ADCES 2015

  2. Content • Arduino board review • Serial communication, writing C# app in order to communicate over serial - code • Using H-Bridge to power DC motors • PWM vs. continuous voltage drive • Arduino GUI - code • Atmel Studio - code

  3. Arduino board review • USB support • 16MHz • 32k flash • 14 I/O pins • 5 PWM pins • 6 ADC pins

  4. Serial communication, writing C# app in order to communicate over serial • CODE 

  5. Using H-Bridge to power DC motors

  6. L298 • http://www.tech.dmu.ac.uk/~mgongora/Resources/L298N.pdf • Cheap aprox. 10-20 RON • Dual H-Bridge

  7. PWM vs. continuous voltage drive • Analog • bad at low voltages • needs mechanical switches • ranges depend on the number of resistors • very resistant over time • Digital • good at low voltages • fine control • buzz sounds

  8. Arduino GUI • http://arduino.cc/ • CODE 

  9. Atmel Studio • http://www.atmel.com/microsite/atmel_studio6/ • But before coding… • http://www.atmel.com/images/Atmel-8271-8-bit-AVR-Microcontroller-ATmega48A-48PA-88A-88PA-168A-168PA-328-328P_datasheet_Complete.pdf • http://arduino.cc/en/Tutorial/SecretsOfArduinoPWM

  10. ATMEGA328P AIN0/OC0A/PCINT22 – Port D, Bit 6 OC0A, Output Compare Match output: The PD6 pin can serve as an external output for the Timer/Counter0. Compare Match A. The PD6 pin has to be configured as an output (DDD6 set (one)) to serve this function. The OC0A pin is also the output pin for the PWM mode timer function. T1/OC0B/PCINT21 – Port D, Bit 5 OC0B, Output Compare Match output: The PD5 pin can serve as an external output for the Timer/Counter0. Compare Match B. The PD5 pin has to be configured as an output (DDD5 set (one)) to serve this function. The OC0B pin is also the output pin for the PWM mode timer function.

  11. ATMEGA328 Timer/Counter • LET’S CODE  Timer Registers Several registers are used to control each timer. The Timer/Counter Control Registers TCCRnA and TCCRnB hold the main control bits for the timer. (Note that TCCRnA and TCCRnB do not correspond to the outputs A and B.) These registers hold several groups of bits: Waveform Generation Mode bits (WGM): these control the overall mode of the timer. (These bits are split between TCCRnA and TCCRnB.) Clock Select bits (CS): these control the clock prescaler Compare Match Output A Mode bits (COMnA): these enable/disable/invert output A Compare Match Output B Mode bits (COMnB): these enable/disable/invert output B

  12. Use AVRDude to upload HEX • >C:\Program Files\Arduino\hardware\tools\avr\bin • avrdude.exe -C”C:ProgramFiles\Arduino\hardware\tools\avr\etc\avrdude.conf” ­f -patmega328p -carduino -P\.COM4 -b115200 -D -Uflash:w:”$(ProjectDir)Debug$(TargetName).hex”:i

  13. Thank you • QUESTIONS?? • Code files:

More Related