Show Posts
Pages: [1] 2
1  Using Arduino / General Electronics / Inverting buck boost converter load connection on: January 24, 2013, 12:09:48 pm

I am reading up on buck-boost converters, and one thing I cant understand is, is it possible to simply just swap around the connections for the load for example a small dc motor?

2  Using Arduino / Project Guidance / Re: Arduino PWM massive transient on: January 19, 2013, 02:43:03 am
Yes it sounds
Ike it is not your circuit.

It could be your scope.

Cool, quick question.

For example, If my cap is rated for let say 63V, and without connecting the scope probe, There is currently sitting a 60V potential on that cap. Will the cap blow up then if i measure the potential across it? Because if the probe induces that spike there, does it not "feed" the spike into my circuit?
3  Using Arduino / Project Guidance / Re: Arduino PWM massive transient on: January 18, 2013, 01:43:35 am

I used a new probe (600MHz) this morning and it yielded the same results. I even adjusted the the probe with a flat screw driver at the BNC connector as stated in the probe manual. yet still getting those spikes. I think I can say with certainty that it is not my circuit because I used a signal generator as well and got the same results as from the arduino uno without connecting it to my circuit.

Is that a fair analogy?
4  Using Arduino / Project Guidance / Re: Arduino PWM massive transient on: January 17, 2013, 11:59:21 am
Is there a full proof manner to test/check if it is actually a transient or just a result of the probes i am using.
Yes knowlage of what you are measuring.
Are you driving an inductive circuit? If not then the inductance is in your scope lead. This is a very basic observation so I am guessing that you are very new to using a scope.

Yes I am new to using a scope, and like i stated I measured directly from the Arduino output pin where the PWM signal is generated from and I yielded those results. Thus proving the inductance is in my scope lead.
Eventually my circuit will be used for a buck converter.


Thanks for the comment, went to read now on oscilloscopes and was amazed at how much the probe effected results! smiley

here is the link for anyone that wants to read up on it!

5  Using Arduino / Project Guidance / Re: Arduino PWM massive transient on: January 17, 2013, 11:19:36 am
That is most likely a artefact of your scope probe/scope input. Many probes have a compensation adjustment to handle fast transitions (scope probe frequency response), typically an adjustable C or R that works with the X10 attention resistors in the probe. My Tektronix 2213 has a test point (a 1Khz square wave source) on the front panel that one can hook the scope probe to and then adjust the probe for the cleanest square wave response on the screen with level tops and bottom and no overshoot or undershoot.

So what kind of scope probe and scope are you using?


Hi thanks for the quick response. Unfortunately I cant access the lab where the scopes are at the moment, i will only be able to tell you tomorrow.... However I am surprised to hear that it might be the scope?? I have tested it on 2 different oscilloscopes yielding the same result? Is there a full proof manner to test/check if it is actually a transient or just a result of the probes i am using.
6  Using Arduino / Project Guidance / Arduino PWM massive transient on: January 17, 2013, 10:53:30 am

SO i am designing a buck converter, but before i get to the actual buck converter I first wanted the mosfet to switch correctly. Now I am using a IRF2117 with a IRF540N Mosfet. The pwm signal gets feeded through a opto coupler (TLP250) and from there into the IRF2117 mosfet gate driver. Now the issue I am having is that there is a massive transient at each high rise of the pwm signal, and as the PWM amplitude gets amplified by the opto coupler and IRF2117 so does the transient also gets amplified. The attached pictures are the PWM output directly from the arduino board.

Any ideas?
7  Community / Website and Forum / arduino best and most user friendly community out there.... on: September 20, 2012, 09:33:09 am
Hi people

I recently left my arduino uno kit alone for a bit due to my uni buying bulks of e-blocks goodies (karma is a bugger)..  i got my hands on all the goodies and oh my word.... frustration does not even come close to how i am still feeling.

I found that the support in the official forums is limited to the point where u cant make a thread unless u buy the official copy of software they use.... flowcode. So arduino wins hands down there.
Secondly the arduino ide works perfectly once downloaded.. where as the e-blocks which uses avr studio give so many problems.. that u constantly have to uninstall driver/software just to get the programmer working.
finally what makes arduino best best best best by far is the example code and willingness of everyone on the forum to help one another. eblocks only has flowcode examples.. which means if flow code dont work u are stuffed.. which is what happend to me.

thats my trolling for the year smiley-lol

Thanks people.
Arduino ftw...
8  Community / Exhibition / Gallery / DDS - 3phase signals 120 degrees out of phase on: September 06, 2012, 05:50:54 am

I just completed a project of mine that generates 3 Sine waves 120 degrees out of phase. It took my hours to understand how to generate the sine tables and so forth. Thus I commented in as much detail as possible for future programmers to understand and grasp the idea quicker.


 * DDS Sine Generator mit ATMEGS 328
 * Timer2 generates the  31250 KHz Clock Interrupt
 * Use Timer2 Interrupt to change duty cycle for the output PWM signals
 * D. Tolken
 * 120 degress out of phase signals for 3 phase BLDC motor controller
 * CPUT, South Africa

a Huge thumbs up and thanks must be given to Martin Nawrath for the developement of the original code to generate a sine wave using PWM and a LPF.

#include "avr/pgmspace.h" //Store data in flash (program) memory instead of SRAM

// Look Up table of a single sine period divied up into 256 values. Refer to PWM to sine.xls on how the values was calculated
PROGMEM  prog_uchar sine256[]  = {

#define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit)) //define a bit to have the properties of a clear bit operator
#define sbi(sfr, bit) (_SFR_BYTE(sfr) |= _BV(bit))//define a bit to have the properties of a set bit operator

int PWM1= 11;// PWM1 output, phase 1
int PWM2 = 3; //[WM2 ouput, phase 2
int PWM3 = 10; //PWM3 output, phase 3
int offset_1 = 85; //offset 1 is 120 degrees out of phase with previous phase, Refer to PWM to sine.xls
int offset_2 = 170; //offset 2 is 120 degrees out of phase with offset 1. Refer to PWM to sine.xls
int program_exec_time = 6; //monitor how quickly the interrupt trigger
int ISR_exec_time = 7; //monitor how long the interrupt takes

double dfreq;
const double refclk=31376.6;      // measured output frequency

// variables used inside interrupt service declared as voilatile
volatile byte current_count;              // Keep track of where the current count is in sine 256 array
volatile byte ms4_delay;             //variable used to generate a 4ms delay
volatile byte c4ms;              // after every 4ms this variable is incremented, its used to create a delay of 1 second
volatile unsigned long phase_accumulator;   // pahse accumulator
volatile unsigned long tword_m;  // dds tuning word m, refer to DDS_calculator (from Martin Nawrath) for explination.

void setup()
  pinMode(PWM1, OUTPUT);      //sets the digital pin as output
  pinMode(PWM2, OUTPUT);      //sets the digital pin as output
  pinMode(PWM3, OUTPUT);      //sets the digital pin as output
  pinMode(program_exec_time, OUTPUT);      //sets the digital pin as output
  pinMode(9, OUTPUT);         //sets the digital pin as output
  sbi(PORTD,program_exec_time); //Sets the pin
  //Disable Timer 1 interrupt to avoid any timing delays
  cbi (TIMSK0,TOIE0);              //disable Timer0 !!! delay() is now not available
  sbi (TIMSK2,TOIE2);              //enable Timer2 Interrupt

  dfreq=1000.0;                    //initial output frequency = 1000.o Hz
  tword_m=pow(2,32)*dfreq/refclk;  //calulate DDS new tuning word

void loop()
      sbi(PORTD,program_exec_time); //Sets the pin
      if (c4ms > 250) // c4ms = 4ms, thus 4ms *250 = 1 second delay
        c4ms=0;                          //Reset c4ms
        dfreq=analogRead(0);             //Read voltage on analog 1 to see desired output frequency, 0V = 0Hz, 5V = 1.023kHz
        cbi (TIMSK2,TOIE2);              //Disable Timer2 Interrupt
        tword_m=pow(2,32)*dfreq/refclk;  //Calulate DDS new tuning word
        sbi (TIMSK2,TOIE2);              //Enable Timer2 Interrupt

//Timer 1 setup
//Set prscaler to 1, PWM mode to phase correct PWM,  16000000/510 = 31372.55 Hz clock
void Setup_timer1(void)
  // Timer1 Clock Prescaler to : 1
  sbi (TCCR1B, CS10);
  cbi (TCCR1B, CS11);
  cbi (TCCR1B, CS12);
  // Timer1 PWM Mode set to Phase Correct PWM
  cbi (TCCR1A, COM1A0);
  sbi (TCCR1A, COM1A1);
  cbi (TCCR1A, COM1B0);
  sbi (TCCR1A, COM1B1);

  // Mode 1 / Phase Correct PWM
  sbi (TCCR1A, WGM10);
  cbi (TCCR1A, WGM11);
  cbi (TCCR1B, WGM12);
  cbi (TCCR1B, WGM13);

//Timer 1 setup
//Set prscaler to 1, PWM mode to phase correct PWM,  16000000/510 = 31372.55 Hz clock
void Setup_timer2()
  // Timer2 Clock Prescaler to : 1
  sbi (TCCR2B, CS20);
  cbi (TCCR2B, CS21);
  cbi (TCCR2B, CS22);

  // Timer2 PWM Mode set to Phase Correct PWM
  cbi (TCCR2A, COM2A0);  // clear Compare Match
  sbi (TCCR2A, COM2A1);
  cbi (TCCR2A, COM2B0);
  sbi (TCCR2A, COM2B1);
  // Mode 1  / Phase Correct PWM
  sbi (TCCR2A, WGM20); 
  cbi (TCCR2A, WGM21);
  cbi (TCCR2B, WGM22);

//Timer2 Interrupt Service at 31372,550 KHz = 32uSec
//This is the timebase REFCLOCK for the DDS generator
//FOUT = (M (REFCLK)) / (2 exp 32)
//Runtime : 8 microseconds
  cbi(PORTD,program_exec_time); //Clear the pin
  sbi(PORTD,ISR_exec_time);          // Sets the pin

  phase_accumulator=phase_accumulator+tword_m; //Adds tuning M word to previoud phase accumulator. refer to DDS_calculator (from Martin Nawrath) for explination.
  current_count=phase_accumulator >> 24;     // use upper 8 bits of phase_accumulator as frequency information                     
  OCR2A=pgm_read_byte_near(sine256 + current_count); // read value fron ROM sine table and send to PWM
  OCR2B=pgm_read_byte_near(sine256 + (uint8_t)(current_count + offset_1)); // read value fron ROM sine table and send to PWM, 120 Degree out of phase of PWM1
  OCR1A = pgm_read_byte_near(sine256 + (uint8_t)(current_count + offset_2));// read value fron ROM sine table and send to PWM, 120 Degree out of phase of PWM2
  OCR1B = pgm_read_byte_near(sine256 + (uint8_t)(current_count + offset_2));// read value fron ROM sine table and send to PWM, 120 Degree out of phase of PWM2
  //increment variable ms4_delay every 4mS/125 =  milliseconds 32uS
  if(ms4_delay++ == 125)
    ms4_delay=0; //reset count

 cbi(PORTD,ISR_exec_time);            //Clear the pin

Sine wave table calculater: PWM to sine.xlsx
DDS Frequency Calc (Not My Document, helps to explain): dds_calc.xls
Circuit Diagram (Fritz): Breadboard
Measured Results: Output.bmp

Feel free to comment/ask questions

Cheers smiley
9  Using Arduino / Project Guidance / BLDC Motor Control: Sine Wave frequency on: August 27, 2012, 02:19:06 pm
Hey everyone

I am planning to start with, to control a BLDC motor found in a DVD rom with a 3 sine waves 120 degrees out of phase. Now I have my 3 out of phase signals, but I am curious about something. the frequency of my 3 signals will determine the RPM of the motor, now I dont want to overheat the motor or break it. What is the relationship between Sine wave frequency and a motors RPM?

The equation i found in a document states:

Speed (rpm) = frequency (hertz) x 120 / no. of poles

thanks in advance smiley-lol
10  Using Arduino / Motors, Mechanics, and Power / Re: Motor for Garage Door on: August 27, 2012, 09:38:48 am
Amazon sells a remote controlled Chamberlain CG40D 1/2-HP Chain Drive Garage Access System for $119.00.  Why do you want to re-invent the wheel?

Its not about re-inventing anything, as an aspiring electrical engineer I want to "create" stuff myself to broaden my knowledge in my field of study
11  Using Arduino / Motors, Mechanics, and Power / Motor for Garage Door on: August 26, 2012, 04:16:44 pm

I want to install a electric motor to make my parents garage doors automated smiley-lol. Now I dont have any mech background regarding torque/rpm requirements to move a certain object at a certain speed. From what ive seen at other peoples houses is a battery that look likes a conventional car battery 12V to power the motor for the doors. So before I can start, reverse engineering is required, meaning I must first pick the motor I will be using and then designing a controller for that motor.

Any tips/hints is appreciated on what type of motor I must go with and power,torque,rpm ratings.

have a good day smiley-lol.

PS. really keen to use the arduino in the controller and the remote to open the doors.

12  Using Arduino / Microcontrollers / Re: Bootloader with arduino uno Rev3 as isp? on: April 17, 2012, 07:13:54 am
Did it work?
13  Using Arduino / Project Guidance / Re: Serial to USB with standalone Atmega on: April 16, 2012, 03:37:22 am

It would be all on one pcb smiley, i know there is already cables like that for serial to USB conversion, but i want a compact system and probably the biggest reason is, I like to design my own stuff smiley.

14  Using Arduino / Project Guidance / Serial to USB with standalone Atmega on: April 13, 2012, 02:40:16 am

I want to create a serial to USB converter board that will work with my temperature sensor. Now I have programmed my arduino UNO board and the temp sensor works perfect. I use processing with the serial output data from the arduino board. Now I want to program a blank Atmega IC with my sketch so I dont have to use the dev kit the while time, that is not my issue, the issue I have is to take the serial data out from the atmega to the computer. my plan is to take TXD and RXD pins (Which is the serial output pins) to a FTDI chip and from the FTDI chip to a USB shield and the BAM I got myself a complete unit. Obviously it wont be as easy as I just said but I just want feedback on my idea.

What do you guys/girls think???

Any suggestions/comments are welcome

Thanks smiley
15  Using Arduino / Sensors / Re: Texas Instruments TMP100 (I2C) 7 bit slave address + 1 bit for READ(1)/write(0) on: March 06, 2012, 10:36:25 am
You could write an easy-to-use TMP100 library and post that somewhere. The "Playground" section of the Arduino site (see link at the top of the page) is a place where people publish libraries and examples.

Thanks, how do i make my post solved status?

Final Code Working!:

/* Dudley Tolken
   Temp Sensor
   Thanks to the following person(s):
   1. John Wasser, on the Aruindo Forums
  This project interfaces at Arduino Uno (SMD) with a TMP100 (Texas Instruments).
  Temperature Reading:
  The TMP100 sends 2 bytes of data for the current sampled temperature. The first byte containts the MSB(Integer) and the second
  byte contains the LSB(Decimal).Although the decimal value is only 4 bits long, the decimal value is stored from bit 4  to bit 7
  in the LSB, while bit 0 to bit 3 is 0.
  To read temperature from the TMP100 the folllowing algorithm is used.
  (1).Wire.beginTransmission(Slave_Address) <-Initiate transmision
  (2).Wire.write(ponter_address_temp)       <-Access temp register in Pointer Register           
  (3).Wire.endTransmission()                <-End transmission
  (4).Wire.requestFrom(Slave_Address,2);    <-Request 2 bytes(MSB, LSB) from the TMP100 address
  Convert the MSB and LSB to the actual temperature.
  (1).temp_MSB =   <--Store the MSB value into a integer variable(temp_MSB)
  (2).temp_LSB =   <--Store the LSB value into a integer variable(temp_LSB) 
      The MSB is the actual integer value of the current temperature that the sensors measures.
      The LSB will look something like this (Remember the actual measurement of the LSB is ONLY 4 bits!!):
      Bit 7  Bit 6  Bit 5  Bit 4  Bit 3  Bit 2  Bit 1  Bit 0
      1/0     1/0    1/0    1/0    0      0      0      0
  (3).int temp_deci = map(temp_LSB >> 4, 0, 15,0,99);       <- temp_LSB >> 4, it shifts the decimal value of the measured temperature right by 4, so that it sits now between Bit 3 to Bit 0, so conversion to integer is easy   
                                                            <- 4 Bits goes from 0 to 15 Decimal, so to get an accurate reading, just scale it to be from 0 to 999

  Write to Configuration Register.
  (1).Wire.beginTransmission(temp_address)  <-Initiate transmision
  (2).Wire.write(pointer_address_config)  <-Access config register in Pointer Register
  (3).Wire.write(config); <-Write data to configuration register
  (4).Wire.endTransmission(); <-End transmission
  Arduino UNO (SMD)  -> Master
  TMP100 -> Slave
      MASTER                           SLAVE
  |--------------|            |   |--------------|         |           
  | Arduino Uno  |            |   |    TMP100    |         |
  |           GND|----------------|GND(2) (5)ADD0|---------|
  |       Vcc(5V)|----------------|Vcc(4) (3)ADD1|---------|
  |       (SDA)A4|----------------|SDA(6)        |
  |       (SCL)A5|------------|---|SCL(1)        |
  |              |   |        |   |--------------|
  |--------------|   |        |     
          (pull up) 10K      10K (pull up)
                     |        |
                    VCC      VCC


#include  <Wire.h>  //Include I2C library
int ponter_address_temp = 0; //Pointer address 0 = Temperature output.
int temp_address = 72; //slave address of TMP100
int pointer_address_config = 1; //Pointer address 1 = Configuration Register
byte temp_MSB, temp_LSB; // Because the TMP100 sends 2 bytes
int config = 224;  //Configuration Register - To have 12 bit resolution. Refer to TMP100 for the Configuration Register
void setup()
  Serial.begin(9600); //serial baud rate
  Wire.begin(); //Start I2C
  Wire.beginTransmission(temp_address); //Sends slave address with Rwite
  Wire.write(pointer_address_config);//Access config register in Pointer Register
  Wire.write(config); //Write data to configuration register
  Wire.endTransmission(); //End Transmission

void loop()
  Wire.beginTransmission(temp_address); //Sends slave address with Rwite
  Wire.write(ponter_address_temp);  //Access temp register in Pointer Register
  Wire.endTransmission();//End Transmission
  Wire.requestFrom(temp_address,2); //Request 2 bytes(MSB, LSB) from the TMP100 address
  temp_MSB =; //Store first byte from TMP100 (MSB) into a variable
  temp_LSB =; //Store seconds byte from TMP100 (LSB) into a variable
  int temp_deci = map(temp_LSB >> 4, 0, 15,0,999); // Shift LSB 4 bits to the rightm and scale it to range from 0 to 999
  //Prints to the serial window.
  Serial.print("Temp: ");

Pages: [1] 2