Loading ...
Sorry, an error occurred while loading the content.

I Need help!!!

Expand Messages
  • trab_19
    Is their anybody who knows a circuit with schematic diagram that allows you to control the rotation of the electric meter? Thank you!
    Message 1 of 3 , Sep 6, 2008
    • 0 Attachment
      Is their anybody who knows a circuit with schematic diagram that
      allows you to control the rotation of the electric meter? Thank you!
    • Mihai Galos
      what do you mean by the rotation of the electric meter ? Is it an analog voltmeter?
      Message 2 of 3 , Sep 7, 2008
      • 0 Attachment
        what do you mean by the "rotation of the electric meter" ? Is it an
        analog voltmeter?


        --- In booksbybibin@yahoogroups.com, "trab_19" <trab_19@...> wrote:
        >
        > Is their anybody who knows a circuit with schematic diagram that
        > allows you to control the rotation of the electric meter? Thank you!
        >
      • Mike Bushroe
        if you mean control of the electric meter that measures the amount of electricity your house uses each month, I do not know how and would not reveal as it
        Message 3 of 3 , Sep 8, 2008
        • 0 Attachment
          if you mean control of the electric meter that measures the amount of
          electricity your house uses each month, I do not know how and would
          not reveal as it would be stealing.

          If you mean control the rotation of an electric MOTOR to spin the
          wheels of a small car or the propeller of a boat, then yes that is
          fairly easy.Try the L298 dual motor driver (
          http://www.solarbotics.com/products/l298/ ), and the PWM output from
          an Atmel ATTiny or ATMega. Here is the code of one that I wrote
          initially on an ATMega, then transfered to an ATTiny24 that reads an
          analog input (100K potentiometer with the ends tied to ground and 5
          volts, and the center wipe to Port A-0) and generates one PWM channel
          for forward, a second for backwards, and a dead zone in the middle.

          Hope this helps.

          Mike


          #include <avr/io.h>
          #include <stdio.h>
          #include <util/delay.h>
          #include <avr/io.h>



          #define sbi(var, mask) ((var) |= (uint8_t) (1 << mask))
          #define cbi(var, mask) ((var) &= (uint_t) ~(1 << mask))


          // define functions
          //========================
          void ioinit(void); // Initializes IO stream
          static int uart_putchar(char c, FILE *stream);
          uint8_t uart_getchar(void);


          static FILE mystdout = FDEV_SETUP_STREAM(uart_putchar, NULL, _FDEV_SETUP_WRITE);



          int main(void)
          {
          DDRA |= 0x60;

          uint16_t x = 0;




          ADCSRA |= (1 << ADPS1) | (1 << ADPS0); // 101 prescaler 64 give
          8Mhz/64 = 125Khz
          ADMUX = 0x00; // start with ADC channel 0
          ADMUX |= (0 << REFS1); // use AVCC for reference voltage
          // ADC0 is set by all 5 mux bits being zero, so do nothing
          ADCSRA |= (1 << ADATE); // set ADC to auto trigger
          // ADCSRB = 0x00; // for free running mode
          ADCSRA |= (1 << ADEN); // enable ADC
          ADCSRA |= (1 << ADSC); // Start first conversion
          TCCR1A |= (1 << COM1A1) | (1 << COM1B1); // compare output toggle
          TCCR1A |= (1 << WGM10) | (1 << WGM11); // Normal 10 bit compare
          mode, phase correct PWM
          TCCR1B |= (1 << CS11) | (0 << CS10) ; // 1/64 Clk prescaler
          ICR1 = 966; // TOP count
          OCR1A = 300;
          OCR1B = 500;



          for(;;) // Loop Forever
          {
          x = ADC;
          if (x > 600)
          {
          OCR1A = (x - 550)*2;
          OCR1B = 0;
          } else if (x < 500)
          {
          OCR1B = (500 - x)*2;
          OCR1A = 0;
          } else
          {
          OCR1A = 0;
          OCR1B = 0;
          }

          _delay_ms(2); // delay
          } // end for
          } //end main
        Your message has been successfully submitted and would be delivered to recipients shortly.