Send infrared raw signal to air conditioning using Arduino - infrared

I am working on my final year project and I've got a problem to which I cannot find an answer. I tried decoding the infrared signals for my air conditioning. I have decoded both raw and hex, both using Arduino and Raspberry PI (LIRC), but my air conditioning does not turn on when I send the signals. AC Brand is Acson. What I am doing I think it's correct because my TV turns on and off when I send the decoded signals. I also tried sending the raw codes at different frequencies (36 kHz, 38, 40, 433....). None of them seems to be working. Please help me......
These are the raw codes for the turn on/off button (they are changing every time):
1)
Unknown encoding: 4F15BD0C (32 bits)
Raw (132): 8932 4550 -2550 300 -450 300 -1000 300 -1000 300 -450 300 -1000 250 -500 300 -450 300 -450 300 -400 300 -500 250 -500 300 -950 300 -450 300 -450 300 -450 300 -1000 300 -1000 300 -450 300 -450 300 -1000 300 -950 300 -450 300 -450 300 -450 300 -450 300 -1000 300 -1000 300 -450 300 -400 300 -500 300 -450 300 -450 300 -400 300 -450 300 -500 300 -400 300 -1000 300 -450 300 -450 300 -450 300 -450 300 -450 300 -450 300 -450 300 -1000 300 -450 300 -450 300 -450 300 -950 300 -1000 300 -450 300 -450 300 -450 300 -1000 300 -450 300 -450 300 -450 300 -450 300 -450 300 -1000 250 -450 300 -1000 300 -1000 300 -450 350
2)Unknown encoding: 4F15BD0C (32 bits)
Raw (132): -21344 4550 -2600 300 -450 300 -1000 300 -950 300 -450 300 -1000 300 -450 300 -450 300 -450 300 -450 300 -450 300 -450 300 -1000 300 -400 300 -500 250 -500 300 -950 300 -1000 300 -450 300 -450 300 -1000 300 -1000 250 -500 300 -450 300 -450 250 -450 300 -1000 300 -1000 300 -450 300 -450 300 -450 300 -450 300 -450 300 -450 300 -450 300 -450 300 -450 300 -950 300 -500 300 -450 300 -450 250 -450 300 -450 300 -500 300 -400 300 -1000 300 -450 300 -450 300 -450 300 -1000 300 -1000 300 -450 300 -450 300 -400 300 -1000 300 -450 300 -450 300 -450 300 -450 300 -450 300 -1000 300 -450 300 -1000 300 -1000 300 -450 350
3)
Unknown encoding: 4F15BD0C (32 bits)
Raw (132): -3150 4550 -2600 300 -450 300 -1000 300 -1000 250 -450 300 -1000 300 -450 300 -450 300 -450 300 -450 300 -450 300 -450 300 -1000 300 -400 300 -500 300 -450 300 -950 300 -1000 300 -450 300 -450 300 -1000 300 -1000 250 -500 300 -450 300 -450 300 -400 300 -1000 300 -1000 300 -450 300 -450 300 -450 300 -450 300 -450 300 -450 300 -450 300 -450 300 -450 300 -950 300 -500 300 -450 300 -450 300 -400 300 -450 300 -500 250 -450 300 -1000 300 -450 300 -450 300 -450 300 -1000 300 -1000 300 -450 300 -450 300 -400 300 -1000 300 -500 250 -450 300 -450 300 -450 300 -450 300 -1000 300 -450 300 -1000 300 -1000 300 -450 350
This is the code I used for the decoding part:
int RECV_PIN = 2;
IRrecv irrecv(RECV_PIN);
decode_results results;
//#define RAWBUF 255
void setup()
{
Serial.begin(9600);
irrecv.enableIRIn(); // Start the receiver
}
// Dumps out the decode_results structure.
// Call this after IRrecv::decode()
// void * to work around compiler issue
//void dump(void *v) {
// decode_results *results = (decode_results *)v
void dump(decode_results *results) {
int count = results->rawlen;
if (results->decode_type == UNKNOWN) {
Serial.print("Unknown encoding: ");
}
else if (results->decode_type == NEC) {
Serial.print("Decoded NEC: ");
}
else if (results->decode_type == SONY) {
Serial.print("Decoded SONY: ");
}
else if (results->decode_type == RC5) {
Serial.print("Decoded RC5: ");
}
else if (results->decode_type == RC6) {
Serial.print("Decoded RC6: ");
}
else if (results->decode_type == PANASONIC) {
Serial.print("Decoded PANASONIC - Address: ");
Serial.print(" Value: ");
}
else if (results->decode_type == JVC) {
Serial.print("Decoded JVC: ");
}
Serial.print(results->value, HEX);
Serial.print(" (");
Serial.print(results->bits, DEC);
Serial.println(" bits)");
Serial.print("Raw (");
Serial.print(count, DEC);
Serial.print("): ");
for (int i = 0; i < count; i++) {
if ((i % 2) == 1) {
Serial.print(results->rawbuf[i]*USECPERTICK, DEC);
}
else {
Serial.print(-(int)results->rawbuf[i]*USECPERTICK, DEC);
}
Serial.print(" ");
}
Serial.println("");
}
void loop() {
if (irrecv.decode(&results)) {
Serial.println(results.value, HEX);
dump(&results);
irrecv.resume(); // Receive the next value
}
}
And this one is for sending raw signals to AC:
void setup()
{
Serial.begin(9600);
}
void loop() {
for (int i = 0; i < 1000; i++)
{
// send variable sonyPower in length 31 at 40 Khz
irsend.sendRaw(turnOff,131,433);
delay(3000);
}
}
UPDATE
I got this info using IrLib...
IrLIB Details

Related

Why the number of threads growing higher than expected?

I have a test case with just one HTTP request. The number of threads and Ramp Up period is set to 30. And i planning to do the test for 600 seconds.
But looking at the JMeter output, i could see a huge number of requests generated. Why is this so? I am expecting only 60 threads in a minute to generate. Can someone suggest me how to do this?
S:\roshTests\apache-jmeter-3.1\bin>jmeter -n -t
S:\roshTests\LivePerformance\June1\PPS-Proxy\catalog\catalog.jmx -l
S:\roshTests\LivePerformance\June1\PPS-Proxy\catalog\Output\results.csv
Writing log file to: S:\roshTests\apache-jmeter-3.1\bin\jmeter.log
Creating summariser <summary>
Created the tree successfully using S:\roshTests\LivePerformance\June1\PPS-Proxy\catalog\catalog.jmx
Starting the test # Fri Jun 02 05:18:04 IDT 2017 (1496369884546)
Waiting for possible Shutdown/StopTestNow/Heapdump message on port 4445
summary + 377 in 00:00:25 = 15.3/s Avg: 766 Min: 106 Max: 3114 Err: 198 (52.52%) Active: 25 Started: 25 Finished: 0
summary + 1364 in 00:00:30 = 45.5/s Avg: 647 Min: 144 Max: 4385 Err: 1180 (86.51%) Active: 30 Started: 30 Finished: 0
summary = 1741 in 00:00:55 = 31.9/s Avg: 673 Min: 106 Max: 4385 Err: 1378 (79.15%)
summary + 985 in 00:00:30 = 32.8/s Avg: 643 Min: 88 Max: 4918 Err: 752 (76.35%) Active: 30 Started: 30 Finished: 0
summary = 12859 in 00:05:25 = 39.6/s Avg: 616 Min: 88 Max: 6149 Err: 10562 (82.14%)
summary + 984 in 00:00:30 = 32.8/s Avg: 675 Min: 113 Max: 5070 Err: 762 (77.44%) Active: 30 Started: 30 Finished: 0
summary = 11874 in 00:04:55 = 40.3/s Avg: 614 Min: 100 Max: 6149 Err: 9810 (82.62%)
summary + 1103 in 00:00:30 = 36.7/s Avg: 624 Min: 104 Max: 4935 Err: 884 (80.15%) Active: 30 Started: 30 Finished: 0
summary = 10890 in 00:04:25 = 41.2/s Avg: 609 Min: 100 Max: 6149 Err: 9048 (83.09%)
summary + 1220 in 00:00:30 = 40.6/s Avg: 584 Min: 100 Max: 6149 Err: 1001 (82.05%) Active: 30 Started: 30 Finished: 0
summary = 9787 in 00:03:55 = 41.7/s Avg: 607 Min: 100 Max: 6149 Err: 8164 (83.42%)
summary + 1336 in 00:00:30 = 44.5/s Avg: 570 Min: 106 Max: 5296 Err: 1106 (82.78%) Active: 30 Started: 30 Finished: 0
summary = 8567 in 00:03:25 = 41.9/s Avg: 610 Min: 106 Max: 5643 Err: 7163 (83.61%)
summary + 1320 in 00:00:30 = 44.0/s Avg: 587 Min: 116 Max: 5187 Err: 1111 (84.17%) Active: 30 Started: 30 Finished: 0
summary = 7231 in 00:02:55 = 41.4/s Avg: 618 Min: 106 Max: 5643 Err: 6057 (83.76%)
summary + 1273 in 00:00:30 = 42.5/s Avg: 637 Min: 106 Max: 5383 Err: 1072 (84.21%) Active: 30 Started: 30 Finished: 0
summary = 5911 in 00:02:25 = 40.9/s Avg: 625 Min: 106 Max: 5643 Err: 4946 (83.67%)
summary + 1430 in 00:00:30 = 47.6/s Avg: 591 Min: 116 Max: 5643 Err: 1229 (85.94%) Active: 30 Started: 30 Finished: 0
summary = 4638 in 00:01:55 = 40.5/s Avg: 621 Min: 106 Max: 5643 Err: 3874 (83.53%)
summary + 1467 in 00:00:30 = 48.9/s Avg: 589 Min: 119 Max: 4691 Err: 1267 (86.37%) Active: 30 Started: 30 Finished: 0
summary = 3208 in 00:01:25 = 37.9/s Avg: 635 Min: 106 Max: 4691 Err: 2645 (82.45%)
summary + 1070 in 00:00:30 = 35.7/s Avg: 651 Min: 99 Max: 7324 Err: 862 (80.56%) Active: 30 Started: 30 Finished: 0
summary = 13929 in 00:05:55 = 39.3/s Avg: 619 Min: 88 Max: 7324 Err: 11424 (82.02%)
summary + 1531 in 00:00:30 = 51.1/s Avg: 594 Min: 106 Max: 5194 Err: 1332 (87.00%) Active: 30 Started: 30 Finished: 0
summary = 15460 in 00:06:25 = 40.2/s Avg: 617 Min: 88 Max: 7324 Err: 12756 (82.51%)
I'm not sure if you understand the difference between Threads and requests. amount of Threads isn't equal to requests, what you're seeing in the output is the amount of requests made by your threads, and depending on your response times it's very well possible to get that many results.
Try setting the Loop count to 1 or 2 and you'll see that the requests will even out with your calculations.
Beside that... in your output on the far right side you can see how many Threads are started.
With your current setup, threads will start with one second delay.
Ramp up period is the time in which all treads should start.
You have loop set to infinite, so when all thread login after initial 30 seconds, you will always have 30 active users, and could never have more that that.
You have many more requests, depending on response time of your server, but threads are like users. If you set 30, it will always be 30. :-)
You are running 30 virtual users for 10 minutes. Each virtual user is executing samplers as fast as it can (the speed mostly depends on your application response time) this is why you have a lot of requests.
If you need to limit JMeter throughput to 60 requests per second only you can do it using Constant Throughput Timer:
Add Constant Throughput Timer to your Test Plan
Set "Target Troughput" to 60
Set "Calculate Troughput based on" to All active threads
This way JMeter will "pause" its threads (virtual users) to slow them down to 60 requests per minute.

Creating a new file with selected row data based on a variable column value

I am trying to print out rows in file1 that match data in column 4 of file2 as variable.
The data in file2 is as follows:
bb 350 300 350
cc 100 200 100
dd -100 200 -100
ee -300 200 -300
ff -500 200 -500
gg -700 200 -700
hh -900 400 -900
ii -1200 400 -1200
jj -1600 400 -1600
kk -2000 400 -2000
ll -2600 800 -2600
Assume data in file1 is as follows:
bb 350 300 350
cc 100 200 100
dd -100 200 -100
ee -300 200 -300
ff -500 200 -500
gg -700 200 -700
hh -900 400 -900
ii -1200 400 -1200
jj -1600 400 -1600
kk -2000 400 -2000
ll -2600 800 -2600
The code I am using is as follows:
while read line
do
set -- ${line}
idx="$4"
z="$2"
awk -F"\t" -v OFS="\t" '$4 == "$idx" { print $1,$2,$3,$4 }' file1
done < file2
The problem is I do not get any output, but when I do for example '$4 == "-2600", it seems to work. It seems it do not accept it as a variable. Kindly assist me to solve the problem.
Use awk like below
$ awk 'FNR==NR{a[$4];next}$4 in a' file2 file1
Input
$ cat file1
bb 350 300 350
cc 100 200 100
dd -100 200 -100
ee -300 200 -300
ff -500 200 -500
gg -700 200 -700
hh -900 400 -900
ii -1200 400 -1200
jj -1600 400 -1600
kk -2000 400 -2000
ll -2600 800 -2600
$ cat file2
bb 350 300 350
cc 100 200 100
dd -100 200 -100
ee -300 200 -300
ff -500 200 -500
gg -700 200 -700
hh -900 400 -900
ii -1200 400 -1200
jj -1600 400 -1600
kk -2000 400 -2000
ll -2600 800 -2600
Will Produce Output
awk 'FNR==NR{a[$4];next}$4 in a' file2 file1
bb 350 300 350
cc 100 200 100
dd -100 200 -100
ee -300 200 -300
ff -500 200 -500
gg -700 200 -700
hh -900 400 -900
ii -1200 400 -1200
jj -1600 400 -1600
kk -2000 400 -2000
ll -2600 800 -2600
Explanation
FNR==NR If the number of records read so far in the current file
is equal to the number of records read so far across all files,
condition which can only be true for the first file read.
a[$4] populate array "a" such that the
indexed by the 4th
field, from current record of file2
next Move on to the next record so we don't do any processing
intended for records from the second file ( file1).
$4 in a IF the array a index constructed from the
field 4 of the current record of file1 exists
in array a, we get boolean true, so awk does default operation print $0 from file1

Extract the text of string after a word in Bash

How can I extract the text after a word like Modeline.
I have a string,
mdline = 1600x900 59.95 Hz (CVT 1.44M9) hsync: 55.99 kHz; pclk: 118.25 MHz Modeline "1600x900_60.00" 118.25 1600 1696 1856 2112 900 903 908 934 -hsync +vsync
i.e a typical output of cvt command and I want to get the text after "Modeline".
other variations
$ awk -F'Modeline ' '{print $2}' file
or
$ sed 's/.*Modeline //' file
Using bash parameter-expansion,
string='mdline = 1600x900 59.95 Hz (CVT 1.44M9) hsync: 55.99 kHz; pclk: 118.25 MHz Modeline "1600x900_60.00" 118.25 1600 1696 1856 2112 900 903 908 934 -hsync +vsync'
printf "%s\n" "${string#*Modeline }"
"1600x900_60.00" 118.25 1600 1696 1856 2112 900 903 908 934 -hsync +vsync
With sed, using backreference:
$ sed 's/.*Modeline\(.*\)/\1/' <<< 'mdline = 1600x900 59.95 Hz (CVT 1.44M9) hsync: 55.99 kHz; pclk: 118.25 MHz Modeline "1600x900_60.00" 118.25 1600 1696 1856 2112 900 903 908 934 -hsync +vsync'
"1600x900_60.00" 118.25 1600 1696 1856 2112 900 903 908 934 -hsync +vsync

JMeter Stops sending requests

I have run jmeter script for 1500 users. It starts sending request but after some time it get stops with out showing any progress. Also test doesn't stop at end time.
Non-GUI mode console status is as follows:
summary + 280 in 112s = 2.5/s Avg: 45551 Min: 42988 Max: 84385 Err: 278 (99.29%) Active: 450 Started: 1500 Finished: 1050
summary = 14812 in 1439s = 10.3/s Avg: 77248 Min: 682 Max: 168072 Err: 12806 (86.46%)
summary + 239 in 114s = 2.1/s Avg: 47256 Min: 38723 Max: 88772 Err: 236 (98.74%) Active: 440 Started: 1500 Finished: 1060
summary = 15051 in 1469s = 10.2/s Avg: 76771 Min: 682 Max: 168072 Err: 13042 (86.65%)
summary + 264 in 115s = 2.3/s Avg: 48766 Min: 40408 Max: 87471 Err: 263 (99.62%) Active: 430 Started: 1500 Finished: 1070
summary = 15315 in 1499s = 10.2/s Avg: 76289 Min: 682 Max: 168072 Err: 13305 (86.88%)
summary + 111 in 111s = 1.0/s Avg: 55518 Min: 40488 Max: 98316 Err: 108 (97.30%) Active: 422 Started: 1500 Finished: 1078
summary = 15426 in 1530s = 10.1/s Avg: 76139 Min: 682 Max: 168072 Err: 13413 (86.95%)
summary + 163 in 129s = 1.3/s Avg: 72461 Min: 58026 Max: 111970 Err: 159 (97.55%) Active: 405 Started: 1500 Finished: 1095
summary = 15589 in 1559s = 10.0/s Avg: 76101 Min: 682 Max: 168072 Err: 13572 (87.06%)
summary + 113 in 141s = 0.8/s Avg: 78260 Min: 69917 Max: 118153 Err: 112 (99.12%) Active: 386 Started: 1500 Finished: 1114
summary = 15702 in 1590s = 9.9/s Avg: 76116 Min: 682 Max: 168072 Err: 13684 (87.15%)
summary + 104 in 159s = 0.7/s Avg: 93311 Min: 85408 Max: 146444 Err: 99 (95.19%) Active: 350 Started: 1500 Finished: 1150
summary = 15806 in 1620s = 9.8/s Avg: 76229 Min: 682 Max: 168072 Err: 13783 (87.20%)
summary + 151 in 173s = 0.9/s Avg: 91366 Min: 85043 Max: 159224 Err: 147 (97.35%) Active: 306 Started: 1500 Finished: 1194
summary = 15957 in 1650s = 9.7/s Avg: 76373 Min: 682 Max: 168072 Err: 13930 (87.30%)
summary + 178 in 186s = 1.0/s Avg: 84192 Min: 56634 Max: 165018 Err: 165 (92.70%) Active: 227 Started: 1500 Finished: 1273
summary = 16135 in 1679s = 9.6/s Avg: 76459 Min: 682 Max: 168072 Err: 14095 (87.36%)
summary + 208 in 89s = 2.3/s Avg: 44723 Min: 25609 Max: 63280 Err: 193 (92.79%) Active: 103 Started: 1500 Finished: 1397
summary = 16343 in 1709s = 9.6/s Avg: 76055 Min: 682 Max: 168072 Err: 14288 (87.43%)
Looking into summarizer results, you're getting around 90% failures. Unlikely that it is expected. So I would recommend the following:
Check jmeter.log file for any warnings or errors
Make sure that you have disabled all listeners
Run test with fewer number of threads until errors start to occur. Examine application logs to see what the problem is. As an option you can temporarily tell JMeter to store response data for failed samples by setting jmeter.save.saveservice.response_data.on_error=true property in user.properties or jmeter.properties file.
Make sure that you're following recommendations from JMeter Performance and Tuning Tips
Monitor server and load generator (JMeter) machine health. If load generator cannot create such a load you may have to consider switching to distributed testing.

how to Combine two tables column in oracle?

Table 1:
CURRENCY CODE ER GUARANTOR ID G AMOUNT
USD 1.2986 117 750
AED 4.76976 117 5750
ZAR 11.4717 117 234
INR 70.676 117 1243
AMD 526.5823 117 500000
EUR 1 117 12435
ALL 139.63197 117 2000000
EUR 1 173 200000
EUR 1 217 20000000
INR 70.676 26 100000
AED 4.76976 43 1000000
EUR 1 53 10000
Table 2:
F AMOUNT
USD 1.2986 117 450
AED 4.76976 117 7900
INR 70.676 117 2237.4
ZAR 11.4717 117 140.4
AMD 526.5823 117 500000
EUR 1 117 6961
ALL 139.63197 117 2000000
EUR 1 173 20000
EUR 1 217 14000000
INR 70.676 26 300000
AED 4.76976 43 2000000
EUR 1 53 10000
Result:
CURRENCY CODE ER GUARANTOR ID G AMOUNT F AMOUNT
USD 1.2986 117 750 450
AED 4.76976 117 5750 7900
ZAR 11.4717 117 234 2237.4
INR 70.676 117 1243 140.4
AMD 526.5823 117 500000 500000
EUR 1 117 12435
ALL 139.63197 117 2000000
EUR 1 173 200000
EUR 1 217 20000000
INR 70.676 26 100000
AED 4.76976 43 1000000
EUR 1 53 10000
I want to combine Both table like i need all the column in table 1 and F AMOUNT column from table 2. how to achieve this?
Thanks in Advance.
use the below query
select t1.CURRENCY CODE
, t1.ER
, t1.GUARANTOR
, t1.ID
, t2.FAMOUNT
from table1 t1
, table2 t2
where t1.CURRENCY CODE=t2.CURRENCY CODE

Resources