bld-live.dk saving the environment, I think…

4Sep/100

Arduino outdoor motion sensor

In this little tutorial, I am going to try to explain how I made a cheap outdoors PIR motion sensor that will work with your Arduino.

It is all based on this little 230V guy.

To open it I only had to use my cable cutter and I was then able to pull it apart. Most different thing here was to get the funnel around the sensor out, I had to use a screwdriver and gently pull it out along with the two prints.

Inside I located the relay that is used to switch the lamp on and off. (The blue brick)

On the backside of that, I had a look at how the traces were, and immediately noticed that it would be extremely easy to modify this.

All I had to do was to solder a extra cable in ( the black comming up through the hole), and connect it to one side of the relay.

Then remove the trace that would feed the 230V into the relay and out through the green wire on the opposite side.

The wires for this will then be

  • Blue > N
  • Red > L
  • Green & Black > Relay switch

All that is left is to put it all together again, and there you have it, a new and cheap outdoors PIR sensor.

Filed under: Arduino No Comments
3Sep/100

Finally!

After years of waiting, it is finally here!

It all started out with a pole in my driveway, and a letter that once again told me that they were coming to dig it down...

... they had already done that once, but that was over a year ago and nothing ever happend...

... this time however, they did come and put the tube in the ground, and blew a innocent looking green wire through...

... even the technician came at the exact time that was agreed upon earlier over phone with their support...

... the lights are now on, and everything is ready... almost...

But this time, it is a problem I can do something about. I should have 50/50 MBit, but 45/42 is the highest I can get through, but I noticed something... My router, a Buffalo WHR-HP-G54-DD running DD-WRT, is running at 100% load when I really use my connection.

My solution to that, is to copy Azuria (the other ugly face here), and set up a VIA EDEN with pfSense on.

Filed under: Other No Comments
2Sep/100

Back then…

Nothing to say, just listen and enjoy the simple and still beautiful music video...

This video was embedded using the YouTuber plugin by Roy Tanck. Adobe Flash Player is required to view the video.

... can't wait for history to repeat itself so music like this again will dominate.

Filed under: Uncategorized No Comments
31Aug/100

Timing with millis()

I found this on the Arduino forum, and though it was a great solusion for a very common problem.

With this it both checks the stored millis() and sets it if needed, and then keeps that stuff away from the loop itself.

#define ledPin1 11
#define ledPin2 12

#define led1Cycle 100U
#define led2Cycle 275U

unsigned long led1LastMillis = 0;
unsigned long led2LastMillis = 0;

boolean led1State = false;
boolean led2State = false;

boolean cycleCheck(unsigned long *lastMillis, unsigned int cycle)
{
  unsigned long currentMillis = millis();
  if(currentMillis - *lastMillis >= cycle)
  {
    *lastMillis = currentMillis;
    return true;
  }
  else
    return false;
}

void setup()
{
  pinMode(ledPin1, OUTPUT);
  pinMode(ledPin2, OUTPUT);
}

void loop()
{
  if(cycleCheck(&led1LastMillis, led1Cycle))
  {
    digitalWrite(ledPin1, led1State);
    led1State = !led1State;
  }
  if(cycleCheck(&led2LastMillis, led2Cycle))
  {
    digitalWrite(ledPin2, led2State);
    led2State = !led2State;
  }
}
Filed under: Arduino No Comments
28Aug/100

433MHz RF Communication

For this project I used two Arduino Duemilanove, a 433MHz RF kit, and six short wires to connect it together.

To send a message, I used this code

#include <VirtualWire.h>
#undef int
#undef abs
#undef double
#undef float
#undef round
void setup()
{
  // Initialise the IO and ISR
  vw_set_ptt_inverted(true);               // Required for RF Link module
  vw_setup(2000);                          // Bits per sec
  vw_set_tx_pin(3);                        // pin 3 is used as the transmit data out into the TX Link module, change this to suit your needs.
}

void loop()
{
  const char *msg = "RF is up";             // this is your message to send

  vw_send((uint8_t *)msg, strlen(msg));
  vw_wait_tx();                          // Wait for message to finish
  delay(200);
}

The sender is connected to digital pin 3, VIN (12V for better range), and GND.

To receive I used this code

#include <VirtualWire.h>
#undef int
#undef abs
#undef double
#undef float
#undef round

#define rxPin 2

void setup()
{
  Serial.begin(9600);

  // Initialise the IO and ISR
  vw_set_ptt_inverted(true);          // Required for RX Link Module
  vw_setup(2000);                     // Bits per sec
  vw_set_rx_pin(rxPin);               // We will be receiving on pin 2 ie the RX pin from the module connects to this pin.
  vw_rx_start();                      // Start the receiver
}

void loop()
{
  uint8_t buf[VW_MAX_MESSAGE_LEN];
  uint8_t buflen = VW_MAX_MESSAGE_LEN;

  if (vw_get_message(buf, &buflen))   // check to see if anything has been received
  {
    int i;
                                      // Message with a good checksum received.

    for (i = 0; i < buflen; i++)
    {
      Serial.print(buf[i]);          // the received data is stored in buffer
    }
    Serial.println("");
  }
}

The reciever is connected to the digital pin 2, +5V and GND

You will also need VirtualWire 1.3, download it here and unzip it to your library folder.
Download: VirtualWire 1.3

Filed under: Arduino No Comments
28Aug/100

Serial LCD and Electronic Brick Chassis V1.1

First time I was trying to get my Serial LCD running, I had some problems uploading to the arduino while it was plugged into the Chassis shield.

The display was connected to the UART port and was working as it should, but the software kept giving errors when I tried to upload.

After a little research with my multimeter, I found out which pins went to where, and simply removed the wire that went to the arduino's TX pin. (the left wire on the connector)

I can now upload new sketches with the display connected and use serial monitor at the same time without any problems.

The serial adabter I am using is from flamingoeda.com, and got these functions:

  • - "GO" is cursor movement.
  • - "PRINT" is to display the serial characters on the cursor position.
  • - "CLEAR" is to clear screen .
  • - "HOME" is to move the cursor to the initial position of the top left corner of the screen.
  • - "CURSOR" is to set the effect of cursor, the first parameter is whether display cursor (1 and 0), the second parameter is whether blink cursor (1 and 0).
Filed under: Arduino Continue reading
28Aug/100

Button brick example

I just recieved this brick from seeedstudio.com

And here is how you easily can get started using it...

Filed under: Arduino Continue reading
20Aug/100

Geeeeek

Filed under: Silly No Comments
19Aug/100

Tech Support Cheat Sheet

Filed under: Silly No Comments
15Aug/100

Thermister to Celcius

Played a bit around with my arduino and a temperature brick from Seeed Studio, and had to convert the reading on the analog pin to degrees in Celsius.

After a bit searching searching around, I found this, and it seems to do the job just fine.

double Thermister(int RawADC)
{
  double Temp;
  Temp = log(((10240000/RawADC) - 10000));
  Temp = 1 / (0.001129148 + (0.000234125 * Temp) + (0.0000000876741 * Temp * Temp * Temp));
  Temp = Temp - 273.15;            // Convert Kelvin to Celcius
  return Temp;
}

All I then had to do, was to call it like this

Thermister(analogRead(5))

And I got the result back I wanted.

To test if it really worked, I tried to make a little sketch to just run through all the numbers.

double Thermister(int RawADC)
{
  double Temp;
  Temp = log(((10240000/RawADC) - 10000));
  Temp = 1 / (0.001129148 + (0.000234125 * Temp) + (0.0000000876741 * Temp * Temp * Temp));
  Temp = Temp - 273.15;            // Convert Kelvin to Celcius
  return Temp;
}

void setup()
{
  Serial.begin(9600);

  for(int i = 0; i < 1024; i++)
  {
    Serial.print(Thermister(i)); Serial.print("c"); Serial.print(" = "); Serial.println(i);
  }
}

void loop()
{
}

Output:

Filed under: Arduino Continue reading