Show Posts
Pages: 1 ... 22 23 [24] 25
346  Forum 2005-2010 (read only) / Interfacing / Re: Melexis SMBus IR Thermometer - NFI on: November 30, 2010, 11:23:22 pm
I've tried EVERY bit of code I can find and I can't get squeak out of this sensor!
When I try the i2cmaster library, I can't get any output on the serial monitor.
I'm now trying the code sensorJunky posted and still no output on the serial monitor.
I'm going to have to get the CRO home!
I think I've been spoilt by the other I2C devices I've tried, HMC6352, eeproms, my uM FPU!
347  Forum 2005-2010 (read only) / Interfacing / Re: turn laser on and off using PWM on: November 28, 2010, 06:14:01 am
The pictured 300mW unit probably is real and these days that is relatively "low" powered.
There are plenty of 100mW+ laser articles on Hack A Day.

http://hackaday.com/2009/06/25/blu-ray-laser-keychain/
http://hackaday.com/2009/02/27/laser-lighter/

The guy on Hack A Day that posted video of his Star Trek "Phasor" bursting balloons across the room states his 350mW blue laser diode only draws 450-500mW.

Some of the blue laser diodes from Blue Ray Burners push upwards of 1W!
But I'm not about to take my BDROM burner to bits to complete my RGB laser scanner!
(Yes, I stupidly bought a Blue Ray burner and I'm still the only person I know with one! BUT I can back up 25G or 50G, @ AUS$1/G, sigh)

That idiot Kip Kay from Make had a stupidly dangerous tutorial about putting blue laser diodes in Bic lighter casings AND lighting cigarettes right in front of his face, with no eye protection, but that's Kip Kay for ya!

I just bought a 10mW red laser diode and a 10mW green laser pointer, but I won't be operating that version of my laser "wobbler/scanner" indoors without a low power setting!

So far the most powerful laser diode I have is a 250mW and an older 100mW Infra-red module from laser printers.

The higher resolution the laser printer or bromide/film printer is, the higher the laser diode output is, probably because the scanning mirror is spinning faster.

The Linotronic 4000 dpi film printer I used to work with had a HUGE laser diode module, that one was rated at 500mW and it got really hot, especially when you printed out full A0 film or bromide.

I've used the infra red diodes behind diffusers, turned right down as "night shot" illumination for my Sony camcorder.

The upshot of all this is, they might not be safe or legal, but there a plenty of ridiculously high powered laser diodes and pointers for sale!
348  Forum 2005-2010 (read only) / Interfacing / Re: turn laser on and off using PWM on: November 28, 2010, 03:22:41 am
I have had a laser pointer running @5V for the last 5-6 years , I bridged the switch with solder, that's after I ran it continuously for months with a cloths peg holding the switch "on".
From your photo it looks like mine, I ripped it out of the case and just hooked it up to a 5V supply, switched with the first transistor I found in my junk box.
If it ran on 3 "button" cells you might not have enough current and voltage to get the laser control circuit to "come up".

It's only REALLY cheap laser pointers that don't have the whole feedback circuit from the actual laser diode.

Don't feed current straight into the laser package, if it's got 3 pins it WILL need the feedback circuit, or the device will not last very long.

3V probably isn't enough to power the laser AND it's control circuit, if it had 3 "button" cells that's at least 4.5V, a bit more if they are fresh cells.
349  Forum 2005-2010 (read only) / Interfacing / Re: Driving a mosfet directly - questions on: November 28, 2010, 03:52:36 am
One important thing to remember is that FET's of any kind are voltage controlled devices, Bi-Polar transistors are current controlled devices.

A silicon bi-polar transistor when it comes "on" has a .6V voltage drop across the emitter/collector junction, that's why they get hot, whatever current you draw through the transistor has to dissipate that 0.6V @ whatever current you are pulling through it.
ALL silicone devices have this 0.6V voltage drop.

It's a bummer big germanium power transistors are no longer available.
Germanium devices have a 0.3V drop across them, it's why "crystal" radios usually have an OA-91, it makes them more sensitive.

a FET turns into a piece of wire! :-)
And has a minuscule voltage drop across it.
That's IF you turn it "hard" on.

With a Bipolar transistor like a 2N2222, you can get away with just a resistor on the base, but it will only switch when the voltage hits 0.6V, a better way is to put a voltage divider on the base, calculate the 2 resistor values so you have the base sitting just under 0.6V, then feed the output from your Arduino pin through a resistor into the voltage divider, it will switch much quicker that way.

Remember you can use a transistor for much more than a switch! (I hear told  smiley )
350  Forum 2005-2010 (read only) / Interfacing / Re: DS1307 and LCD on: November 28, 2010, 02:59:41 am
Can you output anything to your LCD?
If you have the Time library, even without setting the CURRENT time you should get something.
This is the sketch I based my code on.


Code:
/*
 * RTC Control v.01
 * by <http://www.combustory.com> John Vaughters
 * Credit to:
 * Maurice Ribble - http://www.glacialwanderer.com/hobbyrobotics for RTC DS1307 code
 *
 * With this code you can set the date/time, retreive the date/time and use the extra memory of an RTC DS1307 chip.  
 * The program also sets all the extra memory space to 0xff.
 * Serial Communication method with the Arduino that utilizes a leading CHAR for each command described below.
 * Commands:
 * T(00-59)(00-59)(00-23)(1-7)(01-31)(01-12)(00-99) - T(sec)(min)(hour)(dayOfWeek)(dayOfMonth)(month)(year) - T Sets the date of the RTC DS1307 Chip.
 * Example to set the time for 02-Feb-09 @ 19:57:11 for the 3 day of the week, use this command - T1157193020209
 * Q(1-2) - (Q1) Memory initialization  (Q2) RTC - Memory Dump
 */

#include "Wire.h"
#define DS1307_I2C_ADDRESS 0x68  // This is the I2C address


// Global Variables

int command = 0;       // This is the command char, in ascii form, sent from the serial port    
int i;
long previousMillis = 0;        // will store last time Temp was updated
byte second, minute, hour, dayOfWeek, dayOfMonth, month, year;
byte test;
  
// Convert normal decimal numbers to binary coded decimal
byte decToBcd(byte val)
{
  return ( (val/10*16) + (val%10) );
}

// Convert binary coded decimal to normal decimal numbers
byte bcdToDec(byte val)
{
  return ( (val/16*10) + (val%16) );
}

// 1) Sets the date and time on the ds1307
// 2) Starts the clock
// 3) Sets hour mode to 24 hour clock
// Assumes you're passing in valid numbers, Probably need to put in checks for valid numbers.
 
void setDateDs1307()                
{

   second = (byte) ((Serial.read() - 48) * 10 + (Serial.read() - 48)); // Use of (byte) type casting and ascii math to achieve result.  
   minute = (byte) ((Serial.read() - 48) *10 +  (Serial.read() - 48));
   hour  = (byte) ((Serial.read() - 48) *10 +  (Serial.read() - 48));
   dayOfWeek = (byte) (Serial.read() - 48);
   dayOfMonth = (byte) ((Serial.read() - 48) *10 +  (Serial.read() - 48));
   month = (byte) ((Serial.read() - 48) *10 +  (Serial.read() - 48));
   year= (byte) ((Serial.read() - 48) *10 +  (Serial.read() - 48));
   Wire.beginTransmission(DS1307_I2C_ADDRESS);
   Wire.send(0x00);
   Wire.send(decToBcd(second));    // 0 to bit 7 starts the clock
   Wire.send(decToBcd(minute));
   Wire.send(decToBcd(hour));      // If you want 12 hour am/pm you need to set
                                   // bit 6 (also need to change readDateDs1307)
   Wire.send(decToBcd(dayOfWeek));
   Wire.send(decToBcd(dayOfMonth));
   Wire.send(decToBcd(month));
   Wire.send(decToBcd(year));
   Wire.endTransmission();
}

// Gets the date and time from the ds1307 and prints result
void getDateDs1307()
{
  // Reset the register pointer
  Wire.beginTransmission(DS1307_I2C_ADDRESS);
  Wire.send(0x00);
  Wire.endTransmission();

  Wire.requestFrom(DS1307_I2C_ADDRESS, 7);

  // A few of these need masks because certain bits are control bits
  second     = bcdToDec(Wire.receive() & 0x7f);
  minute     = bcdToDec(Wire.receive());
  hour       = bcdToDec(Wire.receive() & 0x3f);  // Need to change this if 12 hour am/pm
  dayOfWeek  = bcdToDec(Wire.receive());
  dayOfMonth = bcdToDec(Wire.receive());
  month      = bcdToDec(Wire.receive());
  year       = bcdToDec(Wire.receive());
  
  Serial.print(hour, DEC);
  Serial.print(":");
  Serial.print(minute, DEC);
  Serial.print(":");
  Serial.print(second, DEC);
  Serial.print("  ");
  Serial.print(month, DEC);
  Serial.print("/");
  Serial.print(dayOfMonth, DEC);
  Serial.print("/");
  Serial.print(year, DEC);

}


void setup() {
  Wire.begin();
  Serial.begin(57600);
 
}

void loop() {
     if (Serial.available()) {      // Look for char in serial que and process if found
      command = Serial.read();
      if (command == 84) {      //If command = "T" Set Date
       setDateDs1307();
       getDateDs1307();
       Serial.println(" ");
      }
      else if (command == 81) {      //If command = "Q" RTC1307 Memory Functions
        delay(100);    
        if (Serial.available()) {
         command = Serial.read();
         if (command == 49) {      //If command = "1" RTC1307 Initialize Memory - All Data will be set to 255 (0xff).  Therefore 255 or 0 will be an invalid value.  
          Wire.beginTransmission(DS1307_I2C_ADDRESS); // 255 will be the init value and 0 will be considered an error that occurs when the RTC is in Battery mode.
          Wire.send(0x08); // Set the register pointer to be just past the date/time registers.
         for (i = 1; i <= 27; i++) {
             Wire.send(0xff);
            delay(100);
         }  
         Wire.endTransmission();
         getDateDs1307();
         Serial.println(": RTC1307 Initialized Memory");
         }
         else if (command == 50) {      //If command = "2" RTC1307 Memory Dump
          getDateDs1307();
          Serial.println(": RTC 1307 Dump Begin");
          Wire.beginTransmission(DS1307_I2C_ADDRESS);
          Wire.send(0x00);
          Wire.endTransmission();
          Wire.requestFrom(DS1307_I2C_ADDRESS, 64);
          for (i = 1; i <= 64; i++) {
             test = Wire.receive();
             Serial.print(i);
             Serial.print(":");
             Serial.println(test, DEC);
          }
          Serial.println(" RTC1307 Dump end");
         }
        }  
       }
      Serial.print("Command: ");
      Serial.println(command);     // Echo command CHAR in ascii that was sent
      }
      
      command = 0;                 // reset command
      delay(100);
    }
//*****************************************************The End***********************


After I set the current local time I was able to use this bit of code.
Code:
/*
 * TimeRTC.pde
 * example code illustrating Time library with Real Time Clock.
 *
 */

#include <Time.h>  
#include <Wire.h>  
#include <DS1307RTC.h>  // a basic DS1307 library that returns time as a time_t

void setup()  {
  Serial.begin(9600);
  setSyncProvider(RTC.get);   // the function to get the time from the RTC
  if(timeStatus()!= timeSet)
     Serial.println("Unable to sync with the RTC");
  else
     Serial.println("RTC has set the system time");      
}

void loop()
{
   digitalClockDisplay();  
   delay(1000);
}

void digitalClockDisplay(){
  // digital clock display of the time
  Serial.print(hour());
  printDigits(minute());
  printDigits(second());
  Serial.print(" ");
  Serial.print(day());
  Serial.print(" ");
  Serial.print(month());
  Serial.print(" ");
  Serial.print(year());
  Serial.println();
}

void printDigits(int digits){
  // utility function for digital clock display: prints preceding colon and leading 0
  Serial.print(":");
  if(digits < 10)
    Serial.print('0');
  Serial.print(digits);
}



Are you sure your Arduino can "see" the RTC?
351  Forum 2005-2010 (read only) / Exhibition / Re: FORTH environment for Arduino on: January 11, 2011, 08:02:52 am
Freak me Lefty!
I have this Mars/Lunar lander obsession, my first attempt, age 12, was all relay logic and bulbs!
Then I went to DTL, after the start of the 70's I built a 6800 system, with front panel LED's and switches, you might know the one, from that issue of "Practical Electronics".
Still at it, always will, till I plant that Australian flag on the Moon/Mars, arduino or not.
352  Forum 2005-2010 (read only) / Exhibition / Re: FORTH environment for Arduino on: January 10, 2011, 10:11:39 am
Lot's of observatories use Forth.
The Arecibo radio telescope and the VLA radio telescope in New Mexico, this is not surprising, Charles Moore worked at the National Radio Astronomy Observatory (NRAO), he was a freelance programmer working mainly on control and data acquisition, which is where Forth really shines.
The contempt that C programmers show Forth (and just about any other language) is amazing!
353  Forum 2005-2010 (read only) / Exhibition / Re: FORTH environment for Arduino on: January 09, 2011, 07:32:56 am
"FORTH never really caught on"!?!?

I guess Adobe NEVER gives any credit to Forth and they should because Postscript IS Forth!
If you ever had an HP programmable calculator, getting into Forth was easy.

Some of my favourite applications are written in Forth, Voyager 1 & 2, the desktop planetarium programme I have running on my Mac (plus!) is a conspicuous example.

354  Forum 2005-2010 (read only) / Exhibition / Re: ArduSpider Sara : a robot project for my daughter on: January 10, 2011, 09:11:27 am
That is so cool!
Great work man!
355  Forum 2005-2010 (read only) / Exhibition / Re: the beginings of my GPS, Navigator, Tricorder on: January 02, 2011, 08:53:13 am
I'm getting at least 6 hours out of 8 2400mAh NiMd AA's so power won't be a problem.
The only reason I thought of giving dog a digital compass is to see his avatar jump around on the screen!
356  Forum 2005-2010 (read only) / Exhibition / Re: the beginings of my GPS, Navigator, Tricorder on: January 01, 2011, 09:41:43 pm
The keypad is a 5x3 array, what's the best way to post circuit diagrams here?

I was going to use this for bushwalking, I'm planning a second unit without a display.
The second unit will just have a GPS, XBee, digital compass and another Mega, on my dogs harness.
That way I'll get real time position and which way he is "pointed".
It doesn't happen often, but sometimes we get separated on our adventures, this way I'll have at least a direction and distance to look in.
357  Forum 2005-2010 (read only) / Exhibition / the beginings of my GPS, Navigator, Tricorder on: December 02, 2010, 09:17:34 am
I thought I'd post some photo's of my first "real" Arduino project.
It's pretty basic right now, I've gotten as far as designing and building a custom keypad, getting the code for the GPS, HMC6352 digital compass, DS1307 RTC, MPL115A Barometer, 24LC256 EEPROM's and Sparkfun serial backpack LCD display working.

This is the keypad

I used Inkscape to draw the pad, printed it out on my inkjet and laminated it. The key switches are 12mm square tactile keys on a prototyping board, I got the keys from recycling old photocopier boards.

Here is my Mega with the Sparkfun GPS shield sitting on a DFRobot prototyping shield, with the HMC6352, DS1307 Sparkfun breakouts and the HUGE serial back pack LCD.
When Sparkfun say huge, they are not kidding, it's 5"x3"!!!


Here is the test screen showing the compass heading, time, date, barometer, temperature and altitude.
The MPL115A Barometer isn't hooked up yet, so those readings are bogus, but you get the idea.



I'll build the case in the next couple of days, but work keeps getting in the way!
358  Forum 2005-2010 (read only) / Exhibition / Re: Lunar Lander on the Arduino on: December 03, 2010, 08:55:00 pm
Does anyone remember when Byte used to publish code for HP programmable calculators as bar codes/
That was cool and saved a lot of typing!

It's funny in way that with the Arduino platform we've gone back to around the same memory footprint as an Apple II, Commodore Pet, TRS-80 etc.
A tad faster though!
359  Forum 2005-2010 (read only) / Exhibition / Re: Lunar Lander on the Arduino on: December 02, 2010, 08:02:19 am
sigh, I know!
My parents made me move my ASR33 out to my shed, then I had to sound proof the shed when the neighbours complained!
Especially when I had my SYM-1 (which I still have and use!) decoding RTTY.
Rueters and AAP news services!
I don't have the ASR 33 telly type any more, but I have a copy of Star Trek on paper tape!

You know what?
I think I will write a STREK for my Mega!
Tellymate shield for the main viewer, big LCD for helm control, buttons and switches for controls!

By the way, does anyone remember "Phasor Blast", I think Mattel made them.
360  Forum 2005-2010 (read only) / Exhibition / Re: Lunar Lander on the Arduino on: December 02, 2010, 07:42:17 am
If you are really keen....

http://www.dunnington.u-net.com/public/startrek/

I just tried this little gem as a sketch, with a little "massaging" it might work
http://outserv.cactus.org/~nystrom/startrek.c

I still have a copy of the "Dilithium Press" book, "Starship Simulation",
which back in the day would have been a bitch to implement.
Most of the book is taken up with a kind of "pseudo-code" listing of the whole program flow, module by module.

The basic idea is all the stations on the Enterprise bridge are implemented, whether that be knobs and switches or touchscreens.
There would be a simulation controller, sort of like a dungeon master controlling the simulation.

These days we could do it with a few Arduino's, big LCD's, either straight serial, XBee, Bluetooth, Ethernet or WiFi.

Since I got my Telemate shield and one of those big ass 160x128 blue and white LCD's Sparkfun sell I've been working on a "Classic" Strek!

Seriously if this looks familiar, it's time for a prostate/diabetes/blood pressure check!  smiley-wink



+---+---+---+---+---+---+---+---+
+                               +
+                               +
+                 O-E           +
+     +-<                       +
+                               +
+                               +
+                               +
+            +-<                +
+---+---+---+---+---+---+---+---+
Command
Pages: 1 ... 22 23 [24] 25