Recent Posts

Pages: 1 [2] 3 4 ... 10
11
Making / Heater control with arduino and remote control mains sockets
« Last post by nikki on November 15, 2013, 05:36:54 PM »
I live in a rented attic flat with 2 oil-filled radiator heaters and substantially less in the way of insulation.

Getting a balance between tolerable heat coolth and just pumping energy straight out of the roof is a tricky art, but this year I've decided to add some science...

The aim is to be a bit cleverer with thermostat control and hopefully also to add in a remote control so I can switch the heating on as I make my way back home after being elsewhere. There's going to be a lot of learning with this one, but isn't there always?!

So far I've rigged up some Maplin remote control sockets to an Arduino nano.

The sockets are conveniently on offer at the moment and someone has conveniently decoded the transmitter signals and provided some code for use with something like this. So far so convenient.

This has made it really very easy to rig up circuit and code that turns on a heater (manually set to max) for 10 minutes if a TMP35 sensor thinks the temperature has fallen below 9 degrees centigrade.

Code: [Select]
// See http://www.fanjita.org/serendipity/archives/53-Interfacing-with-radio-controlled-mains-sockets-part-2.html

/* Sensor test sketch
 for more information see http://www.ladyada.net/make/logshield/lighttemp.html
 */

unsigned long start=0;


#define aref_voltage 3.3 // we tie 3.3V to ARef and measure it with a multimeter!
//TMP36 Pin Variables
int tempPin = 1; //the analog pin the TMP36's Vout (sense) pin is connected to
//the resolution is 10 mV / degree centigrade with a
//500 mV offset to allow for negative temperatures
int tempReading; // the analog reading from the sensor
float temperatureC;

#define PAYLOAD_SIZE 48
#define GND_PIN A2
#define DATA_PIN A3
#define VCC_PIN A4

#define LED_PIN 13

#define PULSE_WIDTH_SMALL 500

// Button ID (payload1) values. There are 4 values for 4 channels, organised as
// ch1_btn1, ch1_btn2, ch1_btn3, ch1_btn4, ch2_btn1, etc.
long buttons[] = {
  859124533L,
  861090613L,
  892547893L,
  1395864373L,
  859124563L,
  861090643L,
  892547923L,
  1395864403L,
  859125043L,
  861091123L,
  892548403L,
  1395864883L,
  859132723L,
  861098803L,
  892556083L,
  1395872563L
};

void setup()
{
  // Plug the TX module into A3-A5, with the antenna pin hanging off the end of the header.
  pinMode(GND_PIN, OUTPUT);
  pinMode(DATA_PIN, OUTPUT);
  pinMode(VCC_PIN, OUTPUT);
  pinMode(LED_PIN, OUTPUT);
  Serial.begin(115200);

  // If you want to set the aref to something other than 5v
  analogReference(EXTERNAL);


  start = millis();

}

void sendData(long payload1, long payload2)
{
  // Turn on the radio. A3=GND, A5=Vcc, A4=data)
  digitalWrite(GND_PIN, LOW);
  digitalWrite(VCC_PIN, HIGH);
  digitalWrite(DATA_PIN, HIGH);
  digitalWrite(13, HIGH);
  // Send a preamble of 13 ms low pulse
  digitalWrite(DATA_PIN, LOW);
  for (int ii = 0; ii < 26; ii++)
  {
    delayMicroseconds(PULSE_WIDTH_SMALL);
  }
  digitalWrite(13, LOW);
  // send sync pulse : high for 0.5 ms
  digitalWrite(DATA_PIN, HIGH);
  delayMicroseconds(PULSE_WIDTH_SMALL);
  digitalWrite(DATA_PIN, LOW);
  // Now send the digits.
  // We send a 1 as a state change for 1.5ms, and a 0 as a state change for 0.5ms
  long mask = 1;
  char state = HIGH;
  long payload = payload1;
  for (int jj = 0; jj < PAYLOAD_SIZE; jj++)
  {
    if (jj == 32)
    {
      payload = payload2;
      mask = 1;
    }
    char bit = (payload & mask) ? 1 : 0;
    mask <<= 1;
    state = !state;
    digitalWrite(DATA_PIN, state);
    delayMicroseconds(PULSE_WIDTH_SMALL);
    if (bit)
    {
      delayMicroseconds(PULSE_WIDTH_SMALL);
      delayMicroseconds(PULSE_WIDTH_SMALL);
    }
  }
}

void simulate_button(int channel, int button, int on)
{
  long payload1 = buttons[(channel - 1) * 4 + (button - 1)];
  long payload2 = on? 13107L : 21299L;
  //  Serial.println(payload1);
  //  Serial.println(payload2);

  // Send the data 6 times
  for (int ii = 0; ii < 6; ii++)
  {
    sendData(payload1, payload2);
  }
  // turn off the radio
  digitalWrite(VCC_PIN, LOW);
}

void loop()
{

  Serial.print(millis());
  Serial.print(",");
  Serial.print(millis() - start);
  Serial.print(",");
  getTemp();

  Serial.print(temperatureC);
  Serial.print(",");

  if    (millis() - start > 600000) {

    if (temperatureC < 9){
      simulate_button(1, 3, 1);
      Serial.print("ON");
      Serial.print(",");
      delay(600000);
    }

    else {
      simulate_button(1, 3, 0);
      Serial.print("OFF");
      Serial.print(",");
    }
    start = millis();
  }
  else {
    Serial.print("MONITORING");

  }
  delay(120000);
  Serial.println("");

}//end loop

float getTemp(){

  tempReading = analogRead(tempPin);
  // converting that reading to voltage, which is based off the reference voltage
  float voltage = tempReading * aref_voltage;
  voltage /= 1024.0;
  temperatureC = (voltage - 0.5) * 100 ; //converting from 10 mv per degree with 500 mV offset
  return temperatureC ;

}



This is giving me a csv of some timing information, recorded temperature and whether the system is turning the heater on, off, or just giving an intermediate temperature reading.

Quote
millis, millis since last switch action, temp, action
121000,121000,12.52,MONITORING
242001,242002,12.84,MONITORING
363003,363003,13.49,MONITORING
484004,484005,12.52,MONITORING
605006,605006,12.52,OFF,
726380,120000,12.52,MONITORING
847382,241001,13.49,MONITORING
968384,362003,13.49,MONITORING
1089385,483004,13.49,MONITORING
1210387,604006,13.81,OFF,
1331761,120001,12.84,MONITORING
1452763,241002,13.16,MONITORING
1573765,362004,12.52,MONITORING
1694766,483006,12.20,MONITORING
1815768,604007,12.52,OFF,
1937141,120000,11.55,MONITORING
2058143,241001,11.87,MONITORING
2179145,362003,11.87,MONITORING
2300146,483005,11.55,MONITORING
2421148,604006,11.55,OFF,



I've no idea how accurate the temperature reading is, but it's been interesting watching the gradual decrease throughout the day.

Next steps are to set different target temperatures for different times of day (I think my options are to either either get a Real Time Clock breakout board, use one of the GPS units I have lying around, or add an ethernet shield), and to add in some remote remote control using my phone, either with an ethernet shield or one of the cellular shields I've acquired and have been wanting to learn how to use...

Has anyone got any links/experience they can point me towards that might be useful?
12
I made a thing! / Re: Scissor lift
« Last post by nikki on November 15, 2013, 05:06:11 PM »
You stuck it on with that masking tape?! That isn't going to stay up for long!  ;)


Saw bits of the build via Twitter - great to read about it in more detail and see the final/first application.
13
I made a thing! / Re: Making a turntable and other work at WLLR
« Last post by nikki on November 15, 2013, 05:00:18 PM »
That's a serious amount of push!
I don't like to think what would happen if one of the wheels did fail... :-/
14
I made a thing! / Re: Making a turntable and other work at WLLR
« Last post by Maker of Things on November 15, 2013, 01:45:27 AM »
The next stage was to load test the wheels to make sure they were strong enough.

Now I'm not convinced by the calculations.  I was told that one of the locos has an axle loading of 4 tons, on three axles, that makes 12 tons.  The turntable must weigh around 2 tons when it is finished.  That's 14 tons.

There are four turntable wheels.  I was instructed to test them to 2-3 tons as that would give a nice margin for safety.  At 3 tons that would give a tested load of 12 tons for the four wheels, evenly distributed. ???

I tested the wheels to 4-5 tons and they stood up to the test fine.  I didn't get a chance to challenge the maths as the chap instructing me left early.  Also I didn't want to test load any higher in case I broke all the wheels.  There may be stronger options, or more wheels, if needed.

Anyway, the test procedure is to place the wheel on a loose fit axle and, with a bit of steel in between the flanges, apply a load with the press to the wheel rim and through the axle.  The test needs to be repeated loading the rim at each wheel spoke and between each spoke so the whole of the rim has been loaded.

All the wheels survived.

I am tempted to suggest re testing the wheels again after I have descaled and cleaned the wheels next week, just to make sure and then question the test load and safety margin allowed for at that point.  I would be happier if the wheels were tested to around 7 tons, but that isn't my call.
15
I made a thing! / Re: Making a turntable and other work at WLLR
« Last post by Maker of Things on November 15, 2013, 01:32:12 AM »
So for lack of 'stuff' to weld or grind I looked at preparing the wheels for the turntable.

The wheels are old double flange rail wagon wheels.  My first job was to press out the worn and corroded axles from them.  We thought about using a bit of heat but decided to just press them to see if they would move.  They were each placed on the press and a bit of round bar used to press out the axle. 

Three of the axles took 8-9 tons before they 'popped'.  The final axle took 15 tons.  Lucky the press is good for 50 tons!  ;D

16
I made a thing! / Re: Making a turntable and other work at WLLR
« Last post by Maker of Things on November 15, 2013, 01:25:43 AM »
The door post for the engine shed went up today.  I had finished welding the hinge plates onto it last week.

I have a photo of one of the welds but forgot to get a photo of the post being put up, anyway, it was dark.
17
I made a thing! / Re: Scissor lift
« Last post by Maker of Things on November 15, 2013, 01:21:51 AM »
This is the reason for making the scissor lift.

The cabinet is an antique, heavy and awkward.  The walls are aircrete block and very soft.  The height was to be approved by the client.

The scissor lift make it so easy in the end and I was able to work without any stress or worry about the cabinet being at the wrong height, not level, or at risk of being dropped.

I am very happy with the result, as was the client. :)
18
I made a thing! / Re: Reclaimed Wood Doors
« Last post by Maker of Things on November 15, 2013, 01:17:37 AM »
These are the last two doors side by side and 2160mm tall.
19
I made a thing! / Re: Reclaimed Wood Doors
« Last post by Maker of Things on November 13, 2013, 05:56:32 PM »
The final door has now been mostly completed.  I will still need to trim it near to size prior to final fitting on site but it is stable, flat and square.

Can't wait to get it fitted, not because it is an enjoyable part of the job, but because these last two doors are taking up a lot of space in my workshop.  Also I will get paid for the job then!  ;)

I have another couple of large jobs to do, a tall garden gate and a book shelf unit so need the bench space back.


20
I made a thing! / Re: Scissor lift
« Last post by Maker of Things on November 13, 2013, 05:44:07 PM »
Today I did a bit more welding and braced the metalwork at both ends of the screw. I also welded an old 3/8" drive socket to the drive end of the screw so that a ratchet or drill/driver can be used to power it.

A couple of old cupboard doors and shelves from an old 70's sideboard were used to make the base and the table top.  These were glued and screwed in place.  A set of castors were then screwed to the base.

A test weight by way of 30kg of Jet 12" bench top thicknesser was placed on it and it successfully wound it up.

Using the drill at high speed makes it all wobble quite a lot due to the still not quite straight jack screw.


One annoying problem is that from flat to about halfway up the table top is free to lean side to side.  Above halfway up and the whole thing becomes much more rigid.
I suspect that it is the thinness of the scissor arms allowing them to flex.  Also it could be that there is very little torsional rigidity between the lift arms on each side so they are free to rise at different rates.

It will do for the job I built it for but I may start sourcing scrap materials to make a more rigid version.
Pages: 1 [2] 3 4 ... 10