Manufactura industrial
Internet industrial de las cosas | Materiales industriales | Mantenimiento y reparación de equipos | Programación industrial |
home  MfgRobots >> Manufactura industrial >  >> Manufacturing Technology >> Proceso de manufactura

Cómo hacer un mini osciloscopio en casa usando Arduino Nano

Componentes y suministros

Arduino Nano R3
× 1
Módulo de pantalla ElectroPeak 0.96 "OLED 64x128
× 1
Interruptor táctil, accionado por la parte superior
× 9
1N4148 - Cambio rápido de propósito general
× 4

Aplicaciones y servicios en línea

Arduino IDE

Acerca de este proyecto

En este video, te mostraré cómo hacer tu propio mini osciloscopio en casa. Es simple y fácil de hacer. No es mi propio código, solo hago un tutorial para ustedes. Con el fin de realizar este proyecto, había dependido del código fuente de terceros, cuyo enlace se proporciona a continuación. Si tiene alguna pregunta o sugerencia, no dude en comentar en mi video de YouTube y por favor no olvide dar me gusta y suscribirse a mi canal de YouTube .

Haga clic aquí para ver el tutorial completo y el código fuente.

Mi IG:https://www.instagram.com/pm.goharian/

Componentes necesarios

  • Arduino Nano
  • Pantalla OLED SSD1306
  • 1N4148
  • Microinterruptor
  • 104 condensador
  • Resistencias:100Ω, 12k, 120k, 510k

¿Qué es un osciloscopio?

Un "osciloscopio", anteriormente llamado "oscilógrafo", y conocido informalmente como osciloscopio o fuera de alcance , CRO (para osciloscopio de rayos catódicos) o DSO (para el osciloscopio de almacenamiento digital más moderno), es un tipo de instrumento de prueba electrónico que muestra gráficamente señales [voltajes] variables, generalmente como un diagrama bidimensional de una o más señales en función del tiempo. Otras señales (como sonido o vibración) se pueden convertir a voltajes y mostrar.

Los osciloscopios muestran el cambio de una señal eléctrica a lo largo del tiempo, con el voltaje y el tiempo como los ejes Y y X, respectivamente, en una escala calibrada. Luego, la forma de onda se puede analizar en busca de propiedades como amplitud, frecuencia, tiempo de subida, intervalo de tiempo, distorsión y otras. Los instrumentos digitales modernos pueden calcular y mostrar estas propiedades directamente. Originalmente, el cálculo de estos valores requería medir manualmente la forma de onda contra las escalas integradas en la pantalla del instrumento.

Esquemas del proyecto

Nota: Asegúrese de que todas las conexiones en su circuito sean exactamente las mismas que en los esquemas.

referencia:

http://radiopench.blog96.fc2.com/blog-entry-893.html

https://www.wikipedia.org/

Código

  • código
código C / C ++
 / * (_20190212_OLEDoscilloscope.ino) 1285byte ram libre 2019/02/12 * / # include  #include  #include  #include  // PROGMEM # include  #define SCREEN_WIDTH 128 // Ancho de la pantalla OLED # define SCREEN_HEIGHT 64 // Altura de la pantalla OLED # define REC_LENGTH 200 // // Declaración para una pantalla SSD1306 conectada a I2C (pines SDA, SCL) #define OLED_RESET -1 // Restablecer el pin # (o -1 si se comparte el pin de restablecimiento de Arduino) Pantalla Adafruit_SSD1306 (SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET); // const char vRangeName [10] [5] PROGMEM ={"A50V", "A 5V", "50V", "20V", "10V", "5V", "2V", "1V", "0.5V", "0.2V"}; // \ 0const char * const vstring_table [] PROGMEM ={vRangeName [0], vRangeName [1], vRangeName [2], vRangeName [3], vRangeName [4], vRangeName [5], vRangeName [6], vRangeName [ 7], vRangeName [8], vRangeName [9]}; const char hRangeName [8] [6] PROGMEM ={"50ms", "20ms", "10ms", "5ms", "2ms", "1ms", "500us", "200us"}; // (48const char * const hstring_table [] PROGMEM ={hRangeName [0], hRangeName [1], hRangeName [2], hRangeName [3], hRangeName [4], hRangeName [5], hRangeName [6], hRangeName [ 7]}; int waveBuff [REC_LENGTH]; // (RAM) char chrBuff [10]; // String hScale ="xxxAs"; String vScale ="xxxx"; float lsb5V =0.0055549; // 5V0.005371 V / 1LSBfloat lsb50V =0.051513; // 50V 0.05371 volátil int vRange; // 0:A50V, 1:A 5V, 2:50V, 3:20V, 4:10V, 5:5V, 6:2V, 7:1V, 8:0.5 Vvolátil int hRange; // 0:50m, 1:20m, 2:10m, 3:5m, 4; 2m, 5:1m, 6:500u, 7; 200uvolatile int trigD; // 0:1:volátil int alcanceP; // 0 :, 1 :, 2:volatile boolean hold =false; // voltile boolean paraChanged =false; // truevolatile int saveTimer; // EEPROMint timeExec; // (ms) int dataMin; // (min:0) int dataMax; // (max:1023) int dataAve; // 10 max:10230) int rangeMax; // int rangeMin; // int rangeMaxDisp; // max100int rangeMinDisp; // minint trigP; // boolean trigSync; // int att10x; // 1void setup () {pinMode (2, INPUT_PULLUP); // (int0 pinMode (8, INPUT_PULLUP); // Seleccione pinMode (9, INPUT_PULLUP); // Arriba pinMode (10, INPUT_PULLUP); // Abajo pinMode (11, INPUT_PULLUP); // Mantenga pinMode (12, INPUT); // 1/10 pinMode (13, OUTPUT); // // Serial.begin (115200); // RAM if (! Display.begin (SSD1306_SWITCHCAPVCC, 0x3C)) {// Dirección 0x3C para 128x64 // Serial. println (F ("SSD1306 falló")); for (;;); // No continúe, bucle para siempre} loadEEPROM (); // EEPROM analogReference (INTERNAL); // ADC1.1Vvref) attachInterrupt (0, pin2IRQ , DESCENDENTE); // Pantalla de inicio(); //} bucle vacío () {escritura digital (13, ALTA); setConditions (); // RAM40 readWave (); // (1.6ms) digitalWrite (13, BAJO); // dataAnalize (); // (0.4-0.7ms) writeCommonImage (); // (4.6ms) plotData (); // (5.4ms +) dispInf (); // (6.2ms) display.display (); // (37ms) saveEEPROM (); // EEPROM while (mantener ==verdadero) {// Mantener dispHold (); retraso (10); }} void setConditions () {// // PROGMEM strcpy_P (chrBuff, (char *) pgm_read_word (&(hstring_table [hRange]))); // hScale =chrBuff; // hScale // strcpy_P (chrBuff, (char *) pgm_read_word (&(vstring_table [vRange]))); // vScale =chrBuff; // vScale switch (vRange) {// caso 0:{// Auto50V // rangeMax =1023; // rangeMin =0; att10x =1; // descanso; } caso 1:{// Auto 5V // rangeMax =1023; // rangeMin =0; att10x =0; // descanso; } caso 2:{// 50V rangeMax =50 / lsb50V; // rangeMaxDisp =5000; // 100 rangoMin =0; rangeMinDisp =0; att10x =1; // descanso; } caso 3:{// 20V rangeMax =20 / lsb50V; // rangeMaxDisp =2000; rangeMin =0; rangeMinDisp =0; att10x =1; // descanso; } caso 4:{// 10V rangeMax =10 / lsb50V; // rangeMaxDisp =1000; rangeMin =0; rangeMinDisp =0; att10x =1; // descanso; } caso 5:{// 5V rangeMax =5 / lsb5V; // rangeMaxDisp =500; rangeMin =0; rangeMinDisp =0; att10x =0; // descanso; } caso 6:{// 2V rangeMax =2 / lsb5V; // rangeMaxDisp =200; rangeMin =0; rangeMinDisp =0; att10x =0; // descanso; } caso 7:{// 1V rangeMax =1 / lsb5V; // rangeMaxDisp =100; rangeMin =0; rangeMinDisp =0; att10x =0; // descanso; } caso 8:{// 0.5V rangeMax =0.5 / lsb5V; // rangeMaxDisp =50; rangeMin =0; rangeMinDisp =0; att10x =0; // descanso; } caso 9:{// 0.5V rangeMax =0.2 / lsb5V; // rangeMaxDisp =20; rangeMin =0; rangeMinDisp =0; att10x =0; // descanso; }}} void writeCommonImage () {// display.clearDisplay (); // (0.4ms) display.setTextColor (BLANCO); // display.setCursor (86, 0); // Comienza en la pantalla de la esquina superior izquierda.println (F ("av V")); // 1 display.drawFastVLine (26, 9, 55, BLANCO); // display.drawFastVLine (127, 9, 55, BLANCO); // display.drawFastHLine (24, 9, 7, BLANCO); // Max display.drawFastHLine (24, 36, 2, BLANCO); // display.drawFastHLine (24, 63, 7, BLANCO); // display.drawFastHLine (51, 9, 3, BLANCO); // Max display.drawFastHLine (51, 63, 3, BLANCO); // display.drawFastHLine (76, 9, 3, BLANCO); // Max display.drawFastHLine (76, 63, 3, BLANCO); // display.drawFastHLine (101, 9, 3, BLANCO); // Max display.drawFastHLine (101, 63, 3, BLANCO); // display.drawFastHLine (123, 9, 5, BLANCO); // Max display.drawFastHLine (123, 63, 5, BLANCO); // para (int x =26; x <=128; x + =5) {display.drawFastHLine (x, 36, 2, BLANCO); // ()} para (int x =(127 - 25); x> 30; x - =25) {para (int y =10; y <63; y + =5) {display.drawFastVLine (x, y , 2, BLANCO); // 3}}} void readWave () {// if (att10x ==1) {// 1/10 pinMode (12, SALIDA); // digitalWrite (12, BAJO); // BAJO} else {// pinMode (12, ENTRADA); // Hi-z} switch (hRange) {// caso 0:{// 50ms timeExec =400 + 50; // (ms) EEPROM ADCSRA =ADCSRA &0xf8; // 3 ADCSRA =ADCSRA | 0x07; // 128 (arduino for (int i =0; i  dataMax) {// dataMax =d; }} // dataAve =(suma + 10) / 20; // 10 // max, min if (rangoV <=1) {// Auto1 rangeMin =dataMin - 20; // -20 rangoMin =(rangoMin / 10) * 10; // 10 if (rangeMin <0) {rangeMin =0; // 0} rangeMax =dataMax + 20; // +20 rangeMax =((rangeMax / 10) + 1) * 10; // 10 if (rangeMax> 1020) {rangeMax =1023; // 10201023} if (att10x ==1) {// rangeMaxDisp =100 * (rangeMax * lsb50V); // ADC rangeMinDisp =100 * (rangeMin * lsb50V); //} else {// rangeMaxDisp =100 * (rangeMax * lsb5V); rangeMinDisp =100 * (rangeMin * lsb5V); }} else {// //} // for (trigP =((REC_LENGTH / 2) - 51); trigP <((REC_LENGTH / 2) + 50); trigP ++) {// if (trigD ==0) { // 0 if ((waveBuff [trigP - 1] <(dataMax + dataMin) / 2) &&(waveBuff [trigP]> =(dataMax + dataMin) / 2)) {break; //}} else {// 0 if ((waveBuff [trigP - 1]> (dataMax + dataMin) / 2) &&(waveBuff [trigP] <=(dataMax + dataMin) / 2)) {break; } //}} trigSync =true; if (trigP> =((REC_LENGTH / 2) + 50)) {// trigP =(REC_LENGTH / 2); trigSync =falso; // Desincronizar}} void startScreen () {// display.clearDisplay (); display.setTextSize (1); // 2 display.setTextColor (WHITE); // display.setCursor (10, 25); // display.println (F ("PM.GOHARIAN")); // display.setCursor (10, 45); // display.println (F ("Oscopio de lápiz")); display.display (); // retraso (5000); display.clearDisplay (); display.setTextSize (1); //} void dispHold () {// Mantener display.fillRect (32, 12, 24, 8, NEGRO); // 4 display.setCursor (32, 12); display.print (F ("Mantener")); // Mantenga pulsado display.display (); //} void dispInf () {// voltaje flotante; // display.setCursor (2, 0); // display.print (vScale); // if (scopeP ==0) {// display.drawFastHLine (0, 7, 27, BLANCO); // display.drawFastVLine (0, 5, 2, BLANCO); display.drawFastVLine (26, 5, 2, BLANCO); } // display.setCursor (34, 0); // display.print (hScale); // (tiempo / div) if (scopeP ==1) {// display.drawFastHLine (32, 7, 33, BLANCO); // display.drawFastVLine (32, 5, 2, BLANCO); display.drawFastVLine (64, 5, 2, BLANCO); } // display.setCursor (75, 0); // if (trigD ==0) {display.print (char (0x18)); //} else {display.print (char (0x19)); //} if (scopeP ==2) {// display.drawFastHLine (71, 7, 13, BLANCO); // display.drawFastVLine (71, 5, 2, BLANCO); display.drawFastVLine (83, 5, 2, BLANCO); } // if (att10x ==1) {// 10 voltaje =dataAve * lsb50V / 10.0; // 50V} else {voltage =dataAve * lsb5V / 10.0; // 5V} dtostrf (voltaje, 4, 2, chrBuff); // x.xx display.setCursor (98, 0); // display.print (chrBuff); // // display.print (saveTimer); // // voltaje =rangeMaxDisp / 100.0; // Max if (vRange ==1 || vRange> 4) {// 5VAuto5V dtostrf (voltaje, 4, 2, chrBuff); // *. **} else {// dtostrf (voltaje, 4, 1, chrBuff); // **. *} display.setCursor (0, 9); display.print (chrBuff); // Voltaje máximo =(rangeMaxDisp + rangeMinDisp) / 200.0; // if (vRange ==1 || vRange> 4) {// 5VAuto5V dtostrf (voltaje, 4, 2, chrBuff); // 2} else {// dtostrf (voltaje, 4, 1, chrBuff); // 1} display.setCursor (0, 33); display.print (chrBuff); // voltaje =rangeMinDisp / 100.0; // Min if (vRange ==1 || vRange> 4) {// 5VAuto5V dtostrf (voltaje, 4, 2, chrBuff); // 2} else {dtostrf (voltaje, 4, 1, chrBuff); // 1} display.setCursor (0, 57); display.print (chrBuff); // Min // if (trigSync ==false) {// display.setCursor (60, 55); // display.print (F ("Unsync")); // Desincronizar}} void plotData () {// long y1, y2; para (int x =0; x <=98; x ++) {y1 =map (waveBuff [x + trigP - 50], rangeMin, rangeMax, 63, 9); // y1 =restringir (y1, 9, 63); // y2 =map (waveBuff [x + trigP - 49], rangeMin, rangeMax, 63, 9); // y2 =restringir (y2, 9, 63); // display.drawLine (x + 27, y1, x + 28, y2, BLANCO); //}} void saveEEPROM () {// EEPROM if (paraChanged ==true) {// saveTimer =saveTimer - timeExec; // if (saveTimer <0) {// paraChanged =false; // EEPROM.write (0, vRange); // EEPROM.write (1, hRange); EEPROM.write (2, trigD); EEPROM.write (3, alcanceP); }}} void loadEEPROM () {// EEPROM int x; x =EEPROM.read (0); // rangov if ((x <0) || (x> 9)) {// 0-9 x =3; //} vRange =x; x =EEPROM.read (1); // hRange if ((x <0) || (x> 7)) {// 0-9 x =3; //} hRange =x; x =EEPROM.read (2); // trigD if ((x <0) || (x> 1)) {// 0-9 x =1; //} trigD =x; x =EEPROM.read (3); // alcanceP si ((x <0) || (x> 2)) {// 0-9 x =1; //} scopeP =x;} void pin2IRQ () {// Pin2 (int0) // pin8,9,10,11Pin2 // int x; // x =PINB; // B if ((x &0x07)! =0x07) {// 3High saveTimer =5000; // EEPROM (ms paraChanged =true; // ON} if ((x &0x01) ==0) {scopeP ++; if (scopeP> 2) {scopeP =0;}} if ((x &0x02) ==0 ) {// ARRIBA if (scopeP ==0) {// vRange ++; if (vRange> 9) {vRange =9;}} if (scopeP ==1) {// hRange ++; if (hRange> 7) {hRange =7;}} if (scopeP ==2) {// trigD =0; //}} if ((x &0x04) ==0) {// DOWN if (scopeP ==0) {// vRange- -; if (rangoV <0) {rangoV =0;}} if (alcanceP ==1) {// rangoH--; if (rangoH <0) {rangoH =0;}} if (alcanceP ==2) { // trigD =1; //}} if ((x &0x08) ==0) {// HOLD hold =! hold; //}} 

Esquemas


Proceso de manufactura

  1. Haga una máquina de escribir para hacer tareas caseras en casa
  2. Consola de edición de Photoshop DIY con Arduino Nano RP 2040
  3. Cómo hacer fibra de carbono desde cero en casa
  4. Hacer Monitor Ambilight usando Arduino
  5. Cómo hacer un botón de teclado perforable personalizable
  6. Cómo medir la masa de la Tierra usando Arduino
  7. Cómo crear un sitio web comunicando Arduino usando PHP
  8. Cómo hacer música con un Arduino
  9. Cómo hacer una apertura automática de puerta basada en Arduino
  10. Crea un robot para comer con Arduino Nano | Tornillo dorado
  11. Cómo hacer una brújula usando Arduino y Processing IDE