Open benoitm974 opened 2 years ago
Thanks for the interest and contribution. I will leave this post here to help others with the same type of setup.
Hello @fredilarsen !
I adapted this for ESP32 + CC1101 + pushbuttons
You can find it here: https://github.com/joelsernamoreno/ECRF-TeslaCharge
Feel free to post this in this repository if you want
Just wanted to thanks you for your code !
I had an Attiny85 and FS1000A on the bench so decided to give it a try instead of buying new hardware... (I know other github on tesla door opener mention FS1000A can't be used but still wanted to give it a try) It took me some time to compare the tesla charger 433 signal output to the produced Attiny85/FS1000A one... Nor Attiny85 and FS1000A a super stable / calibrated devices... out of the box. The key element to this is the calibration of the Attiny85 internal clock to properly drive the FS1000A. There are several source for calibration of the Attiny85 on the internet (search for Attiny85 OSCCAL calibration). My option, since i wanted to calibrate the couple Attiny85+FS1000A was to use a logical analyser (cheap CY7C68013a mini board <$5) and record the 433 signal at different temperature and compare the time for one seri of pulse to the original tesla recording... (as reference a seri is 132ms on tesla charger EU and it send 5 of them).
Once calibrated I just set the OSCCAL value in the setup function, also I found it more "stable" to "warn" the FS1000A with a data HIGH before the sendsignal (at least it clearly helped the receiver to adapt the noise level for my analysis, but seems also to be more responsive on door opening...)
below the code (with the limited 2/3 changes mentioned above (attiny uses pin 0 for FS1000A, and pin 1 for LED)
`/*
// Pins const uint8_t signalPin = 0; // The number of the pin with the output signal
// The signal to send const uint16_t pulseWidth = 400; // Microseconds const uint16_t messageDistance = 23; // Millis const uint8_t transmissions = 5; // Number of repeated transmissions const uint8_t messageLength = 43; const uint8_t sequence[messageLength] = { 0x02,0xAA,0xAA,0xAA, // Preamble of 26 bits by repeating 1010 0x2B, // Sync byte 0x2C,0xCB,0x33,0x33,0x2D,0x34,0xB5,0x2B,0x4D,0x32,0xAD,0x2C,0x56,0x59,0x96,0x66, 0x66,0x5A,0x69,0x6A,0x56,0x9A,0x65,0x5A,0x58,0xAC,0xB3,0x2C,0xCC,0xCC,0xB4,0xD2, 0xD4,0xAD,0x34,0xCA,0xB4,0xA0};
//OSCCAL = 0x86;
void setup() { OSCCAL = 0x91; //orig 86 //Best 91 Need to be calibrated per AtTiny pinMode(LED_BUILTIN, OUTPUT); pinMode(signalPin, OUTPUT); digitalWrite(signalPin, HIGH); //HIGH to warm the FS1000A
}
void loop() { sendSignals(); delay(1500); }
void sendSignals() { digitalWrite(LED_BUILTIN, HIGH); digitalWrite(signalPin, LOW); //LOW before starting sendByte for (uint8_t t=0; t<transmissions; t++) { for (uint8_t i=0; i<messageLength; i++) sendByte(sequence[i]); digitalWrite(signalPin, HIGH); //HIGH to keep FS1000A up between messages delay(messageDistance); } digitalWrite(LED_BUILTIN, LOW); }
void sendByte(uint8_t dataByte) { for (int8_t bit=7; bit>=0; bit--) { // MSB digitalWrite(signalPin, (dataByte & (1 << bit)) != 0 ? HIGH : LOW); delayMicroseconds(pulseWidth); } }`