Turn on and circulate a Lasko 5538 Ceramic Heater with Arduino

Download the sketch or copy and paste the below code into the Arduino IDE.

// This program allows an Arduino Uno to power on and circulate a Lasko 5538 Ceramic Heater.
//
// Usage: Attach an IR led (TSAL7400), but i believe any 940nm 5MM irled will work.
// Arduino Uno pin 13 -> resistor -> annode of ir led. Ir led cathode to ground.
// Calculate correct resistor value by using this formula. VCC – Vf / If = resistor value
//
// Credits: Rick Osgood, Adafruit
// Modified by Arduino Enthusiast
//
// Modify these lines to to fit your needs: 18, 68, 152, 159, 160
// For lines 17 and 67 you’ll input the raw codes that you want to run.

#define IRledPin 13
#define NumIRsignals 96
#define NumIRsignalsx 120

int IRsignal[] = {
130, 34,
130, 36,
46, 122,
130, 36,
130, 36,
46, 122,
46, 124,
46, 122,
44, 126,
46, 122,
48, 122,
130, 688,
128, 36,
130, 34,
48, 122,
130, 34,
128, 40,
44, 124,
46, 122,
48, 122,
46, 122,
48, 122,
46, 122,
132, 684,
130, 36,
128, 36,
48, 120,
130, 36,
130, 36,
46, 124,
46, 122,
46, 124,
46, 122,
46, 122,
48, 122,
130, 688,
130, 34,
130, 36,
46, 122,
130, 36,
130, 36,
46, 122,
46, 124,
46, 122,
48, 122,
46, 122,
48, 122,
130, 0};

int IRsignal2[] = {
130, 36,
130, 34,
48, 120,
130, 36,
130, 36,
46, 124,
46, 122,
46, 122,
130, 36,
48, 122,
46, 124,
46, 774,
130, 34,
132, 34,
46, 122,
130, 36,
130, 36,
46, 122,
48, 122,
46, 122,
130, 38,
46, 122,
46, 122,
48, 772,
130, 34,
132, 34,
46, 122,
130, 36,
130, 36,
46, 122,
48, 122,
46, 122,
130, 36,
48, 122,
46, 122,
48, 774,
130, 36,
128, 36,
46, 122,
130, 36,
130, 36,
46, 122,
46, 124,
46, 122,
130, 36,
48, 122,
46, 122,
46, 774,
130, 34,
130, 36,
46, 122,
130, 36,
128, 36,
48, 122,
46, 124,
46, 122,
130, 36,
46, 122,
48, 122,
46, 0};

void setup(void) {
pinMode(IRledPin, OUTPUT);
digitalWrite(IRledPin, LOW); //Make sure LED starts “off”
Serial.begin(9600); //Initialize Serial port
}

void loop() {
// buttonState = digitalRead(buttonPin);
// pinMode(buttonPin, INPUT);
char data[6];
int index = 0;

delay(1000); //Serial input seems to need some kind of short delay or the data gets screwed up.

while (Serial.available() > 0) { //Loop if there data on the serial line
if (index < 5) { //Make sure we don’t overflow
data[index] = Serial.read(); //Load a character into the string
index++; //Increment the index to get the next character
}
}

data[5]=’\0′; //Null terminate the string

delay (10000); // 10 second delay before turning on heater

// if (buttonState == HIGH) {
for (int i = 0; i < NumIRsignals; i+=2) { //Loop through all of the IR timings
pulseIR(IRsignal[i]*10); //Flash IR LED at 38khz for the right amount of time
delayMicroseconds(IRsignal[i+1]*10); //Then turn it off for the right amount of time
}
delay(5000); // Wait 5 seconds before running next code. Next code will run the raw code for circulate.
// delay(20*60000); // Wait 20 minutes until the next code will run. Keeps the heater on for 20 minutes

for (int i = 0; i < NumIRsignalsx; i+=2) { //Loop through all of the IR timings
pulseIR(IRsignal2[i]*10); //Flash IR LED at 38khz for the right amount of time
delayMicroseconds(IRsignal2[i+1]*10); //Then turn it off for the right amount of time
}
delay(40*60000); // Wait 40 minutes before looping.

data[5]=’\0′; //Clear the data
// } //Otherwise do nothing!
}

// This function allows us to PWM the IR LED at about 38khz for the sensor
// Borrowed from Adafruit!
void pulseIR(long microsecs) {
// we’ll count down from the number of microseconds we are told to wait

cli(); // this turns off any background interrupts

while (microsecs > 0) {
// 38 kHz is about 13 microseconds high and 13 microseconds low
digitalWrite(IRledPin, HIGH); // this takes about 3 microseconds to happen
delayMicroseconds(10); // hang out for 10 microseconds, you can also change this to 9 if its not working
digitalWrite(IRledPin, LOW); // this also takes about 3 microseconds
delayMicroseconds(10); // hang out for 10 microseconds, you can also change this to 9 if its not working

// so 26 microseconds altogether
microsecs -= 26;
}

sei(); // this turns them back on
}

Infrared decode sketch for Arduino

Download IRdecoder sketch or copy the below text and paste into Arduino IDE
Also here’s the documentation and pin layout for the tsop4838 , which was used for this project.

TSOP4838 PIN 1 – Goes to Arduino PIN 2
TSOP4838 PIN 2 – Goes to Arduino GND
TSOP4838 PIN 3 – Goes to Arduino Vcc (2.5 to 5.5 volts)

 

/* Raw IR decoder sketch!
This sketch/program uses the Arduno and a TSOP 4838 to
decode IR received. This can be used to make a IR receiver
(by looking for a particular code)
or transmitter (by pulsing an IR LED at ~38KHz for the
durations detected
Code is public domain, check out www.ladyada.net and adafruit.com
for more tutorials!
*/

// We need to use the ‘raw’ pin reading methods
// because timing is very important here and the digitalRead()
// procedure is slower!
//uint8_t IRpin = 2;
// Digital pin #2 is the same as Pin D2 see
// http://arduino.cc/en/Hacking/PinMapping168 for the ‘raw’ pin mapping
#define IRpin_PIN PIND
#define IRpin 2
// for MEGA use tese!
//#define IRpin_PIN PINE
//#define IRpin 4

// the maximum pulse we’ll listen for – 65 milliseconds is a long time
#define MAXPULSE 65000

// what our timing resolution should be, larger is better
// as its more ‘precise’ – but too large and you wont get
// accurate timing
#define RESOLUTION 20

// we will store up to 100 pulse pairs (this is -a lot-)
uint16_t pulses[100][2]; // pair is high and low pulse
uint8_t currentpulse = 0; // index for pulses we’re storing

void setup(void) {
Serial.begin(9600);
Serial.println(“Ready to decode IR!”);
}

void loop(void) {
uint16_t highpulse, lowpulse; // temporary storage timing
highpulse = lowpulse = 0; // start out with no pulse length

// while (digitalRead(IRpin)) { // this is too slow!
while (IRpin_PIN & (1 << IRpin)) {
// pin is still HIGH

// count off another few microseconds
highpulse++;
delayMicroseconds(RESOLUTION);

// If the pulse is too long, we ‘timed out’ – either nothing
// was received or the code is finished, so print what
// we’ve grabbed so far, and then reset
if ((highpulse >= MAXPULSE) && (currentpulse != 0)) {
printpulses();
currentpulse=0;
return;
}
}
// we didn’t time out so lets stash the reading
pulses[currentpulse][0] = highpulse;

// same as above
while (! (IRpin_PIN & _BV(IRpin))) {
// pin is still LOW
lowpulse++;
delayMicroseconds(RESOLUTION);
if ((lowpulse >= MAXPULSE) && (currentpulse != 0)) {
printpulses();
currentpulse=0;
return;
}
}
pulses[currentpulse][1] = lowpulse;

// we read one high-low pulse successfully, continue!
currentpulse++;
}

void printpulses(void) {
Serial.println(“\n\r\n\rReceived: \n\rOFF \tON”);
for (uint8_t i = 0; i < currentpulse; i++) {
Serial.print(pulses[i][0] * RESOLUTION, DEC);
Serial.print(” usec, “);
Serial.print(pulses[i][1] * RESOLUTION, DEC);
Serial.println(” usec”);
}

// print it in a ‘array’ format
Serial.println(“int IRsignal[] = {“);
Serial.println(“// ON, OFF (in 10’s of microseconds)”);
for (uint8_t i = 0; i < currentpulse-1; i++) {
Serial.print(“\t”); // tab
Serial.print(pulses[i][1] * RESOLUTION / 10, DEC);
Serial.print(“, “);
Serial.print(pulses[i+1][0] * RESOLUTION / 10, DEC);
Serial.println(“,”);
}
Serial.print(“\t”); // tab
Serial.print(pulses[currentpulse-1][1] * RESOLUTION / 10, DEC);
Serial.print(“, 0};”);
}

Raw Codes for the Lasko 5538 Ceramic Heater

These are the raw codes used for the Lasko 5538 Ceramic Heater. Use these codes for the play arduino infrared sketch.

On Off
130, 34, 130, 34, 130, 36, 46, 122, 130, 36, 130, 36, 46, 122, 46, 124, 46, 122, 44, 126, 46, 122, 48, 122, 130, 688, 128, 36, 130, 34, 48, 122, 130, 34, 128, 40, 44, 124, 46, 122, 48, 122, 46, 122, 48, 122, 46, 122, 132, 684, 130, 36, 128, 36, 48, 120, 130, 36, 130, 36, 46, 124, 46, 122, 46, 124, 46, 122, 46, 122, 48, 122, 130, 688, 130, 34, 130, 36, 46, 122, 130, 36, 130, 36, 46, 122, 46, 124, 46, 122, 48, 122, 46, 122, 48, 122, 130, 0};

Eco Mode
130, 36, 130, 36, 130, 36, 130, 36, 46, 122, 48, 122, 46, 122, 48, 122, 130, 36, 130, 692, 130, 34, 130, 36, 46, 122, 130, 36, 130, 34, 132, 34, 48, 122, 44, 126, 46, 122, 48, 122, 130, 36, 130, 690, 130, 36, 130, 34, 44, 124, 130, 36, 130, 36, 130, 36, 46, 124, 46, 122, 48, 122, 46, 122, 130, 36, 130, 692, 130, 36, 130, 34, 46, 122, 130, 36, 130, 36, 130, 36, 46, 122, 48, 122, 46, 124, 46, 122, 130, 36, 130, 0};

Hi Low
130, 36, 130, 36, 130, 34, 46, 122, 130, 36, 130, 36, 46, 124, 46, 122, 48, 122, 46, 122, 132, 34, 48, 122, 44, 778, 130, 36, 128, 36, 48, 120, 130, 36, 130, 36, 48, 122, 46, 122, 48, 122, 46, 122, 132, 34, 48, 122, 46, 774, 130, 34, 130, 36, 46, 122, 130, 36, 130, 36, 46, 122, 48, 122, 46, 124, 46, 122, 130, 36, 46, 124, 46, 774, 132, 34, 130, 36, 46, 122, 130, 36, 130, 36, 46, 122, 48, 122, 46, 124, 46, 122, 130, 36, 48, 122, 46, 772, 132, 34, 130, 36, 46, 122, 130, 36, 130, 36, 46, 122, 46, 124, 46, 122, 48, 122, 130, 36, 46, 124, 46, 774, 132, 34, 130, 36, 46, 122, 130, 36, 130, 36, 46, 122, 48, 122, 46, 122, 48, 122, 130, 36, 46, 122, 48, 0};

Minus Button
130, 36, 130, 36, 130, 34, 48, 122, 128, 36, 130, 36, 48, 122, 128, 38, 46, 122, 48, 122, 46, 122, 48, 122, 46, 774, 130, 36, 130, 34, 48, 120, 130, 36, 130, 36, 46, 122, 130, 36, 48, 122, 46, 122, 48, 122, 46, 122, 48, 772, 130, 34, 128, 38, 46, 122, 130, 34, 132, 36, 46, 122, 128, 38, 46, 122, 48, 122, 46, 124, 46, 122, 48, 0};

Plus Button
130, 36, 130, 36, 128, 36, 46, 122, 130, 36, 130, 36, 46, 122, 46, 124, 130, 36, 46, 122, 48, 122, 46, 122, 46, 776, 130, 34, 130, 36, 46, 122, 130, 36, 128, 36, 48, 122, 46, 122, 132, 34, 48, 122, 44, 124, 48, 122, 46, 774, 128, 36, 130, 36, 46, 122, 130, 34, 130, 36, 48, 122, 44, 124, 130, 36, 48, 122, 46, 122, 48, 122, 46, 0};

Timer
130, 36, 130, 36, 130, 34, 48, 122, 128, 36, 130, 36, 46, 124, 46, 122, 48, 122, 46, 122, 48, 122, 130, 36, 46, 774, 130, 36, 130, 34, 48, 122, 130, 34, 132, 34, 48, 122, 46, 122, 48, 122, 46, 124, 46, 122, 130, 36, 46, 774, 130, 34, 130, 36, 46, 122, 130, 34, 130, 36, 48, 122, 46, 124, 46, 122, 48, 122, 46, 122, 130, 36, 48, 774, 130, 34, 130, 36, 46, 122, 130, 36, 130, 36, 46, 122, 48, 122, 46, 122, 46, 124, 46, 122, 130, 36, 48, 770, 132, 34, 130, 36, 46, 122, 130, 36, 130, 34, 48, 122, 46, 124, 46, 122, 48, 122, 46, 122, 130, 38, 44, 0};

Connecting a G1100 router as primary to a Actiontec MI424-WR router as a bridge

Why

Wireless devices located too far from the primary router. Results in low signal strength and ultimately slower connection speed.

Primary router: G1100 router
Secondary router: Actiontec MI424-WR

 

Solution

The secondary router, MI424, will be converted to a coax bridge.

Following these instructions will connect your secondary router (Actiontec MI424-WR) to the primary router (G1100) through coax.

How to configure Plivo and a shared webhost

These are instructions on how to configure plivo on a shared webhost

Requirements:
1. Plivo account with a phone number
2. Shared webhost with SSH access

On your shared webhost:

  1. Log onto your remote webserver (mines is a shared webhost) via SSH. I used the software called Putty to SSH into my shared webhost.
  2.  Go to your root of your domain. Commands I used were CD
  3.  Now type ‘composer require plivo/plivo-php’

Copy the sample code from plivo. In this example we are going to edit the ‘Forward an Incoming SMS’. I copied the php code for this example.

<?php
    require 'vendor/autoload.php';
    use Plivo\Response;
    // Sender's phone numer
    $from_number = $_REQUEST["From"];
    // Receiver's phone number - Plivo number
    $to_number = $_REQUEST["To"];
    // The SMS text message which was received
    $text = $_REQUEST["Text"];
    // Output the text which was received, you could also store the text in a database.
    // echo("Message received - From $from_number, To: $to_number, Text: $text");
    // The phone number to which the SMS has to be forwarded
    $to_forward = '3333333333';
    $params = array(
        'src' => $to_number,
        'dst' => $to_forward
    );
    $body = $text;
    // Generate a Message XML with the details of
    // the reply to be sent.
    $r = new Response();
    $r->addMessage($body, $params);
    Header('Content-type: text/xml');
    echo($r->toXML());
?>

In the above code, you’ll edit line 13 to the number you want the SMS message to be sent to.

Save it with the extension php. eg. forwardsms.php

Next, we want to forward incoming voice calls to another phone number.  Copy the sample code from plivo ‘Forward an Incoming Call’. Again, I copied the php code for this example

<?php
    require 'vendor/autoload.php';
    use Plivo\Response;
    // Fetch the from_number from the URL
    $from_number = $_REQUEST['From'];
    $r = new Response();
    // Add Dial tag
    $params = array(
        'callerId' => $from_number # Caller ID
    );
    $d = $r->addDial($params);
    $number = "2222222222";
    $d->addNumber($number);
    Header('Content-type: text/xml');
    echo($r->toXML());
?>

In the above you’ll edit line 12 so that voice calls will be transferred to the number you entered.

Save it with the extension php. eg. forwardcalls.php

Now, upload the two files you created, in this example (forwardsms.php and forwardcalls.php) to your shared webhost.

Now configure plivo to read these two files.

Log onto your plivo account.

Click on ‘Applications’

Click ‘New Applications’

In ‘Application Name’ box, give your application a name. eg. hotlinebling

In ‘Message URL’ box put ‘http://yourdomain.com/forwardsms.php’ Obviously, yourdomain.com should be whatever your domain name is.

In ‘Answer URL’ box put ‘http://yourdomain.com/forwardcalls.php’

In ‘Hangup URL’ box put ‘http://yourdomain.com/forwardcalls.php’

Click ‘Create’ button

 

Next, configure the number to use this application.

Click on ‘Numbers’. Located at the top navigation in plivo

Select the phone that you want to use

In ‘Plivo App’ box, click on the down arrow and select the application that you created. In this example, hotlinebling will be listed.

In ‘Alias’ box, give it another name. Can be anything.

Click on ‘Update’ button

 

Newell Specs

Got to bottom to see pdf for specs

Newell 220-5
Newell 229-5
Newell 235-5
Newell 322-5
Newell 338-5
Newell 344-5
Newell 440-5
Newell 447-5
Newell 454-5
Newell 220-3.6
Newell 229-3.6
Newell 235-3.6
Newell 332-3.6
Newell 338-3.6
Newell 344-3.6
Newell 440-3.6
Newell 447-3.6
Newell 454-3.6
Newell 540-3.2
Newell 549-3.2
Newell 550-3.2
Newell 533-4.6
Newell 540-4.6
Newell 546-4.6
Newell 550-4.6
Newell 535-5.5
Newell 540-5.5
Newell 621-3
Newell 636-3
Newell 641-3
Newell 646-3
Newell 631-4.2
Newell 636-4.2
Newell 641-4.2
Newell 646-4.2

NEWELLL SPECS

Raspberry pi + Tightvncserver


#! /bin/sh
# /etc/init.d/vncboot

### BEGIN INIT INFO
# Provides: vncboot
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start VNC Server at boot time
# Description: Start VNC Server at boot time.
### END INIT INFO

USER=pi
HOME=/home/pi

export USER HOME

case "$1" in
 start)
  echo "Starting VNC Server"
  #Insert your favoured settings for a VNC session
  su - $USER -c "/usr/bin/vncserver :1 -geometry 1280x800 -depth 16 -pixelformat rgb565"
  ;;

 stop)
  echo "Stopping VNC Server"
  /usr/bin/vncserver -kill :1
  ;;

 *)
  echo "Usage: /etc/init.d/vncboot {start|stop}"
  exit 1
  ;;
esac

exit 0