Receptor 45-850 Mhz con sintonizador TV análogica y arduino
Después de unos días de parón vuelvo a la carga con este invento que vi en la web Neoteo.
La variante principal es utilizar el arduino para controlarlo y el sintonizador es un PHILIPS UV1316 que permite pasos de 50Khz. Como recptor uso un walky kenwood TH-F7 que cubre todas las bandas hasta 1.2 Ghz
Se usa en encoder rotatorio para cambiar de frecuencia con la librería RotaryEncoderAcceleration que controla la aceleración del giro para variar su incremento o decremento. Ojo no esta actualizada a la ver 1.0+
Por comodidad a la hora de debugear he usado una librería de soft i2c en vez de la que incorpora arduino.
Y he encapsulado todo en una clase para reutilizarlo.
#ifndef tuner_h #define tuner_h #include <arduino.h> #include "SoftI2cMaster.h" #define SCL_PIN A5 #define SDA_PIN A4 #define TUNERADDR 0xc2 #define CONTROLBYTE 0xcc #define VHF_L 0x01 //0xA0 #define VHF_H 0x02 //0x90 #define UHF 0x04 //0x30 #define FVHF_H 110000 #define FUHF 407000 class Tuner { // An instance of class for software master SoftI2cMaster i2cInterface; public: void init(); long get_freq(int div); byte get_band(long fr); byte get_low(long fr); byte get_high(long fr); byte setup_tuner(long fr); byte freq_tuner(int div); }; #endif
#include "Tuner.h" void Tuner::init() { // set i2c pins pullups enabled by default i2cInterface.init(SCL_PIN, SDA_PIN); } long Tuner::get_freq(int div){ return (long(div)*50L-38900L); } byte Tuner::get_band(long fr){ byte bb; if (fr<FVHF_H) bb=VHF_L; else if (fr<FUHF) bb=VHF_H; else bb=UHF; return bb; } byte Tuner::get_low(long fr){ long lo; int div; lo=fr+38900; // add FI div=int(lo/50); return (div & 0x00ff); } byte Tuner::get_high(long fr){ long lo; int div; lo=fr+38900; // add FI div=int(lo/50); return (div & 0xff00)>>8; } byte Tuner::setup_tuner(long fr){ // issue a start condition, send device address and write direction bit if (!i2cInterface.start(TUNERADDR | I2C_WRITE)) return false; // parte alta divisor if (!i2cInterface.write(get_high(fr))) return false; // parte baja divisor if (!i2cInterface.write(get_low(fr))) return false; // byte control if (!i2cInterface.write(CONTROLBYTE)) return false; // band if (!i2cInterface.write(get_band(fr))) return false; // stop condition i2cInterface.stop(); return 1; } byte Tuner::freq_tuner(int div){ return setup_tuner(get_freq(div)); }
Y aquí el código del programa
</pre> #include <arduino.h> #include "SoftI2cMaster.h" #include <TwiMaster.h> #include <Button.h> #include <TicksPerSecond.h> #include <RotaryEncoderAcelleration.h> #include "tuner.h" static const int buttonPin = 4; // the number of the pushbutton pin static const int rotorPinA = 3; // One quadrature pin static const int rotorPinB = 2; // the other quadrature pin static Button btn; static RotaryEncoderAcelleration rotor; static Tuner tuner; void UpdateRotor() { rotor.update(); } #define FREQ 2787 void setup(void) { Serial.begin(9600); delay(1000); btn.initialize(buttonPin); rotor.initialize(rotorPinA, rotorPinB); rotor.setMinMax(1, 16384); // rango del divisor 2^14 rotor.setPosition(FREQ); attachInterrupt(0, UpdateRotor, CHANGE); tuner.init(); tuner.freq_tuner(FREQ); } long lastRotor = 0; void loop() { btn.update(); long fr; int i; long pos = rotor.getPosition(); if (btn.isPressed()) { tuner.freq_tuner(pos); } if (lastRotor != pos) { //float tps = rotor.tps.getTPS(); fr=tuner.get_freq(pos)*1000; i=fr/1000000L; fr=fr%1000000L; if (i<100) Serial.print(" "); Serial.print(i); Serial.print("."); i=fr/1000L; fr=fr%1000L; if (i==0) Serial.print("000"); else if (i<10){ Serial.print("00"); }else if (i<100) Serial.print("0"); if (i) Serial.print(i); Serial.println(".000 Hz"); } lastRotor = pos; }
If some one wants to be updated with most up-to-date technologies therefore he must be visit this web page and be up to date everyday.
Me gustaMe gusta
escafandra autónoma
25 de abril de 2013 at 23:41
Felicidades por tu web !!! Estoy iniciando en el mundo de comunicaciones, soy técnico electrónico 🙂 , mi pregunta era si el filtro saw lo pones directamente a la salida del fi del sintonizador.
Me gustaMe gusta
López Nacho
20 de diciembre de 2014 at 1:17
Si, justo a la salida y antes de entrar en receptor.
Me gustaMe gusta
qlfecv
22 de diciembre de 2014 at 8:31
Si así es.
Me gustaMe gusta
qlfecv
1 de marzo de 2015 at 19:36
Buenas te felicito por la web !! tenes publicado algun video del receptor en Youtube?
Me gustaMe gusta
Alex
6 de agosto de 2015 at 8:46
No, fue una prueba rapida.
Me gustaMe gusta
qlfecv
18 de octubre de 2015 at 9:07
Amigo no entiendo como compilo el programa, que archivos debo de crear con el codigo de arriba
Me gustaMe gusta
luis
1 de octubre de 2017 at 13:34
Así mismo, me pasa lo mismo que al colega Luis. No se como utilizar los códigos de arriba. Antes del código del programa como tal. Y específicamente cuales librerías debo tener para poder compilar. Desde ya muchas gracias.
Me gustaMe gusta
joan
11 de noviembre de 2020 at 16:45
Estas
SoftI2cMaster,TwiMaster,Button,TicksPerSecond,RotaryEncoderAcelleration
Me gustaMe gusta
qlfecv
17 de noviembre de 2020 at 13:14