Show Posts
Pages: [1]
1  International / Portugues / Re: Ajuda precisa-se!!! CRIAR PWM de 10khz. on: August 22, 2011, 06:03:29 am
obrigado fabio!!
não sei se 3900hz vai chegar mas 31000hz tambem é muito visto que o meu dispositivo recomenda 20khz.
abrigado!! smiley-mr-green
2  International / Portugues / Re: Ajuda precisa-se!!! CRIAR PWM de 10khz. on: August 19, 2011, 05:35:15 am
Obrigado pela resposta pessoal.

ViniciusPolo, o problema de analogWrite(n,d) em que o n é o numero correspondente ao pino e d é o dutycycle, gera pwm a uma frequencia fixa de 490 hz. Para ter frequencias maiores é preciso mexer nos setups dos timers internos. E isto ainda não domino mas chegarei lá.

obrigado mais uma vez pessoal!!
3  Using Arduino / General Electronics / Re: Help me to setup the PWM frequency to 10khz on: August 19, 2011, 05:22:22 am
hello guys!!
Anachrocomputer, you are right. I shall use float numbers for dutycycle and perturbation.

AWOL, the perturbation must be greater than zero.

Thank you!! smiley-mr-green

4  Using Arduino / General Electronics / Re: Help me to setup the PWM frequency to 10khz on: August 18, 2011, 12:21:02 pm
thank you for the reply Senso!!
the text is long but i will read it all.

thanks smiley-mr-green
5  International / Portugues / Ajuda precisa-se!!! CRIAR PWM de 10khz. on: August 18, 2011, 11:25:46 am
Eu estou a trabalhar num projeto de um conversor para os módulos fotovoltaicos e
Eu estou usando uma placa Arduino Uno para gerar um PWM para controlar um IGBT.
Eu preciso de pelo menos freqüência 10kHz PWM e usando analogWrite eu recebo 490hz

Ajudem-me a configurar os timers para ter uma freqüência de 10kHz.

aqui está o codigo:

/*
 * Two Stage Single Phase Inverter control
 *
 * JN. Barbosa - MERCEUS - DEE - FCT-UNL
 */
 
 int Vpv0 = 0; // inicials conditions
 int Ipv0 = 0;
 int P0 = 0; 
 int Vpv1 = 0;
 int Ipv1 = 0;
 int P1 = 0;
 int D = 0.500; // duty-cycle
 int dD = 0.001; // perturbation
 
 void setup()
 {
   pinMode(3, OUTPUT);  // sets the pin as output
 }
 
 void loop()
 {
   Vpv0 = analogRead(A1); // read the pv voltage
   Ipv0 = analogRead(A2); // read the pv current
   P0 = Vpv0*Ipv0;                // calculate instant power
 
  delay(1);
  Vpv1 = analogRead(A1);
  Ipv1 = analogRead(A2);
  P1 = Vpv1*Ipv1;

  int dV = Vpv1-Vpv0;
  int dP = P1-P0;
 
 if (dP > 0){
   if (dV > 0){
     D = D+dD;
   }else{
     D = D-dD;
   }
 }else {
   if (dV > 0){
     D = D-dD;
   }else{
     D = D+dD;
   }
 }
 
 analogWrite(pwmPin,D*255);
 }
 
 
 OBRIGADO!!!
6  Using Arduino / General Electronics / Help me to setup the PWM frequency to 10khz on: August 18, 2011, 11:18:25 am
I am working on a project of a converter for Photovoltaic modules and
I am using an Arduino Uno board to generate a PWM to controll a IGBT.
I need at least 10khz frequency pwm and using analogWrite i get 490 hz.

Can you help me configuring the timers to have a 10khz frequency??? smiley-mr-green

here is the code:

/*
 * Two Stage Single Phase Inverter control
 *
 * JN. Barbosa - MERCEUS - DEE - FCT-UNL
 */
 
 int Vpv0 = 0; // inicials conditions
 int Ipv0 = 0;
 int P0 = 0; 
 int Vpv1 = 0;
 int Ipv1 = 0;
 int P1 = 0;
 int D = 0.500; // duty-cycle
 int dD = 0.001; // perturbation
 
 void setup()
 {
   pinMode(3, OUTPUT);  // sets the pin as output
 }
 
 void loop()
 {
   Vpv0 = analogRead(A1); // read the pv voltage
   Ipv0 = analogRead(A2); // read the pv current
   P0 = Vpv0*Ipv0;                // calculate instant power
 
  delay(1);
  Vpv1 = analogRead(A1);
  Ipv1 = analogRead(A2);
  P1 = Vpv1*Ipv1;

  int dV = Vpv1-Vpv0;
  int dP = P1-P0;
 
 if (dP > 0){
   if (dV > 0){
     D = D+dD;
   }else{
     D = D-dD;
   }
 }else {
   if (dV > 0){
     D = D-dD;
   }else{
     D = D+dD;
   }
 }
 
 analogWrite(pwmPin,D*255);
 }
 
   
 Thank you a lot!!!
7  Using Arduino / Interfacing w/ Software on the Computer / Re: Matlab Simulink interface with Arduino on: August 18, 2011, 09:06:31 am
I am trying to upload de demo_arduino_blink to the board and have the following error msg:
...
The call to arduino_make_rtw_hook, during the after_make hook generated the following error:
Download failed. Check your serial connection and and run the command arduino.Prefs.getMcu to check you have specified the correct MCU.
...
 I am using an arduino uno with atmega328p-pu and I set it on matlab by the following command: >>arduino.Prefs.setMcu('atmega328p-pu')

By the way, what I inteded convert from simulink to arduino I think is very large for the 32 kB of flash memory of the chip.

thank you!!!
8  Using Arduino / Interfacing w/ Software on the Computer / Re: Matlab Simulink interface with Arduino on: August 18, 2011, 04:52:39 am
Hi Robtillaart!!
thank you for the reply!

The question is that I am trying to upload the simulink block code to the arduino.
It is possible once you can convert any simulink code to C code and then upload it to the board trough the ARDUINO-TARGET.
Do you want to see the simulink file? smiley-mr-green
9  Using Arduino / Interfacing w/ Software on the Computer / Matlab Simulink interface with Arduino on: August 17, 2011, 11:04:07 am
Someone who has experience in SIMULINK could help me?? smiley-mr-green smiley-mr-green

I'm trying to connect pin analoginput (A1) to read data from a current sensor for controlling an inverter.
I setup the recognition of the Arduino board Uno for Matlab Simulink and now I can not read the analog input value.

if you can give me a hint on the configuration of the inputs would be a huge help for my final project.

Thank you!! smiley-mr-green smiley-mr-green
10  International / Portugues / Configurar pino de analoginput em Matlab Simulink on: August 17, 2011, 10:56:51 am
Alguém que tenha experiência em SIMULINK me pode ajudar?? smiley-grin

Estou a tentar conectar o pino analoginput (A1) para ler dados de um sensor de corrente para o controlo de um inversor.
Fiz a configuração toda do reconhecimento do Arduino Uno board para Matlab Simulink e agora não consigo ler os valores de entradas analogicas.

se puder dar-me uma dica na configuração dos inputs seria uma ajuda enorme para o meu projecto final de curso.

Obrigado smiley-mr-green!!!
 
Pages: [1]