RC solar car ESC. (Electronic Speed Control).

All solar related electronics. Eg. MPPT's (maximum power point tracker), Inverters, regulators, etc.

RC solar car ESC. (Electronic Speed Control).

Postby TonyB » Sun Jul 06, 2008 12:16 am

Ill be designing an ESC for a radio controlled solar car. The speed controller is based on Atmel mega8 micro controller which is programmed in C++ using WINAVR and an STK500.
The design will be able to drive low inductance Maxon or Faulhaber motors.

Requirement so far are:

1.Variable speed in the forward direction (digitally proportional to the RC throttle input).
2.Variable brake strength (digitally proportional to the RC brake input).
3.Be able to handle voltages as high as 25 volts, because this the solar panels open circuit voltage.
4.Be able to operate at voltages as low as 4 volts.
5.Will have a huge reserve power bank, so it can charge while its traveling slow or standstill. Power bank MUST be capacitor based.
6.Will have a high power acceleration and top speed by sucking excess power from the power bank.
7.Programmable. Will have a one-touch setup to the radio been used, ie, setup the neutral, max forward, and max brake points.
8.Will always operate the solar panel at it maximum power point.

The basic schematic has been drawn and code has been written.
Schematic shown below:

Image

Although the full hardware has yet to be built, i have programmed the MCU with the test code and tested its output with the oscilloscope and it functions as required.
The test program is shown below.

Code: Select all
/***********************************************
* Solar ESC Test program v0.1 alpha beta 2
*
* Device: mega8
* PortB3 = motor PWM output.
* PortD7 = setup button.
* PortD2 = Signal input.
***********************************************/

#include <avr/io.h>
#include <avr/interrupt.h>
#include <util/delay.h>
#include <avr/eeprom.h>

volatile uint16_t rawT;
void d3lay(int secs);
void set(void);

uint16_t Low = 8000;
uint16_t High = 16000;

ISR(INT0_vect)
{
   if(MCUCR == 0b00000011)
   {
      TCNT1 = 0;
      MCUCR = 0b00000010;
      PORTB |= (1 << PB0);
   }

   else if(MCUCR == 0b00000010)
   {
      rawT = TCNT1;
      MCUCR = 0b00000011;
      PORTB &= (0 << PB0);
   }
}

void InitPorts(void)
{
   DDRD=0x00;            //   Port D pins as input
   PORTD=0xFF;            //   Enable internal pull ups
   DDRB=0xFF;            //   Set PORTB as output
   GICR = 0b11000000;       //    Int0 activation.

   PORTB = 255;
}

void InitTimer(void)
{   
   TCCR1A = 0b00000000;
   TCCR1B = 0b00000001;
   
   MCUCR = 0b00000011;    //    Interupt level change trigger.

   TCCR2 = 0b01101010;
}

void d3lay(int secs)
{
   while(secs--)
   {
      _delay_us(100);
   }
}

void set(void)  // Setup Brake point, neutral point and forward point, and store vales in eeprom. or restore defaults from eeprom.
{
   Low = eeprom_read_word(0);
   High = eeprom_read_word(2);
   
   if (bit_is_clear(PIND, 7))
   {
      while(bit_is_clear(PIND, 7))
      {
         
      }
      d3lay(150);
      while(bit_is_set(PIND, 7))
      {
         Low = rawT-10;
      }
      d3lay(150);
      while(bit_is_clear(PIND, 7))
      {

      }
      d3lay(150);
      while(bit_is_set(PIND, 7))
      {
         High = rawT;
      }

      eeprom_write_word(0, Low);
      eeprom_write_word(2, High);
   }
}

int main(void)
{
   InitPorts();
   InitTimer();
   sei();
   set();            // Call the setup routine before the main loop.

   int Raw;

   while(1)
   {   
      Raw = (rawT-Low)/((High-Low)/255);

      if(OCR2 < Raw && OCR2 < 255)
      {
         OCR2++;
      }

      else if(OCR2 > Raw && OCR2 > 0)
      {
         OCR2--;
      }
   }
}


Basically, this code tests requirements 1 and 7 which are the main MCU functions. Full program ability was achieved from the radio stick input using the MCU one-touch program button. Full PWM throttle control was achieved from the captures 1.5ms pulse signal that an RC receiver generates. Test code shown below, ill update this thread as i make progress.
User avatar
TonyB
Site Admin
 
Posts: 274
Joined: Sun Dec 02, 2007 2:45 am
Location: Australia

Re: RC solar car ESC.

Postby TonyB » Sun Jul 06, 2008 12:18 am

Drool Ben you'll have it soon.
User avatar
TonyB
Site Admin
 
Posts: 274
Joined: Sun Dec 02, 2007 2:45 am
Location: Australia

Re: RC solar car ESC. (Electronic Speed Control).

Postby Predator1 » Sun Jul 06, 2008 7:45 pm

me, drooling??? who says id do that??? oh, wait, maybe i should wipe my chin.... :D

THANKS TONY!
User avatar
Predator1
 
Posts: 52
Joined: Sun Dec 02, 2007 5:01 pm

Re: RC solar car ESC. (Electronic Speed Control).

Postby SpeedFreak » Mon Oct 20, 2008 12:42 am

Can you post up pictures so we can see it?
User avatar
SpeedFreak
 
Posts: 9
Joined: Tue Apr 22, 2008 9:18 pm


Return to Electronics

Who is online

Users browsing this forum: No registered users and 1 guest