Friday, January 18, 2013

Using Arduino UNO to simulate a DC Generator

Worlds Smallest 2KW DC Diesel Generator!
Version 0.0.1

I have been using an Arduino UNO board to help debug the DC Generator Controller.   Arduino helping Arduino! Some mocked up hardware to do voltage level changes and a simple 'sketch' to simulate the Kubota DC Generator.  It listens to inputs like Starter requested, throttle position, Field Drive and as a result adjusts simulated current shunt voltages and Battery voltages.   If you click on the Simulator tab in the  Link to Files row at the top you can download the simple schematic and  current sketch.

Some notes:
  • 12v singles are reduced to 5v via resistor dividers (e.g. FIELD and Throttle_Clutch)
  • Alt Amps and EGT are simulated by connected an Arduino PWM output to a resistor divider to get the 5v level down to the 20-30mV range.
  • VBat is simulated by again using a PWM output from the Arduino, this time to control the 'down leg' of a resister divider.  When the PWM is high, the NPN turns on and causes the two Resistors to act as a voltage divider reducing the '12v' to around 10v.  (See note below).     When the PWM is low, the NPN is off and there is no resistor divider, so the entire '12v' gets sent as VBat.
  • All the PWMs are smoothed out using a long time-frame RC capacitor resulting in stable DC voltages.   
  • The FIELD from the controller is also 'smoothed' with a capacitor   This is to allow for the UNO's A/D input to sample a voltage directly related to how hard the FIELD is being PWM driven by the controller.
  • Most values were selected by parts I had on hand, and/or used in the controller project.  Feel free to modify the values, taking into account the resister ratios and also RC time constants.

The program simulates a resting battery voltage while watching for the Throttle Clutch to be enabled - which indicated the Controller wants to start generating.  The Starter single is used to drop the simulated voltage (due to starter loading on the battery) and mark the time the motor was 'started'.  Once things are started the controller's FIELD is sampled via a UNO analog input to decide how 'hard' the controller wants to drive the 'alternator'.  Harder driving result sin more simulated Amps and Volts. The timer set at 'engine start' is used to slowly increase  the base Simulated  'battery voltage', independent of how hard the Field is being driven.  This is to simulate the battery being charged.
Smart DC Generator Controller being put through its paces.
Working hard to 'drive' the UNO based Kubota DC Generator Simulator!
It works well and is allow for tuning of the charging routines.  Future enhancements to the hardware and software will include improvements to the Stator drive (It needs to be a switches 12v level, not the 5v.) as well as adjustments in response to throttle position change requests.

Note this is a very simple program, and many of the sensitivity values need to be hand tuned.  Currently they are optimized for a "+12V" level of 15.8v (what is coming from the DC Wall Wart I am using to desk-power the controller) and it is sized to simulate a 130A alternator.  

Check back to see changes and updates.

No comments:

Post a Comment