Loading...
  Show Posts
Pages: 1 ... 11 12 [13]
181  Forum 2005-2010 (read only) / Exhibition / Re: Cascaded shift registers, 7-seg displays, PC input on: February 01, 2010, 01:09:59 am
I really like your idea.

I'm building a weather station using arduino.

The main display of all the weather data is to be my PC.
The PC is on only for short periods so for most of the time
the arduino will just be a box with blinking lights.

I did not have many digital pins left but with your circuit I
think I will add some hex display to make it more entertaining.

I may write it as a small class as I did for the sd card:

http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1259789744/0#0

I assume your idea is competely open as mine are but I
will Include your site in the comments if you wont.
Or not if you dont.

I will post the details on this forum.
182  Forum 2005-2010 (read only) / Exhibition / Re: Indoor weather station on: March 05, 2010, 01:48:03 am
You are right.

It's all getting a bit messy.

I'll work on something ...... any ideas?

I can put a label on each file as I have for the lightningpdf.pdf
file .

If I did that for each file would that be enough?
183  Forum 2005-2010 (read only) / Exhibition / Re: Indoor weather station on: March 02, 2010, 12:09:15 am
I finally found out how to get pictures on to the forum.
Reading the help page it says to use the "browse button".
I never found one.

This is the overall setup of the weather station:



This is the circuit of the station:





184  Forum 2005-2010 (read only) / Exhibition / Re: Indoor weather station on: February 05, 2010, 06:08:39 pm
Thanks for the replies.

Quote
Neels

If you download indoorweather.zip you will see
a complete explaination of datestamping the sectors.

Its in a PDF file.

The PC clock is used as the RTC for the datestamps.

You are right the vb program does the work of datestamping and
display.
185  Forum 2005-2010 (read only) / Exhibition / Indoor weather station on: February 02, 2010, 12:07:21 am
I have constructed an indoor weather station using an Arduino 2009.

It has a temperature sensor:

http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1259616399

It has a humidity sensor:

http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1264143673

It has a air pressure sensor:

http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1264823064/0#0

I can store up to 3 years of data on a 1Gb sd card.
I have used a sd card library class:

http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1259789744/0#0

The arduino code :

Code:
/*  On restart sends serial "ready" and current sd sector number.
    Current sd sector number held in EEPROM.
    Repeat every 10 seconds
    PC sends sd sector number to use and we start to get samples.
    Every 10 secs sample temperature humidity and airpressure.
    Send samples to PC and store in RAM.
    If 85 samples(255 bytes)in RAM save in sd card.
    If receive "u" and number from PC send requested sd sectors
    and RAM to the PC.
    If error in read/write to sd card stay in a loop and
    send "error" to PC every 10 seconds.
*/    
#include <EEPROM.h>
#include <SDCARD.h>    //read write 512 blocks to sd card
#include <stdlib.h>    // C utility functions
volatile unsigned char buffer[512] ;  //RAM store for samples
unsigned long lastmillis = 0;        // will store last time we looked
unsigned int tempsample = 0;  //adc temp averaged each 10 seconds
const int tempadc = 1;  // Analog input pin for temperature
const int pin = 7;   // digital input pin for humidity
const int sensor_offset = 1889;  //the offset to give correct RH value
unsigned long duration;  //pulse time of HCH-1000 timer
unsigned int humidsample = 0;  //humid  averaged each 10 seconds
unsigned int airsample =0;  //adc air averaged each 10 seconds
const int airadc = 0;  // Analog input pin for air pressure
unsigned int ramaddress =0;  //address of next storage location in RAM
unsigned long currentblock = 0; //the current block number in the sd card
unsigned long loadblocks = 0;  //the start upload sector from computer
int inbyte = 0;  // character input from computer in ASCII
char restartblock[8];  //the computer inputs the startblock number
boolean restarted = false;   //set when the computer restarts the avr

void setup()
{
  Serial.begin(9600);  // initialize serial communication with computer
  pinMode(9, OUTPUT);      // sets the digital pin as output for sample flash
  pinMode(8, OUTPUT);      // sets the digital pin as output for sd card error
  pinMode(pin, INPUT);  //humidity input
  digitalWrite(8, LOW);    //start  with sd card error led off
}

void loop()
{
  if ( ! restarted)  // if not restarted
  {
  while (Serial.available() == 0) //wait until computer is connected
    {
     ready();  //after restart send ready message
    }//end of wait till computer connected
   getcurrentblock();  //get the current block from computer
  }//end of not restarted
  
  if (millis() < lastmillis)
  lastmillis = 0;  //have a rollover every 52 days
  if (millis() - lastmillis > 10000)  //every 10 seconds
  {
    lastmillis += 10000;   // update the timer
    digitalWrite(9, HIGH);    //flash the led to show sampling
    
    if (Serial.available() > 0)   //do we have a computer command
    {
     inbyte = Serial.read();  //get the command
     if (inbyte  == 'u')   //download all the stored samples
     {   // computer sends "r4444" to upload all RAM and sd blocks from 4444
    
      byte j = 0;   // for start counter enter digits
      for (j = 0; j < 8 ; j +=1)
      restartblock[j] = '0';  //clear the buffer before read
      while (Serial.available() != 0)   //input the sd card start block
      {
       restartblock[j] = Serial.read();
       j +=1;   //next digit position
      }//end of input sd card start block
      loadblocks = strtoul(restartblock,0,10);   //this is requested atarting block
      if (loadblocks > currentblock)
      loadblocks = currentblock;   //we must never have or runs through whole card
      
      uploadbuffer(ramaddress);  //upload the current sample that are in ram
      Serial.println("r");  //tell computer all RAM samples are sent
      uploadsdblocks();  //upload the requested sd blocks
      Serial.println("e");  //tell computer all samples are sent      
     }//end of download all stored sample samples  
    }//end of we have a computer command
    
    tempsample = adc(tempadc);   //get the analog sample for temperature
    airsample = adc(airadc);  //get analog sample for air pressure
    humidity();  //get the sample for the humidity
    sendsample(); //send a sample to the computer
    
    if (ramaddress == 510)  //have we have filled the ram buffer
    {      
     lastblocksave();  //saved full ram to sd card so save block number
    }//end of have we filled the ram buffer
    
  }//end of every 10 seconds
  digitalWrite(9, LOW);  //turn led off  
}//end of loop

inline unsigned int adc(int pin)
{
 unsigned int sample = 0;   //reset the sample value
 //tempsample = 0;  //reset the average
 int i = 0;
 for(i; i<=64; i++)
 sample += analogRead(pin);  //get 64 samples added together 1024 x 64 max
 sample = sample / 64;  //get the average of 64 samples
 return sample;
 //tempsample +=sample;  //add the 10 second sample
}//end of adc

The arduino 2009 acts as a standalone weather station.
It does not display the data.It can operate independantly for months.
It samples the sensors until the RAM is full then The ram samples
are stored on a sector of a sd card.
Eventually a 3 years weather samples could be on on the 1Gb sd card.

Each time the PC is connected any unstored sectors are uploaded to
files on the PC's hard drive.
It then can be displayed using all the facilities of the PC's display.

The central idea is that the PC has a file copy of each sd card sector
stamped with the datetime it was recorded.

I have used visual basic for the PC program.
I find it easy to use when constructing GUI applications.
It does lock you in to windows but I can live with that.

Microsoft has a free download:

http://www.microsoft.com/express/Downloads/Download-2008.aspx#2008-Visual-Basic

If you have visual basic on your PC you can try my program.
You dont need an arduino it has 4 days of example data.


The programs and other files are at the site given below.
Download indoorweather.zip

http://sourceforge.net/projects/arduinoweather/files/
186  Forum 2005-2010 (read only) / Exhibition / Re: four digit LED display on: February 25, 2010, 03:45:52 pm
Thanks for the email on the bug in SEVEN.displayF.

Need to change two lines:

Code:
if (numInt > 1)   //point must move
//
if (numInt > 10)   //point must move
//
//change to:
//
if (numInt >= 1)   //point must move
//
if (numInt >= 10)   //point must move

To use this display in my weather station I made some changes.

In the software I used PORT instructions rather than the
digital.write functions. This saves 380 bytes.

So in the .h file we have:

Code:
#define setupD8 DDRB |=0x01;   // data pin 8 is set to output
#define setupD7D6 DDRD |= 0xC0;   // data pin 7 and 6 is set to output
#define latchpinLOW PORTB &= ~0x01;  //set latch pin 8 to low
#define latchpinHIGH PORTB |= 0x01;  //set latch pin 8 to high
#define clockpinLOW PORTD &= ~0x80;  //set clock pin 7 to low
#define clockpinHIGH PORTD |= 0x80;  //set clock pin 7 to high
#define datapinLOW PORTD &= ~0x40;  //set data pin 6 to low
#define datapinHIGH PORTD |= 0x40;  //set data pin 6 to high
//
//  not as before
//
const int latchPin =  8;    // digital pin to latch 8 bits to parallel register
const int clockPin =  7;    // digital pin to clock data through serial reg
const int dataPin =  6;    // digital pin to send data to registers

In the .cpp file we have:

Code:
 setupD8;    //pin 8 to output
  setupD7D6;  //pin 7 and 6 to output
  unsigned long mask = 0x01;  //mask for display digit bit
  latchpinLOW;   //ready to latch data
  while (mask != 0)  //send each bit to register 32 bits total
  {  
  clockpinLOW;  //ready to clock data
  datapinHIGH;  //lets assume the data is high
  if ((display & mask) == 0)
  datapinLOW;   //wrong the data was low
  mask = mask<<1;  //look at next bit in digit display
  clockpinHIGH;  //clock the data line into the reg
  }//end of send 32 bits
  latchpinHIGH;   //latch the 8 bits to output register
//
//  not as before
//
  pinMode(clockPin, OUTPUT);
  pinMode(latchPin, OUTPUT);
  pinMode(dataPin, OUTPUT);
  unsigned long mask = 0x01;  //mask for display digit bit
  digitalWrite (latchPin, LOW);   //ready to latch data
  while (mask != 0)  //send each bit to register 32 bits total
  {  
  digitalWrite (clockPin, LOW);  //ready to clock data
  digitalWrite (dataPin,((display & mask) > 0 ? HIGH : LOW)); //C++ only ternary operator
  mask = mask<<1;  //look at next bit in digit display
  digitalWrite (clockPin, HIGH);  //clock the data line into the reg
  }//end of send 32 bits
  digitalWrite (latchPin, HIGH);  //latch the 8 bits to output register

For the hardware I had to make some changes as I do not use the USB supply.

I have a battery backed 12V supply. I wanted to keep the current for the display seperate from the sensitive sensors supplies.
To do this I gave the LED supply its own regulator. It is also wired so
that if power fails and the battery supplies power the display does
not operate. It draws to much current from the battery.

The new programs and circuit diagrams are available from:
Download fourdigitLED1.zip

http://sourceforge.net/projects/arduinoweather/files/
187  Forum 2005-2010 (read only) / Exhibition / four digit LED display on: February 17, 2010, 07:58:09 pm
This is a general purpose 4 digit 7 segment LED display.

It uses two 16 bit serial input constant-current LED
drivers with four 7 segment displays.

It uses 3 digital pins from the arduino.

The code is all in a class which has 4 functions:

SEVEN.displayI(int number)
This displays numbers in the range -999 to 9999.
The number is left justified. If it is not in
the range "EEEE" will be displayed.

SEVEN.displayF(float number)
This displays numbers in the range -99.9 to 999.9.
One decimal point is displayed.
The number is left justified. If it is not in
the range "EEEE" will be displayed.

SEVEN.displayP(long picture)
Picture is 32 bits which map to each segment.

SEVEN.displayA(long origional,unsigned char addition)
This is designed to be used with displayI or displayF.
It adds the right hand character to the display.

An example program showing use of the class

Code:
// simple program to show uses

#include <SEVEN.h>

void setup()   {    }

void loop()      
{  
 SEVEN.displayI(789);  //displays "789_"
 delay(1000);
 SEVEN.displayF(-1.234);  //displays "-1.2_"
 delay(1000);
 SEVEN.displayP(0x1e5f4138);  //displays "FAIL"
 delay(1000);
 SEVEN.displayA(SEVEN.displayF(25.7),0x3a);  //displays "25.7C"
 delay(1000);
}

The connections and the 7 segment display I use give
the following bit connection diagram.  

                D1
           ____________
          
          |                    |
          |                    |
     D3 |                    | D0
          |                    |
          |                    |
                D2
           ____________

          
          |                    |
          |                    |
     D4 |                    | D6
          |                    |
          |                    |
           ____________
                                       __
                D5                  |dp| D7
                                        --  

 
To display a "3" the bits are:

D7 D6 D5 D4 / D3 D2 D1 D0
0   1    1   0   / 0   1    1   1  = 0x67

The reason for the functions in the class is that I am
using them all for my Arduino  indoor weather station:

http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1265087241

I use the PC to display the weather data and the arduino is
just a box with two LEDs. Looking through forum I found
a multiple LED display using three digital pins.

http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1264989981/0#8

I decided to use an extra pin and make the arduino
more interesting by showing the current data using 4 LEDs.
The arduino has a good tutorial for this type of circuit.

http://www.arduino.cc/en/Tutorial/ShiftOut

The 74HC595 is not designed to drive LEDs. It will work within
specification if you limit the current through each segment to
(75/8) 9.3 mA. The 220 ohm limiters in this circuit give a
maximun load current of 109 mA for 2v LEDs.
This exceeds the spec of 75mA.
With all segments on the poor little thing will be stretched.
If you put a 220 in the common leg only you get different
intensitys for the segment patterns.

The artical also suggests the STP16C596 with built-in constant
current sources. I chose to go with a A6276:

http://www.farnell.com/datasheets/87640.pdf

I set the current limit to 10mA per segment. This gives a maximun
of 320mA which can be handled by the USB.

The 7 segment display I used is a HDSP-521E:

http://www.farnell.com/datasheets/95204.pdf

The programs and other files are at the site given below.
Download fourdigitLED.zip

http://sourceforge.net/projects/arduinoweather/files/
188  Forum 2005-2010 (read only) / Exhibition / Re: humidity sensor on: January 26, 2010, 11:08:00 pm
Thanks for your replies.

 
Quote
Put this in a sealed container and it will stabilize at 75% RH

I appears that other salts can aslo be used:

http://www.conservationphysics.org/satslt/satsalt.php

I'm not yet brave enough to put my lone $17 sensor in a bag of salt solution.

Quote
What allowance have you made  for voltage feed variation

I have covered this problem see:

http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1259616399



189  Forum 2005-2010 (read only) / Exhibition / Re: humidity sensor on: January 26, 2010, 01:37:55 am
Thanks for the reply.

I did buy 2 HCH-1000 one was dead on arrival. So I cant compare.

Sometimes I do get 3 or 4% different from my WMR-100. When
I compare the two plotted  outputs, the accuracy is there but peaks and troughs are at slightly different times.
I put this downs to the wmr-100 being in a sealed space and the
HCH-100 is in moving air.

One example I have come accross for calibration:

http://sites.google.com/site/angophora/projects/temperature-humidity-sensor

An extract is:

Calibrating the humidity sensor
The humidity sensor has a linear output and can be calibrated at two points, 0 %RH and 100 %RH.  First modify the code so that the read_humidity() function returns the counter_value by changing the last line to this  (return counter_value;).  For the 0 %RH point place the sensor in a plastic bag with several sheets of absorbant kitchen paper that have been dried in the oven for an hour.  It will take some time for the humidity to stabilize, so be sure to wait for it to stop changing.  For the 100 %RH point place some warm wet paper in a plastic bag with the sensor, taking care not to get the board or sensor wet.  Once agian it will take some time to stabalize.  When you have the two counter readings you calculate the conversion factors and change two variables in the code.

I dont dare try this at the moment for fear of killing another $17.

190  Forum 2005-2010 (read only) / Exhibition / humidity sensor on: January 22, 2010, 02:01:13 am
I am making a weather station using Arduino 2009

For my humidity sensor I chose a honeywell HCH-1000.
It was the cheapest (AUD $17) accurate one I could find.

The data sheet is at:

http://www.honeywell-sensor.com.cn/prodinfo/sensor_humidity_moisture/datasheet/HCH-1000.pdf

The HCH-1000 has a capactance of 300 to 360 pf over the 0 to 100% range.
Honeywell have an application note for the HCH-1000:

http://www.digikey.com/Web%20Export/Supplier%20Content/HoneywellSC_480/PDF/HCH_draft3%20Rev%2010%2021%2008.pdf

I use a CMOS 555 as an astable with the HCH-1000 as the capactance.
The data sheet is at:

http://www.datasheetcatalog.org/datasheet/texasinstruments/tlc555.pdf
 
The pulse width of the output can then be determined using the
arduino PulseIn function.

I adjusted the R component of the 555 so that the output pulse width
difference between 0 and 100% gives 1023 when using PulseIn.
This is to fit in with my other sensors which use adc(0 to 1023).
Note that the equations for timing are not exact as we have a significant
leakage resistor across the HCH-1000.

This sets the range of the sensor and no other adjustment is used.
The level must be set by software.

Code:
/*  A simple humidity sensor check program
    The circuit uses software one point calibration.
    Adjust the sensor_offset to give the known ambient humidity.
    The time taken to get each sample is around 75ms.
 */

const int pin = 7;   // Analog input pin
unsigned long duration;
const int sensor_offset = 1889;  //the offset to give correct RH value

void setup()
{
  Serial.begin(9600);   // initialize serial communications at 9600 bps:
  pinMode(pin, INPUT);
}

void loop()
{
  duration = 0;
  byte j = 0;   // for start counter enter digits
  for (j = 0; j < 16 ; j +=1)
  {
  duration += pulseIn(pin, HIGH);
  }  //pulse width has some jitter so get average to smooth
  duration /=16;
  long humid =( duration - sensor_offset)/10.23; //max is 1023 and to %
  Serial.print("sensor = " );                        
  Serial.print(duration);    // print the adc value to the serial monitor:
  Serial.print("\t humidity = ");      
  Serial.print(humid);   // print the temperature
  Serial.println(" %");
  delay(1000);   // wait 1 second before next sample                    
}

I calibrated the sensor using my Oregon scientific WMR 100.
This is the best I'm able to arrange. It is accurate enough for my use.

I have logged the data from the WMR 100 and my humidity sensor over some days and the result are within 2 % over this time.

The sensor circuit and other files are at the site given below.
Download HCH-1000.zip

http://sourceforge.net/projects/arduinoweather/files/
191  Forum 2005-2010 (read only) / Exhibition / Re: Temperature sensor on: January 18, 2010, 04:46:27 pm
Quote
Which circuit are you referring to?.

Thats my circuit for the lm335 with a dc amp.
I'm happy with it, but if any one tries the circuit and has a different result I would like to hear about it.

The RMIT board is at:

http://interestingbytes.wordpress.com/hello/open-usb-io-interface-board/

Quote
1-wire interface is pretty handy.

I know it is a really good system.
It does lock you in once you use it. I would like the freedom of using
whatever weather device I choose.

Thanks for your replies.
 smiley-wink

192  Forum 2005-2010 (read only) / Exhibition / Re: Temperature sensor on: January 17, 2010, 12:43:01 am
If anyone has tried this circuit for a  temperature sensor, some feedback would be appreciated.
 smiley
193  Forum 2005-2010 (read only) / Exhibition / Re: Temperature sensor on: November 30, 2009, 11:30:32 pm
Thanks...you are right about the USB supply.
Not only is it variable it carries digital noise. It is clean enough
for digital but has too much noise for analog circuitry.

At the RMIT university they use a Atmel board for student projects.

http://pjradcliffe.files.wordpress.com/2009/03/open_usbio_schematic.pdf

You can see that they use L-C filters for Vcc and another for the Aref.

I have my Arduino setup as a remote monitor. It runs from a
regulated 9v supply.
When connected to the computer with USB it will
still be using that supply.
At their core all digital sensors have an analog sensor. They will
have a very stable adc. As long as the arduino adc is stable(with stable Vcc)
a LM335 can be just as good.

I have been comparing my logged data over a couple of weeks with my
Oregon weather station. There is very close agreement - not scientific
I know but I'm not commercial It's just for myself.

The DS18B20 can be set to 12 bit adc so that it can give:

0.0625 C per binary step

So it will work as well as my circuit.
194  Forum 2005-2010 (read only) / Exhibition / Temperature sensor on: November 30, 2009, 04:26:39 pm
I am making a weather station using Arduino 2009.
The Arduino adc has 10 bits as do most of the digital sensors.
My indoor temperature range is 0 to 40 C. Using the full range of
the adc the best accuracy I could get is 0.04 C per binary step.

There are many temperature sensors on the market:

http://www.chipcatalog.com/Cat/65.htm

The digital output devices all have a LM335 type device a dc amplifier,
a adc converter and then a serial transmit circuit.
The format of the serial data can be the Dallas Semiconductor 1-Wire or I2C or SPI.

The AD7416 is only a few dollars and has a 0.25 C per binary step and is at:

http://www.datasheetcatalog.org/datasheet/analogdevices/422626197AD7416_7_8_e.pdf

Looking now at the old standby the Lm335 is at:

http://www.datasheetcatalog.org/datasheet2/0/01g1j31dx93i4k0k0qag4l8914py.pdf

If I connect the LM335 output to an analog input and use the 5.0v internal AREF
the following will occur:

0.5C per binary step

If I set AREF to 3.3v and include in code         analogReference(EXTERNAL);
the following will occur:

0.3C per binary step

We are not getting the accuracy because the Lm335 voltage swing is only a
small proportion of the adc operating range.
We need a dc amplifier. One device has it incorporated. The AD22103 is at:


http://www.datasheetcatalog.org/datasheet/analogdevices/630448615ad22103.pdf

We now get this result:

0.1C per binary step

This is getting close but we cant have negative temperatures.
My outdoor temperature range is to be -10 to 50 C.
I decided that the best answer for my requirements was to use a LM335 and
a seperate dc amplifier.

The amplifier needs to be single supply and have a large % voltage swing.
You do need a larger regulated voltage. I power my arduino with 9v so I used
that supply and then divided down to give me the full 0 to 5v swing.

I chose the LM3900. Application notes are at:

http://www.national.com/an/AN/AN-72.pdf

We now get this result:

0.04C per binary step

The sensor circuit and other files are at the site given below.
Download LM335.zip

http://sourceforge.net/projects/arduinoweather/files/


Code:
/*  A simple temperature sensor check program
    The circuit uses one point calibration.
    Adjust the pot to give the known ambient temperature.
 */

const int analogpin = 0;  // Analog input pin

void setup()
{
  Serial.begin(9600);   // initialize serial communications at 9600 bps:
}

void loop()
{
  int adcvalue = analogRead(analogpin);    // read the analog in value:            
  Serial.print("sensor = " );                        
  Serial.print(adcvalue);    // print the adc value to the serial monitor:
  double temp = adcvalue / 25.6;  //convert it to Celsius
  Serial.print("\t temp = ");      
  Serial.println(temp);   // print the temperature
  delay(1000);   // wait 1 second before next sample                    
}
Pages: 1 ... 11 12 [13]