Friday, July 31, 2015

USB Rechargeable Mega Bright 3w Flashlight

Want a DIY painfully bright rechargeable flashlight? Look no more, as here is one bad darkness kicker! I took a Nokia cellphone battery,combined it with a USB LiPo charger, a switch, and a few resistors, with a massive 700ma, 3.3v White LED.

3W LED
USB LiPo Charger
BL-5C Nokia Battery
(4) 1.5 Ohm 1/2w Resistors
Optional 10w Resistor (would handle up to 5 LED's)
Proto Board

The ever handy LED Calculator suggested a 2w Resistor, so I put (4) 1/2w resistors in parallel. If you need more light, you can add another LED, with another 2w of resistors. Just parallel the first set. You could even have a high / low switch, that only brings the second set on in the high position.






Thursday, July 30, 2015

433 MHz Wireless Arduino

Today I took a $3 433 MHz transmitter / receiver pair, and sent a string of characters 20' from one Arduino to another. This could be useful for weather sensors, security alarms or remote control, etc.

There are only 3 wires to connect on each unit, 5v, Gnd, and Data (spelled ATAD on the smaller board, which is the transmitter).  Add a 13cm wire to transmitter ANT connection for greater range.

You will need two Arduino boards, 6 jumpers, and 2 solderless breadboards for this project.

A 4 AA battery pack or a 9v for the transmitter Arduino will make it wireless, the receiver will be plugged into your computer. Alternatively, the Transmitter could be plugged into another computer or a USB charger for power. We are using our LiPo battery shield.

Download and install the Virtual Wire (VirtualWire.zip) library (we have slightly customized the sketches found at this site, so try ours found below first, they are much more satisfactory).

Connect the smaller transmitter board to one Arduino, using +5v, Gnd, and "ATAD" to Arduino pin 11.
Connect the larger receiver board to the second Arduino, using +5v (VCC), GND, and either of the 2 DATA pins to Arduino pin 11.

When the code below is uploaded to the appropriate Arduino, you should see the following in the RX Arduino serial monitor:


Try your own modifications to send numeric data like int's and floats.

Upload the following sketch to the TX Arduino:

#include <VirtualWire.h>

const int led_pin = 13;
const int transmit_pin = 11;
const int receive_pin = 2;
const int transmit_en_pin = 3;

void setup()
{
  // Initialise the IO and ISR
  vw_set_tx_pin(transmit_pin);
  vw_set_rx_pin(receive_pin);
  vw_set_ptt_pin(transmit_en_pin);
  vw_set_ptt_inverted(true); // Required for DR3100
  vw_setup(2000);  // Bits per sec
}

byte count = 1;

void loop()
{
  char msg[7] = {'h','e','l','l','o',' ','#'};

  msg[6] = count;
  digitalWrite(led_pin, HIGH); // Flash a light to show transmitting
  vw_send((uint8_t *)msg, 7);
  vw_wait_tx(); // Wait until the whole message is gone
  digitalWrite(led_pin, LOW);
  delay(1000);
  count = count + 1;
}


Upload the following sketch to the RX Arduino

#include <VirtualWire.h>

const int led_pin = 13;
const int transmit_pin = 12;
const int receive_pin = 11;
const int transmit_en_pin = 3;

void setup()
{
    delay(1000);
    Serial.begin(9600); // Debugging only
    Serial.println("setup");

    // Initialise the IO and ISR
    vw_set_tx_pin(transmit_pin);
    vw_set_rx_pin(receive_pin);
    vw_set_ptt_pin(transmit_en_pin);
    vw_set_ptt_inverted(true); // Required for DR3100
    vw_setup(2000);  // Bits per sec

    vw_rx_start();       // Start the receiver PLL running
}

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

    if (vw_get_message(buf, &buflen)) // Non-blocking
    {
 int i;

        digitalWrite(led_pin, HIGH); // Flash a light to show received good message
 // Message with a good checksum received, print it.
 Serial.print("Got: ");
 
 for (i = 0; i < buflen -2; i++)
 {
     //Serial.print(buf[i], HEX);
            Serial.write(buf[i]);
     //Serial.print(' ');
 }
 Serial.println();
        digitalWrite(led_pin, LOW);
    }
}


Sunday, July 26, 2015

The Raspberry Pi and a Neo-6M GPS


Previously I have posted tutorials on how to interface a GPS to an Arduino, but this time I wanted to use a Raspberry Pi. Here is an easy and inexpensive Instructable I have posted, and expansion into other projects will follow.

http://www.instructables.com/id/Raspberry-Pi-the-Neo-6M-GPS/

The GPS module is less than $20