Arduino en español
Circuitos con Arduino - Juan Antonio Villalpando
-- Tutorial de iniciación a Arduino --
Volver al índice del tutorial
____________________________
SimPlot y Arduino Monitor.
65.- SimPlot. Osciloscopio.
En los foros de Arduino, encontramos esta estupenda herramienta: SimPlot, es una especie de osciloscopio.
Este es el envío del foro: http://forum.arduino.cc/index.php?topic=58911.0
- Esta es la versión: SimPlot_V1-2.zip para Windows.
- Aquí está el proyecto: https://code.google.com/p/projectsimplot/downloads/list
- Copia este programa en tu Arduino UNO.
- Cada vez que vayamos a cargar el programa en el Arduino debemos pulsar el botón de "Disconnect".
ondas_senoidales.ino |
/*
SimPlot Demo Arduino Sketch.
Generates and sends out 4 channels of data to be plotted using SimPlot.
*/
void setup()
{
Serial.begin(57600);
}
int buffer[20];
float deltaAngle = 3.14/51; //Arbitrary angle increment size
float angle = 0;
int amplitude = 100;
void loop()
{
int data1;
int data2;
int data3;
int data4;
//Generating data that will be plotted
data1 = amplitude * sin(angle);
data2 = amplitude * cos(angle);
data3 = (amplitude/2) * sin(angle);
data4 = (amplitude/2) * cos(angle);
angle = angle + deltaAngle;
plot(data1,data2,data3,data4);
delay(100); //Need some delay else the program gets swamped with data
}
void plot(int data1, int data2, int data3, int data4)
{
int pktSize;
buffer[0] = 0xCDAB; //SimPlot packet header. Indicates start of data packet
buffer[1] = 4*sizeof(int); //Size of data in bytes. Does not include the header and size fields
buffer[2] = data1;
buffer[3] = data2;
buffer[4] = data3;
buffer[5] = data4;
pktSize = 2 + 2 + (4*sizeof(int)); //Header bytes + size field bytes + data
//IMPORTANT: Change to serial port that is connected to PC
Serial.write((uint8_t * )buffer, pktSize);
} |
- Abre la aplicación SimPlot que has instalado en Windows.
- Configura la velocidad en 57600. Conecta con el puerto donde tengas el Arduino y verás estas gráficas.
- Así que esta aplicación nos puede servir como para tener una especie de osciloscopio, en vez de ver valores en el Serial Monitor, vemos gráficas en este programa SimPlot
_____________________________________
- Blink
Este sería el código del Blink, parpadeo del LED13.
- Sale una onda triangular. Tal vez esperabas que saliera una onda cuadrada, pero estudia un poco el código. Cada vez que llega a la línea Delay, el programa se para durante 1 segundo, así que solo dibuja el cambio de estado, arriba y abajo.
blink.ino |
void setup() { Serial.begin(57600); }
int buffer[20];
int amplitud = 100;
void loop()
{
int data1;
int data2;
int data3;
int data4;
//Generating data that will be plotted
// data1 = 0;
data2 = 0;
data3 = 0;
data4 = 0;
digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level)
data1 = 1 * amplitud;
plot(data1,data2,data3,data4);
delay(1000); // wait for a second
digitalWrite(13, LOW); // turn the LED off by making the voltage LOW
data1 = 0 * amplitud;
plot(data1,data2,data3,data4);
delay(1000);
// delay(100); //Need some delay else the program gets swamped with data
}
void plot(int data1, int data2, int data3, int data4)
{
int pktSize;
buffer[0] = 0xCDAB; //SimPlot packet header. Indicates start of data packet
buffer[1] = 4*sizeof(int); //Size of data in bytes. Does not include the header and size fields
buffer[2] = data1;
buffer[3] = data2;
buffer[4] = data3;
buffer[5] = data4;
pktSize = 2 + 2 + (4*sizeof(int)); //Header bytes + size field bytes + data
//IMPORTANT: Change to serial port that is connected to PC
Serial.write((uint8_t * )buffer, pktSize);
} |
_____________________________________
_____________________________________
_____________________________________
_____________________________________
66.- Arduino Monitor. Osciloscopio.
- Esta aplicación es parecida a la anterior, funciona en Windows.
- Lo bajamos de aquí... ArduinoMonitor-0.2c.zip
- Lo descomprimimos y copiamos su carpeta iArduino en la carpeta libraries de nuestro IDE Arduino.
- Lo ejecutamos mediante ArduinoMonitor.exe
- Copiamos este Skecth en nuestro IDE Arduino para hacer una prueba.
- Es el blink (parpadeo) sin Delay.
blink sin delay.ino |
/* This sketch shows an example use of iArduinoTerminal for debugging without using iArduino language. The sketch extends Blink without Delay in the example. */
#include <EEPROM.h> // include EEPROM.h even if you don't need it
#include <Servo.h> // include Servo.h even if you don't need it
#include <iArduino.h> // include library header
iArduinoHandleProtocol debug; // declare iArduinoHandleProtocol
const int ledPin = 13;
int ledState = LOW;
long previousMillis = 0;
long interval = 1000;
void setup() {
debug.begin(); // Setup, serial port is initialized.
// The baudrate is 115.2kbps.
pinMode(ledPin, OUTPUT);
}
void loop()
{
debug.check(); // Periodiclly call this function
unsigned long currentMillis = millis();
if(currentMillis - previousMillis > interval) {
previousMillis = currentMillis;
if (ledState == LOW) {
ledState = HIGH;
Serial.println("HIGH"); // You can use Serial.flush, print, println, and write
// as usual.
} else {
ledState = LOW;
Serial.println("LOW");
}
digitalWrite(ledPin, ledState);
}
if (debug.available()) { // Use available() of iArduinoHandleProtcol instead of
// Serial.available()
int c = debug.read(); // Use read() of iArduinoHandleProtcol instead of
// Serial.read();
if (c == '1')
Serial.println("Recieved 1.");
}
} |
BareMininum.ino |
#include // include EEPROM.h even if you don't need it
#include // include Servo.h even if you don't need it
#include // include library header
iArduinoHandleProtocol debug; // declare iArduinoHandleProtocol
void setup() {
debug.begin(); // initialize iArduinoHandleProtocol
// Serial port is initialized at
// 115.2kbps.
// put your setup code here, to run once:
}
void loop() {
debug.check(); // call this function periodically
// put your main code here, to run repeatedly:
} |
Web del proyecto
_____________________________________
67.- iArduino.
http://n.mtng.org/ele/arduino/iarduino.html
_____________________________________
- Aquí tienes otro ejemplo, en este caso con el Arduino DUE:
http://nicecircuits.com/playing-with-analog-to-digital-converter-on-arduino-due/
_____________________________________
- BitServer reconocimiento de voz. Windows. 9 €
Reconocimiento de voz con el programa comercial BitVoicer Server, es un programa que se instala en Windows.
Mediante el micrófono de Windows o un micrófono incorporado a Arduino, hablamos. El BitVoice reconocerá la voz y podrá enviar órdenes al Arduino.
https://www.hackster.io/msb4180/speech-recognition-with-arduino-and-bitvoicer-server-460477
________________________________
|