I've been following instructions on how to make a universal remote from an ATTiny85 microcontroller using this video: https://www.youtube.com/watch?v=_nm4if-lusI&list=WL&index=4
From there I used the IRremote library (4.1.0 version) to work with this code shown here:
#include <IRremote.h>
const byte butonPin = 2; //button input
const byte IRPin = 1; // LED output
void setup()
{
// connect button to ground and input
pinMode(butonPin, INPUT_PULLUP);
IrSender.begin(IRPin);
}
void loop()
{
static bool lastButtonState = HIGH;
bool buttonState = digitalRead(butonPin);
if (buttonState != lastButtonState)
{
if (digitalRead(butonPin) == HIGH) {
IrSender.sendNEC(0xEB14FD02, 32);
}
lastButtonState = buttonState;
}
}
I asked the ATTiny to send this signal (0xEB14FD02) using the remote circuit shown in the YouTube video and tried to see if my arduino could pick it up on the serial monitor using the ReceiveDump example included in the library.
Here is the response from the old remote that I copied the signal from:
+9000,-4300
-
650,- 500 + 650,-1550 + 650,- 450 + 650,- 450
-
650,- 500 + 650,- 450 + 650,- 450 + 650,- 450
-
650,-1600 + 650,- 450 + 650,-1550 + 650,-1600
-
650,-1550 + 700,-1550 + 650,-1550 + 650,-1550
-
700,- 450 + 650,- 450 + 700,-1500 + 700,- 450
-
650,-1550 + 700,- 400 + 700,- 400 + 700,- 450
-
650,-1550 + 700,-1550 + 650,- 450 + 650,-1550
-
700,- 400 + 750,-1500 + 700,-1500 + 750,-1500
-
700
Sum: 67350
Result as internal 8bit ticks (50 us) array - compensated with MARK_EXCESS_MICROS=20
uint8_t rawTicks[67] = {180,86, 13,10, 13,31, 13,9, 13,9, 13,10, 13,9, 13,9, 13,9, 13,32, 13,9, 13,31, 13,32, 13,31, 14,31, 13,31, 13,31, 14,9, 13,9, 14,30, 14,9, 13,31, 14,8, 14,8, 14,9, 13,31, 14,31, 13,9, 13,31, 14,8, 15,30, 14,30, 15,30, 14}; // Protocol=NEC Address=0x2 Command=0x14 Raw-Data=0xEB14FD02 32 bits LSB first
Result as microseconds array - compensated with MARK_EXCESS_MICROS=20
uint16_t rawData[67] = {8980,4320, 630,520, 630,1570, 630,470, 630,470, 630,520, 630,470, 630,470, 630,470, 630,1620, 630,470, 630,1570, 630,1620, 630,1570, 680,1570, 630,1570, 630,1570, 680,470, 630,470, 680,1520, 680,470, 630,1570, 680,420, 680,420, 680,470, 630,1570, 680,1570, 630,470, 630,1570, 680,420, 730,1520, 680,1520, 730,1520, 680}; // Protocol=NEC Address=0x2 Command=0x14 Raw-Data=0xEB14FD02 32 bits LSB first
uint16_t address = 0x2;
uint16_t command = 0x14;
uint32_t rawData = 0xEB14FD02;
Pronto Hex as string
char prontoData[] = "0000 006D 0022 0000 015B 00A5 001A 0012 001A 003B 001A 0011 001A 0011 001A 0012 001A 0011 001A 0011 001A 0011 001A 003D 001A 0011 001A 003B 001A 003D 001A 003B 001C 003B 001A 003B 001A 003B 001C 0011 001A 0011 001C 0039 001C 0011 001A 003B 001C 000F 001C 000F 001C 0011 001A 003B 001C 003B 001A 0011 001A 003B 001C 000F 001E 0039 001C 0039 001E 0039 001C 06C3 ";
Ln 1, Col 1
Arduino Uno
on COM5
And here are two examples of the responses I got from my ATTiny85 remote:
EX.#1
-
150,- 150 + 200,- 100 + 150,- 100 + 200,- 150
-
400,- 300 + 400,- 100 + 200,- 100 + 150,- 150
-
150,- 150 + 150,- 100 + 200,- 100 + 200,- 150
-
100,- 100 + 200,- 150 + 150,- 100 + 200,- 100
-
200,- 100 + 150,- 150 + 150,- 100 + 200,- 100
-
200,- 100 + 150,- 200 + 400,- 100 + 200,- 100
-
200,- 100 + 150,- 150 + 200,- 100 + 150,- 100
-
200,- 100 + 200,- 100 + 150,- 150 + 150,- 150
-
450,- 100 + 150,- 150 + 200,- 100 + 150,- 100
-
200,- 150 + 400,- 200 + 400,- 100 + 200
Sum: 13800
Result as internal 8bit ticks (50 us) array - compensated with MARK_EXCESS_MICROS=20
uint8_t rawTicks[337] = {8,2, 3,3, 4,2, 3,2, 4,3, 8,6, 8,2, 4,2, 3,3, 3,3, 3,2, 4,2, 4,3, 2,2, 4,3, 3,2, 4,2, 4,2, 3,3, 3,2, 4,2, 4,2, 3,4, 8,2, 4,2, 4,2, 3,3, 4,2, 3,2, 4,2, 4,2, 3,3, 3,3, 9,2, 3,3, 4,2, 3,2, 4,3, 8,4, 8,2, 4,2, 4,2, 3,3, 4,2, 3,3, 9,2, 3,3, 3,3, 3,3, 9,2, 3,3, 4,2, 3,2, 4,35, 7,2, 5,2, 3,2, 4,2, 3,3, 3,3, 3,2, 4,2, 4,3, 8,2, 4,2, 4,2, 4,2, 4,2, 3,2, 4,3, 3,2, 4,2, 3,4, 2,4, 8,2, 4,3, 2,2, 4,2, 4,2, 4,2, 4,2, 3,2, 4,2, 4,2, 4,2, 3,3, 4,2, 3,2, 3,3, 4,2, 3,3, 3,4, 8,2, 4,2, 3,3, 3,3, 3,2, 4,2, 4,2, 3,12, 8,2, 3,3, 3,3, 3,2, 4,2, 4,2, 3,4, 8,4, 1,3, 4,2, 3,3, 3,3, 9,2, 4,3, 9,72, 8,2, 4,3, 9,2, 3,4, 3,2, 3,3, 9,2, 4,2, 3,2, 4,2, 4,3, 8,3, 3,3, 9,2, 4,2, 3,3, 3,2, 4,5, 8,4, 8,3, 3,3, 2,16, 2,2, 4,2, 3,3, 4,2, 3,3, 3,3, 3,2, 3,3, 4,2, 3,2, 4,3, 8,4, 9,2, 3,2, 4,2, 4,2, 3,3, 3,3, 9,2, 3,4, 8,2, 4,2, 4,3, 8,2, 4,3, 3,2, 4,3, 8,2, 4,9, 2,4, 2,4, 2}; // Protocol=PulseWidth Raw-Data=0x61 168 bits LSB first
Result as microseconds array - compensated with MARK_EXCESS_MICROS=20
uint16_t rawData[337] = {380,120, 130,170, 180,120, 130,120, 180,170, 380,320, 380,120, 180,120, 130,170, 130,170, 130,120, 180,120, 180,170, 80,120, 180,170, 130,120, 180,120, 180,120, 130,170, 130,120, 180,120, 180,120, 130,220, 380,120, 180,120, 180,120, 130,170, 180,120, 130,120, 180,120, 180,120, 130,170, 130,170, 430,120, 130,170, 180,120, 130,120, 180,170, 380,220, 380,120, 180,120, 180,120, 130,170, 180,120, 130,170, 430,120, 130,170, 130,170, 130,170, 430,120, 130,170, 180,120, 130,120, 180,1770, 330,120, 230,120, 130,120, 180,120, 130,170, 130,170, 130,120, 180,120, 180,170, 380,120, 180,120, 180,120, 180,120, 180,120, 130,120, 180,170, 130,120, 180,120, 130,220, 80,220, 380,120, 180,170, 80,120, 180,120, 180,120, 180,120, 180,120, 130,120, 180,120, 180,120, 180,120, 130,170, 180,120, 130,120, 130,170, 180,120, 130,170, 130,220, 380,120, 180,120, 130,170, 130,170, 130,120, 180,120, 180,120, 130,620, 380,120, 130,170, 130,170, 130,120, 180,120, 180,120, 130,220, 380,220, 30,170, 180,120, 130,170, 130,170, 430,120, 180,170, 430,3620, 380,120, 180,170, 430,120, 130,220, 130,120, 130,170, 430,120, 180,120, 130,120, 180,120, 180,170, 380,170, 130,170, 430,120, 180,120, 130,170, 130,120, 180,270, 380,220, 380,170, 130,170, 80,820, 80,120, 180,120, 130,170, 180,120, 130,170, 130,170, 130,120, 130,170, 180,120, 130,120, 180,170, 380,220, 430,120, 130,120, 180,120, 180,120, 130,170, 130,170, 430,120, 130,220, 380,120, 180,120, 180,170, 380,120, 180,170, 130,120, 180,170, 380,120, 180,470, 80,220, 80,220, 80}; // Protocol=PulseWidth Raw-Data=0x61 168 bits LSB first
uint16_t address = 0x0;
uint16_t command = 0x0;
uint32_t rawData = 0x61;
Pronto Hex as string
char prontoData[] = "0000 006D 00A9 0000 0010 0003 0007 0005 0008 0003 0007 0003 0008 0005 0010 000B 0010 0003 0008 0003 0007 0005 0007 0005 0007 0003 0008 0003 0008 0005 0005 0003 0008 0005 0007 0003 0008 0003 0008 0003 0007 0005 0007 0003 0008 0003 0008 0003 0007 0007 0010 0003 0008 0003 0008 0003 0007 0005 0008 0003 0007 0003 0008 0003 0008 0003 0007 0005 0007 0005 0012 0003 0007 0005 0008 0003 0007 0003 0008 0005 0010 0007 0010 0003 0008 0003 0008 0003 0007 0005 0008 0003 0007 0005 0012 0003 0007 0005 0007 0005 0007 0005 0012 0003 0007 0005 0008 0003 0007 0003 0008 0043 000E 0003 000A 0003 0007 0003 0008 0003 0007 0005 0007 0005 0007 0003 0008 0003 0008 0005 0010 0003 0008 0003 0008 0003 0008 0003 0008 0003 0007 0003 0008 0005 0007 0003 0008 0003 0007 0007 0005 0007 0010 0003 0008 0005 0005 0003 0008 0003 0008 0003 0008 0003 0008 0003 0007 0003 0008 0003 0008 0003 0008 0003 0007 0005 0008 0003 0007 0003 0007 0005 0008 0003 0007 0005 0007 0007 0010 0003 0008 0003 0007 0005 0007 0005 0007 0003 0008 0003 0008 0003 0007 0016 0010 0003 0007 0005 0007 0005 0007 0003 0008 0003 0008 0003 0007 0007 0010 0007 0003 0005 0008 0003 0007 0005 0007 0005 0012 0003 0008 0005 0012 008A 0010 0003 0008 0005 0012 0003 0007 0007 0007 0003 0007 0005 0012 0003 0008 0003 0007 0003 0008 0003 0008 0005 0010 0005 0007 0005 0012 0003 0008 0003 0007 0005 0007 0003 0008 0009 0010 0007 0010 0005 0007 0005 0005 001E 0005 0003 0008 0003 0007 0005 0008 0003 0007 0005 0007 0005 0007 0003 0007 0005 0008 0003 0007 0003 0008 0005 0010 0007 0012 0003 0007 0003 0008 0003 0008 0003 0007 0005 0007 0005 0012 0003 0007 0007 0010 0003 0008 0003 0008 0005 0010 0003 0008 0005 0007 0003 0008 0005 0010 0003 0008 0011 0005 0007 0005 0007 0005 06C3 ";
Ln 1, Col 1
Arduino Uno
on COM5
EX.#2
Raw result in internal ticks (50 us) - with leading gap
rawData[16]:
-277
-
1,-22
-
2,- 3 + 9,- 2 + 4,- 2 + 3,-10
-
8,- 2 + 4,- 2 + 4
Sum: 78
Raw result in microseconds - with leading gap
rawData[16]:
-13850
-
50,-1100
-
100,- 150 + 450,- 100 + 200,- 100 + 150,- 500
-
400,- 100 + 200,- 100 + 200
Sum: 3900
Result as internal 8bit ticks (50 us) array - compensated with MARK_EXCESS_MICROS=20
uint8_t rawTicks[15] = {1,22, 2,3, 9,2, 4,2, 3,10, 8,2, 4,2, 4}; // Protocol=UNKNOWN Hash=0x9DA6B59A 8 bits (incl. gap and start) received
Result as microseconds array - compensated with MARK_EXCESS_MICROS=20
uint16_t rawData[15] = {30,1120, 80,170, 430,120, 180,120, 130,520, 380,120, 180,120, 180}; // Protocol=UNKNOWN Hash=0x9DA6B59A 8 bits (incl. gap and start) received
Pronto Hex as string
char prontoData[] = "0000 006D 0008 0000 0003 002A 0005 0005 0012 0003 0008 0003 0007 0012 0010 0003 0008 0003 0008 06C3 ";
Ln 1, Col 1
Arduino Uno
on COM5
I am positive the circuit is setup properly but I am unsure if my coding was done correctly. If anyone has any guidance they can provide as to why my ATTiny is sending random signals rather than what it was programed to send, I would be most grateful.
Thank you for your time