modtronix.com

MicroX and Presto Range (8-Bit PIC board, mixed 3.3/5V) => Projects => Topic started by: Jean Marc on May 23, 2005, 04:11:54 AM

Title: making a wheather station with LCD AND WEB interface
Post by: Jean Marc on May 23, 2005, 04:11:54 AM
Dear all,

I long have the idea to make a weather station with an SBC44 ethernet board. Of course an LCD is needed to display some values locally, but the WEB interface would allow to have a nice coloured display on a PC screen, with graphics, curves etc...
Also one could connect remotely and know exact weather situation in a distant place. A remote PC server/client could also be used to log data files over years to have an history.

The only problem is that although it is not really difficult to make, it might take ages before I could complete it.

My idea is to share the development with others people who would be interested in having a nice weather station at home.

First we could share ideas about what should be monitored (pressure, temp1, temp2..., humidity, rain, wind, direction, light....)
Then choose the sensors...  Analog/digital...
Then I could make the schematics up to the PCB of the interface  circuit that would plug directly to an SBC44EC...

And if some guys could work on the firmware & PC software that would be very nice...

Any person interested ?
then let me know !

JM

Title: Re: making a wheather station with LCD AND WEB interface
Post by: egogus on June 03, 2005, 01:40:08 AM
Dear JM,

I am really interested in this project. I can help you about PC-side software, I think you want to work on HW side.

Regards,
Erdinc.
[email protected]
Title: Re: making a wheather station with LCD AND WEB interface
Post by: krishna on October 22, 2005, 12:07:15 AM
Hi Friends
           
          I am interested in your project.Will you include me in your team. I am developing Process monitoring solutions. I am doing the firmware design and implementation . I think I also can do a part in the project..

                                                                                                  thanks and regards
                                                                                                  krishna
                                                                                                  India
Title: Re: making a wheather station with LCD AND WEB interface
Post by: neils on November 03, 2005, 05:38:40 AM
Hi All,
Krishna mentioned process monitoring and that is more my area also. I would like to be able to get temperature and voltage among other things back from a remote location over a broadband network. I'm not sure what I can offer for this project but I do have some basic programming knowledge and also and electrical and electronics background. I am really registering my interest in this and saying I will help any way I can.
Neil.
Title: Re: making a wheather station with LCD AND WEB interface
Post by: Jean-Marc DELPRAT on November 05, 2005, 01:51:09 PM
Good !

Thanks to all who answered and also to those who'll join later !
Now we enter the cold season (in Europe) and that's the best time to stay at home and do some electronics !

I'll come back within a few weeks with some description of my idea...

stay tuned !

jm
Title: Re: making a wheather station with LCD AND WEB interface
Post by: Rudios on January 24, 2006, 01:05:26 PM
Hello you guys.

How your going with the project.
I just bought the SBC65EC and I'm also interested in making a weather station.
Maybe I can join you guys in developing

Please let me know
Title: Re: making a wheather station with LCD AND WEB interface
Post by: ron on January 31, 2006, 12:40:47 PM
Hi guys

I am not expert like you guys.
But I do have good PIC programming knowledge.
With this I have C++ and VB experience,Let me know if there is something I can do.

I would love to learn more about remote monitoring ,client/server kind of stuff with embedded systems.
I am aslo trying to develop CAN to ethernet gateway ,lets see what happens  :-D
Title: Re: making a wheather station with LCD AND WEB interface
Post by: realwine on August 21, 2006, 06:39:44 AM
Hi All,
I need to make a wheather station, i have sbc68 and devt16t with temp. sensor. If it is not too late i can work with you.

[email protected]
Emre
Title: Re: making a wheather station with LCD AND WEB interface
Post by: GeoMiles on December 05, 2006, 10:26:30 AM
I have the DEV65 with 2 x 16 LCD, Dallas 1-Wire Bus Master, Battery backed Real Time Clock, 2 x 8 pin header connector for external IO connection and SBC68EC with added fram - just a newbe at this.  Looking to help and hoping for help from others :-)
Title: Re: making a wheather station with LCD AND WEB interface
Post by: attila on May 03, 2007, 11:49:41 PM
Hello Everybody!

Fisrt of all, I am sorry about my english, I hope you can understand.

I made a simple weather station based on SBC68EC. It is still under developement, has some problems, but works. Here is the link: meteo.homelinux.net (http://meteo.homelinux.net).

I have a question as well: I added one page, which requires a logged in user. I can access that page, if I am in directly connecting to the board (I am in the same network), but if I would like to view the page from the Internet, then I cannot. The board immediatelly logs me out if I trying to access that page. (You can try it out Network Settings works, but System Settings does not).

Is anybody has any idea?

Thanks,
Attila.
Title: Re: making a wheather station with LCD AND WEB interface
Post by: OmarZ on May 04, 2007, 09:57:53 AM
Hi,
i can access as you see in screenshot
I use firefox 2.0.0.3

You did a very good job!
Where are logged all the samples? eeprom or sd card??
It will be very nice to have your code.
Title: Re: making a wheather station with LCD AND WEB interface
Post by: grognut on May 04, 2007, 12:55:03 PM
Hi,

I bought a Modtronix SBC65EC recently for a similar project as yours. I think what you done is great.

My overall plan is to use thermistors with an ADC (MC3208) for temperature and a wet bulb for humidity. I haven't planned the pressure yet. Obviously I will need a pressure transducer.
For wind, I've just ordered the AAG wind direction and speed kit. I've ordered the RS232 interface with it which I will use with a PC until I write software for the PIC. The I will interface it ro the Modtronix board.

I also intend to battery power the unit with a couple of solar panels.

For logging I will use Fram and when substantially full the data will be transferred to eeprom. This really to protect the data in case of mains failure of a logging PC. I have two 24LC1025 generously supplied as samples from Microchip. ( the MC3208 was also a sample, and the voltage reference I'm using).

At the end of the ethernet link will be a mini itx PC running ubuntu linux for graphing and mass storage ( Apache PHP Mysql etc). These mini itx baords are great. For about £200 I've got a PC consuming 18 watts so fairly eco friendly to leave on.

For the graphing I have been using Jgraph. It's an open source graphing package in PHP which integrates well with Apache and MySql. One user has a weather station and is using polar plots for wind and speed.

I've a couple of questions for you.
Did you have any trouble using NTP. I am using Steve S's NTP and DNS stack. I have posted a couple of snags that I resovled. One was the need to include "projects.h" in the files. At the moment I get problems with DNS timing out. This causes an NTP timeout. In Steve S suggested code I added

      if (sntpStatus() >= 200) // any error
      {
         dnsInit(dnsip); //**** Added this line ***/
         sntpInit();
      }

So if NTP hangs up because of an DNS error it will get reset. I guess there should be a time out in the DNS stack to give a DNS error. There may but something isn't quite right on my board/software.

Another thing. You are using the standard user name and password on you server. This means that someone could maliciously change your server or change the password and user so you can't access it.


best regards
Grognut
Title: Re: making a wheather station with LCD AND WEB interface
Post by: attila on May 05, 2007, 10:21:10 AM
Hello,

OmarZ: Thanks, Than I have no idea, why I cannot accsess that page. I will post the code with some drawings, as soon as it will be ready.

grognut: Thanks, yes I think the SB65EC is better choise since it has the serial port. I am using the same SNTP code, but never used the DNS part of it.

 I am using the same ADC with  LM235 temperature, HIH-4000-004 hummidity and MPX4115 pressure sensor. For outdor monitoring right now I am using TCN-75 (but I am not statisfied with it, so will change it to SHT-71) connected on RS-485 bus. I am using SD-Card for data logging as well as for web-page storing. To draw graphics wz_jsgraphics.js form  http://www.walterzorn.com is a good solution.

Yes, I am using the standard user name and pw, because I asked a question about accessing "System setings", what I cannot do form the Internet. It looks like works fine for the others. Anyway, I can override user name and pw any time by programming the firmware. (Be carefully with the programming, I  am using PIC KIT2, and you can easyly override the bootloder, like I did.).




Regards,
Attila.


Title: Re: making a wheather station with LCD AND WEB interface
Post by: OmarZ on May 05, 2007, 03:40:52 PM
Try to clean all cookies, temporary files and all offline pages: i think it's some stupid windows related problem....
Anyway i'm really interested in your SD Interface.... Can you tell more about it?
Title: Re: making a wheather station with LCD AND WEB interface
Post by: attila on May 07, 2007, 09:22:21 AM
I am modified the sd-card related files from Microchips Mass Storage firmware. After added it, I cannot use Modtronix Network booloader anymore to update web pages. You can send new webpages via command line ftp. Here are the soure files, still does not complate but works.



Title: Re: making a wheather station with LCD AND WEB interface
Post by: OmarZ on May 07, 2007, 09:43:39 AM
Thank you very much...
Sorry, but what about Hardware?
Title: Re: making a wheather station with LCD AND WEB interface
Post by: attila on May 08, 2007, 08:41:51 AM
Here is the schematic. SD-Card uses the MSSP hardware in SPI mode, so you have to remove the EEPROM! The card is runing from 3.3V, so you need a regulator as well.

The hardware is based on Microchip's PICtail for SD/MMC card and this one http://www.captain.at/electronics/pic-mmc/
Title: Re: making a wheather station with LCD AND WEB interface
Post by: OmarZ on May 08, 2007, 09:43:28 AM
Thanks.
I upload file here.
Title: Re: making a wheather station with LCD AND WEB interface
Post by: attila on May 08, 2007, 10:07:15 AM
Sorry, somehow the attachment is missing
Title: Re: making a wheather station with LCD AND WEB interface
Post by: grognut on May 10, 2007, 05:04:24 AM
Hi Attila,
From a previous posting I understand that you are using a MC3208 as and ADC. I'm having problems with it. I'm using it without an input buffer.
The same input cct worked on on the Ain0 of the processor so I don't think it's a source impedance problem.
All the voltages are as expected but my readings jump. Some times they are correct for a few readings but then change. Sometimes they are all over the place.

It could be the SPI software because sometimes I get greater than 10-bit result although I mask the returned data.
Or it could be a speed problem. I've added NOPs to slow the clocking down but without successl.
Did you experience any problems?
What SPI code did you use?

Regards#
Grognut
Title: Re: making a wheather station with LCD AND WEB interface
Post by: grognut on May 11, 2007, 05:19:01 AM
Hi Attila,

I've fouind the problem. My MC3208 was duff. I put in a MC3204, one wiring mod and it works. Need to get another MC3208.

Thanks
Grognut
Title: Re: making a wheather station with LCD AND WEB interface
Post by: attila on May 11, 2007, 12:27:13 PM
Hello grognut!

I am using the MSSP hardware in the PIC to communicate with the A/D and using routines from Microchip's software library.
Here is my source code for it. It is very simple.

Regards,
Attila.

Title: Re: making a wheather station with LCD AND WEB interface
Post by: modtro2 on May 11, 2007, 01:53:43 PM
Hi All

Just for info, the latest SBC65EC (and soon also SBC68EC) boards have a Micro Match connector. So, you can connect our serial LCD2S range of displays directly to it. The LCD2S also has a keyboard encoder. We will also very soon (in about a week) be receiving 12 and 16 button keypads with cables for connecting up to the LCD2S displays, and cables for the LCD2S. It will be possible having a displays, keypad and some I/Os all via the serial Micro Match connector. I have attached a photo of the new SBC65EC. Actually all SBC65EC boards shipped now are already the new Rev.3 ones, just have to still update the documentation.
Title: Re: making a wheather station with LCD AND WEB interface
Post by: OmarZ on May 13, 2007, 05:31:50 AM
Very nice..
Some time ago I was asking something about a case/chassis specific for LCD2S. Any news?

http://forum.modtronix.com/index.php?topic=633.0
Title: Re: making a wheather station with LCD AND WEB interface
Post by: grognut on May 14, 2007, 02:01:13 PM
Hi Attila,
Thank for the info on using the MC3208. I tried these routines and everything fell apart.  After some digging I found out that the default port for the MChip SPI is MSSP1 which uses the same pins as the I2C for the EEPROM so I guess this is why it fell apart.

I also read your thought inspiring info on using SD ram.

Have you removed the use of the EEPROM and use MSSP 1 for the ADC and SD ram?

Regards
Grognut
Title: Re: making a wheather station with LCD AND WEB interface
Post by: OmarZ on May 14, 2007, 10:39:39 PM
i think yes....
Quote
Here is the schematic. SD-Card uses the MSSP hardware in SPI mode, so you have to remove the EEPROM! The card is runing from 3.3V, so you need a regulator as well.
http://forum.modtronix.com/index.php?topic=64.msg1977#msg1977
Title: Re: making a wheather station with LCD AND WEB interface
Post by: attila on May 15, 2007, 02:22:52 AM
Hello!

If you are using SBC68 board, then yes, you have to remove EEPROM, since it is using I2C bus and not SPI. If you have SBC65 board, then you can use MSSP1 for EEPROM and MSSP2 for SPI (SD-Card and ADC) bus.

Title: Re: making a wheather station with LCD AND WEB interface
Post by: grognut on May 16, 2007, 03:36:50 PM
Hi,

Thanks for your help guys.
I know which way to go now. I'm going to add 2*256K eeprom (M'chip samples) to the I2C buss (MCCP1) and use MCCP2 for ADC and FRAM. I will use the FRAM to store pointers to the records in the eeprom and log recent data. When the fram is filled, transfer the data to the eeprom to minimise eeprom writes
I've also received the AAG weather station. SK-Pang do a 1-wire interface which aslo gives me somewhere to solder my Eproms. The only real problem for me is that is won't fit my Modtronix enclosure with the PT32E.

Anyone seen a DS2482-100 in a DIL package?

Regards
grognut

Title: Re: making a wheather station with LCD AND WEB interface
Post by: sk_uk on May 17, 2007, 11:02:49 AM
The DS2482-100 is only available in SOIC package.

The 1-Wire Bust Master also has a battery back RTC
http://www.skpang.co.uk/catalog/product_info.php?cPath=33_35&products_id=136

(http://www.skpang.co.uk/catalog/images/modtronix/IOI2C-PWM-1W/OW-SBC65EC.jpg)
Title: Re: making a wheather station with LCD AND WEB interface
Post by: attila on May 29, 2007, 11:47:19 PM
Hello!

Can anybody knows how to make an over voltage protection on data lines (on serial port) from lightning? There was a big storm and after a big lightning, my modtronix board died ( the LED is still blinking, but the ethernet and the serial connection does not work). I think it caused by an over voltage on the serial lines, because of the power regulator, which supplied the outdoor sensor burned down. (also all of my equipment, which was connected to the board went wrong, switcher, ethernet card in the computer).

So I need  to do some good protection on the incoming lines, but do not know how.

Grognut: take care about the protection, if you will use wired sensors! Not just from the direct hit, the indirect can cause lots of damages as well.

Anyway, I just ordered a new SBC65EC board, I hope it will arrive soon.

Title: Re: making a wheather station with LCD AND WEB interface
Post by: grognut on May 30, 2007, 01:56:47 PM
Hi attila,

Thanks for the warning.

I was intending to put the AAG weather station on a pole above my roofline. I'll have to lookup protection as well. There may be info on the Dallas weather instrument forum. I guess those guys must have suffered similar problems.

regards
Grognut.
Title: Re: making a wheather station with LCD AND WEB interface
Post by: attila on June 10, 2007, 01:09:35 AM
Greetings to every body!


I have my new SBC65EC board two days ago, and since that I am not able to implement my code from SBC68EC to the new one.   I have no idea why.  :oops:  :? ???
According to the schematics the two board are identical, except the microcontroller. Is there any other differences between the two boards?

The main problem is the MSSP hardware does not work in SPI mode at all, and on the serial communication I have lots of corrupted characters, when I am accessing the web server, or just randomly.

The same code worked on SBC68EC without a problem, but not on SBC65EC.

Here is my code what I use for serial communication.
I have a sensor which transmits datas with 9 bits length and an LCD display which received serial data from the board (also with 9 bits9 to display all infos. All is working at 4800 bps speed.

Code: [Select]
/**
 * @brief           Interrupt driven Serial receive and transmit handler.
 * @file            serint.h
 * @author          <a href="www.modtronix.com">Modtronix Engineering</a>
 * @dependencies    -
 * @compiler        MPLAB C18 v2.10 or higher <br>
 *                  HITECH PICC-18 V8.35PL3 or higher
 * @ingroup         mod_sys_serint
 *
 *********************************************************************/

 /*********************************************************************
 * Software License Agreement
 *
 * The software supplied herewith is owned by Modtronix Engineering, and is
 * protected under applicable copyright laws. The software supplied herewith is
 * intended and supplied to you, the Company customer, for use solely and
 * exclusively on products manufactured by Modtronix Engineering. The code may
 * be modified and can be used free of charge for commercial and non commercial
 * applications. All rights are reserved. Any use in violation of the foregoing
 * restrictions may subject the user to criminal sanctions under applicable laws,
 * as well as to civil liability for the breach of the terms and conditions of this license.
 *
 * THIS SOFTWARE IS PROVIDED IN AN 'AS IS' CONDITION. NO WARRANTIES, WHETHER EXPRESS,
 * IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE
 * COMPANY SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR
 * CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
 **********************************************************************
 * File History
 *
 * 2005-09-01, David (DH):
 *    - Created documentation for existing code
 *********************************************************************/

#define THIS_IS_SERINT

#include "projdefs.h"
#include "serint.h"
#include "user\rs5c372.h"
#include "user\sdcard.h"

//Transmit buffer - contains data that has to be transmitted
static BYTE txBuf[SER_TXBUF_SIZE];
static BYTE idxTxbufGet;   //get index

//Receive buffer - contains received data
static BYTE rxBuf[SER_RXBUF_SIZE];
static BYTE idxSerRxbufGet;   //get index
static BYTE idxSerRxbufPut;   //put index

/**
 * Initialise the serint module. After calling this function, the serEnable() function must be
 * called to enable the serial port.
 */
void serInit(void)
{
    //Set transmit buffer to empty
    idxTxbufGet = 0;

    //Set receive buffer to empty
    idxSerRxbufGet = 0;
    idxSerRxbufPut = 0;

TRISCbits.TRISC6 = 1;
TRISCbits.TRISC7 = 1;

PORTCbits.RC6 = 1;
PORTCbits.RC7 = 1;

BAUDCON1bits.BRG16 = 0;      // 16-bit baud rate register enable bit
BAUDCON1bits.ABDEN = 0;      // Auto-Baud detect bit

    SPBRG1 = SPBRG_VAL;         // Set BAUD rate

TXSTA1bits.TX9 = 1; // 9 bit transmission enable bit
TXSTA1bits.TXEN = 1; // transmit enable bit
TXSTA1bits.SYNC = 0;      // EUSART mode select bit, 0 - async, 1 - sync
TXSTA1bits.SENDB = 0;      // send break character
TXSTA1bits.BRGH = 0;      // high baud rate select bit
TXSTA1bits.TX9D = 0;      // 9th bit of transmit data

RCSTA1bits.CREN = 1;      // Contious recive enable bit
RCSTA1bits.ADDEN = 1;      // Address detect enable bit
RCSTA1bits.RX9 = 1;


    //Interrupts
PIE1bits.RC1IE = 0;   //Disable USART Receive interrupt
PIE1bits.TX1IE = 0;   //Disable USART Transmit interrupt - is only enabled once a TXion is started

PIE3bits.RC2IE = 0;
PIE3bits.TX2IE = 0;

RCSTA1bits.SPEN = 1;
}


/**
 * Enables the serial port AND . Can only be called after serInit() has been called.
 */
void serEnable(void) {
    //Interrupts
   
PIE1bits.RC1IE = 0;   //Enable USART Receive interrupt
PIE1bits.TX1IE = 0;   //Disable USART Transmit interrupt - is only enabled once a TXion is started
}


/**
 * Receive ISR function
 */
void serRxIsr(void) {
    //Check for "overun error" (OERR bit 1) or "Framming Error" (FERR bit 2).

if (PIR1bits.RC1IF){

RCSTA1bits.ADDEN = 0;
    if (RCSTA1 & 0x06)
    {
        RCSTA1bits.CREN = 0;
        RCSTA1bits.CREN = 1;
    }

// if (RCSTA1bits.RX9D) idxSerRxbufPut = 0;

if (idxSerRxbufPut == 0) {
rxBuf[idxSerRxbufPut] = RCREG1;
idxSerRxbufPut++;
}
else {
if (idxSerRxbufPut < 3) {
rxBuf[idxSerRxbufPut] = RCREG1;
idxSerRxbufPut++;
}
else {
rxBuf[idxSerRxbufPut] = RCREG1;
Adc.Word_Val[ADC_T_OUT].v[0] = rxBuf[2];
Adc.Word_Val[ADC_T_OUT].v[1] = rxBuf[1];
idxSerRxbufPut = 0;
RCSTA1bits.ADDEN = 1;
}
}
}
}


/**
 * Transmit ISR function. This function should be called from the ISR if "(TXIF && TXIE)" evaluates to true.
 */
void serTxIsr(void)
{
    //Transmit next byte contained in transmit buffer. If whole buffer has been transmitted, disable
    //transmit interrupts.

//     PIE1_TXIE = 0;   //Disable USART Transmit interrupt when nothing more to TX
}

void serTask(void)
{
serRxIsr();

if (PIR1bits.TX1IF)
{
if (idxTxbufGet == 0)
{
TXSTA1bits.TX9D = 1;
TXREG1 = 0;
}
else
{
TXSTA1bits.TX9D = 0;

if (idxTxbufGet == 1)
TXREG1 = 0;
else
{
if (idxTxbufGet <= (T_Year + 2))
/* if (idxTxbufGet == (T_Year + 2)) TXREG = sdcError;
else */TXREG1 = DateTime[idxTxbufGet - 2];
else
TXREG1 = Adc.Byte[T_Year + 2 + 10 - idxTxbufGet];
}
}
idxTxbufGet++;
if (idxTxbufGet > T_Year + 12) idxTxbufGet = 0;
}
}


I am calling "serTask()" from the main loop, not from the ISR.
What is wrong with this code? Why the transmitted and the received characters and corrupted?  :?  :-( :? :-( :?

Thanks,
Attila.
Title: Re: making a wheather station with LCD AND WEB interface
Post by: grognut on September 24, 2007, 12:17:50 PM
Hi Attila,

I've been looking at your website http://meteo.homelinux.net/ and I have a few questions.

I don't seem able to change the date on the Archivum page but you can change the Hány napot: value, which I deduce is days. Is this supposed to work?

I assume from one of your previous posts that you are using javascript to generate the graphs on the browser machine using wz_jsgraphics.js. This is what I want to do but could you be kind enough to explain (possible with example code) how you get the data for the graphs to the browser. I can't workout how to populate an array for the javascript.

Regarding you comments on lighning striKes, I believe the "Weather Toys" books has some info on this.

Regards
Grognut
Title: Re: making a wheather station with LCD AND WEB interface
Post by: attila on October 02, 2007, 11:18:06 AM
Hello Grognut!

To draw the graphs with wz_jsgraphics.js (http://www.walterzorn.com/jsgraphics/jsgraphics_e.htm (http://www.walterzorn.com/jsgraphics/jsgraphics_e.htm)) is easy. At the beginning of the page I create an array and filling it up with datas. Then just draw the graph from the array. The source code is in the zip file (archive.htm, httpexec.c, httpexec.h). To fill up the array I have tried a "for loop", but somehow it does not works, it filled up the whole array with same values.

The date selection is not implemented yet on the webserver side. I have to write a simple search algorithm, but I had no time for that. Maybe later. You can select only, how many days you want to go back from now (1..30 days, yes you are right "Hány napot" means "How many days").

Thanks your comment on lightning, now I am using gas-discharge tubes, transient voltage suppressors zener diodes and good earth. So far I had no more trouble with lightning.


Best regards,
Attila.


Title: Re: making a wheather station with LCD AND WEB interface
Post by: grognut on October 02, 2007, 11:54:51 AM
Hello Attila,

Thank you for your information. It has helped me greatly.
I am currently sorting the code to interface to the Sd card. I'm using a software SPI interface which has my ADC's on and because of the 3.3->5v I've had to read the data on another line.
Because of other parts of the application (TCP/IP etc) I'm having to sort the ram usage. I've modified SK Pang's 1-wire routines and found that there is a 256 byte array in ram for CRC lookup. I've just moved this into the ROM.
Also for some reason the linker was leaving a 256 block unused. I just sorted this now (as I type) and should be trying the SD Card later this evening.
In terms of getting the data into the JS script the way you are doing it was one way I had considered. Another way was to use C to write a Jscript file into the server page eeprom as the data was logged. I think I'm going to use your method.
The way I'm organising my data in the SD card will be in order so if you know the date/time the first record you can calcutate the record position of the date/time that you want to display. This will save searches.

Thanks again. I'll post the url when it is running or at least part running.

Regards
Grognut
Title: Re: making a wheather station with LCD AND WEB interface
Post by: attila on October 03, 2007, 09:20:12 AM
Hi Grognut!

You are welcome, I am happy if you can use something from my code. Yes, post you url when it will be ready, pls, I am interested what you have done.

For SD-Card and ADC I am using the same SPI lines (hardware SPI). I have no problem with the level conversion (5V ADC and 3.3V SD works fine from same lines).

As you can see, I am using 1-wire network as well, but the routines not implemented on web-server side, I am using one more PIC to handle 1-wire and sending data on RS-485 network (SK Pang's board contains too many things).

With date/time organization my problem is: what is you loose power, then you will miss to store some data. I this case you cannot calculate the required position later.

Best regards,
Attila.

Title: Re: making a wheather station with LCD AND WEB interface
Post by: grognut on October 04, 2007, 01:55:09 PM
Hi Attila,

I see your point about calculating the position of a record after loss of power. I hadn't thought of that.
After looking at your code I think it would take me a long time to write something similar.
I've also implemented consensus averaging for wind direction. I'll post it soon. At the moment it has stopped working properly since I added the SD card routines.
I have the AAG weather station. It's still inside but some time I'll have to climb on the roof and put it up. Then I'll have to put lightning protection on.

Regards
Grognut.
Title: Re: making a wheather station with LCD AND WEB interface
Post by: grognut on October 23, 2007, 03:59:50 PM
Hi Attila,

I've have the logging working now. I haven't finished what I need to do so it's a bit scruffy.
The web page is at http://weather.dnsdojo.org:8080/ (http://weather.dnsdojo.org:8080/)
Some pages are removed because they are not secure yet.
I have another thought in searching records. If the address of the record is calculated from the unix time stamp. If there was a power fail at any time then the records would still be in the right order and position but some would not contain data. If the record is check summed or crc'ed then an invalid record can be detected.
I've just created a post regarding greater than 64k of web pages. The graphing code seems to take up a large proportion of it and when I add some diagnostics pages it becomes greater than 64k. Are you using the sd flash to store web pages? If so how easy is it to modifiy the code. I fitted a 128K eerpom but I don't think the file system supports it.
Regards
Grognut.
Title: Re: making a wheather station with LCD AND WEB interface
Post by: attila on October 31, 2007, 10:32:24 AM
Hello Grognut!

Your graphs looks nice!  :-).

Search algorithm: as I can understand you, you will calculate form the date and time a number for offset(like Julian date) and will use that number to index the records? It is a good idea, howewer you will lose some SD-Card space. Right now, at each power on (or reprogramming) I am doing a search for the end.

Web pages: If you are using SD-Card for data logging, then it is easy to use it to store web pages as well. I have an old 128MB card which is splited into two parts, one for web pages and config data, one for data logging.You need to modify the routines in fsee.c and fsee.h to read from SD-Card instead of EEPROM. Basically, I am just replaced the reads and writes from EEPROM to SD. (you have to modify some function in helpers.c and ftp.c as well). However after my modification, I cannot use Modtronix software to upload web-pages, but simple ftp program works fine. My source code is attached below. (I am not really good in coding, basically this is my first program in C)

Is the SD-Card works fine for you?

I have a question: do you have a rain gauge from aagelectronica? Mine started to work strangely, when the temperature drops below 9 or 8 °C, it counts continuously. Strange.

Best regards,
Attila.

Title: Re: making a wheather station with LCD AND WEB interface
Post by: grognut on October 31, 2007, 02:56:38 PM
Hi Attila,

Thanks for your comments. They're appreciated.

I want to spent more time making the whole page more attractive but I've run out of web page storage.
I'm using a 512Mb sd flash card and each of my records are 128 bytes I will be storing domestic heating temeratures, fridge and freezer temps as well as environmental values.

Using this sd card gives 4 million minutes of logging (about 7 years) so I'm not worried about losing a few records and their space. Also using the julian date means there will be no need to search for the last record when starting. I use a mini Sd card and soldered the adaptor in so I can change the card at any time. (I'll have to equate the current julian date with the starting point in the new card.)
I've have looked at your code, (it looks good to me) and the problem I have is getting a 512 byte buffer. I use 128 for my data record, 128 bytes for a tcp comms buffer, and another 128 for reading and writing to the sd card so there's now a shortage of ram. I'm still looking for more ram to reclaim but at the moment I can get any more back.

To overcome the issue of writing 512 bytes to the SD card I buffer data in the FRAM. I might try this with the web pages but I think it will slow things down to much.

I'm not using the aag rain gauge currently but I will by the adaptor board some time to fit in the cheap rain gauge I bought recently. It's somewhat ironic that the second day I had the rain gauge I recorded 96mm of rain in less than 16hrs. There was major flooding in my home town and other areas nearby.
One possibility for yours counting continuously is condensation or possibly a bad solder joint. Temperature affects bad joints dramatically.

It would be interesting to know how any others who have contributed to this thread are getting on!!! I feel like we've taken over this thread. :oops:

Best regards
Grognut
Title: Re: making a wheather station with LCD AND WEB interface
Post by: attila on November 02, 2007, 10:01:54 AM
Hello!

Yes, it would be good to know and see, how the others progressed!

Can I ask you which board are you using? With SBC65 I still have 559 bytes available in RAM (3376 used, 3935 total). You can use one RAM buffer for data read/write and web-page read/write. Sorry to ask, but how are you using 128 bytes buffer for SD writing? According to SD-Card specifications in SPI mode the only valid block length for write is 512 bytes.

1-wire: I found an interesting site: http://home.hetnet.nl/~thomas_7/1Wire/1-WireIOPort.html (http://home.hetnet.nl/~thomas_7/1Wire/1-WireIOPort.html)
http://home.hetnet.nl/~thomas_7/1Wire/1wire_isolating.html (http://home.hetnet.nl/~thomas_7/1Wire/1wire_isolating.html)

Regards
Attila.
Title: Re: making a wheather station with LCD AND WEB interface
Post by: grognut on November 02, 2007, 11:54:43 AM
Hi Attila,
I'm using the SBC65.
If you have plenty of ram left I'll have to start digging through the map file to see where it's gone. It could be the linker script. I changed it slightly because I was having problems finding ram. I'm using the 306 server code I don't know if this uses more ram or not.
Another thing I find is that I'm up to 64K of code which seems excessive and when I go over the 64k boundary it becomes unreliable.


I'm using the fram to buffer 512 bytes of data and grabbing it in 128 byte blocks and writing to the SD card in 4 blocks. I thing it makes it slow because of the 2 serial accesses.

Best regards
Grognut
Title: Re: making a wheather station with LCD AND WEB interface
Post by: grognut on January 09, 2008, 04:50:45 AM
Hi Attila,

I've got the webserver using the SD card to serve pages. Thankyou for your help.

I only implement the file system part and I can still use the modtronix loader to upload web pages which is kinda handy.
I was still short of ram to be able to have a file system buffer and a logged data buffer. BUT as I write this i realise that I don't need 2 x 512 but 512 and enough ram for the log buffer.

Now I need to get my humidity sensor working and improve the page look.

Cheers
Grognut
Title: Re: making a wheather station with LCD AND WEB interface
Post by: Danchoi-955 on January 10, 2008, 12:43:58 PM
The FSEE file system only allows for maximum of 16Mbyte addressing due to the 24-bit address space used in the FAT.  How have you guys over come this if you are using SD cards that are over 16Mbyte?
Title: Re: making a wheather station with LCD AND WEB interface
Post by: attila on January 13, 2008, 04:01:54 AM
Hello Grognut!

I am happy, if my help was useful for you  :-). In the meantime, I am wrote the search algorithm to find any date in the logged data.

Danchoi-995: I am addressing SD Card directly for data logging, and using FSEE only for web page storage.

Best regards,
Attila.
Title: Re: making a wheather station with LCD AND WEB interface
Post by: mattp on August 09, 2008, 11:15:35 PM
@Attila RE:reply#38

Thanks for your source code. It seems there is a little bit of work to make it compatible with webserver v3.06.

Regardless, I have found an error that may be important to you;

In your file sdcard.c, you refer to "sdcSectorAddr.w[0].bits.b0" *twice* but overlook "sdcSectorAddr.w[1].bits.b0". It appears you made a mistake when copying and pasting.



SDC_Error sdcSearchRecordEnd(void)
{

...

   sdcSectorAddr.w[1].bits.b1 = 1;
   _b = sdcSectorRead(sdcSectorAddr.Val, (BYTE*)sdc_buffer.data);
   if (sdc_buffer.data[sdcSectorOffset].EOR != RecordEND)
      sdcSectorAddr.w[1].bits.b1 = 0;

      //[THIS NEXT BLOCK SHOULD INFACT REFER TO w[1]....]

   sdcSectorAddr.w[0].bits.b0 = 1;
   _b = sdcSectorRead(sdcSectorAddr.Val, (BYTE*)sdc_buffer.data);
   if (sdc_buffer.data[sdcSectorOffset].EOR != RecordEND)
      sdcSectorAddr.w[0].bits.b0 = 0;

   sdcSectorAddr.w[0].bits.b7 = 1;
   _b = sdcSectorRead(sdcSectorAddr.Val, (BYTE*)sdc_buffer.data);
   if (sdc_buffer.data[sdcSectorOffset].EOR != RecordEND)
      sdcSectorAddr.w[0].bits.b7 = 0;

...


Regards,
Matt P
Title: Re: making a wheather station with LCD AND WEB interface
Post by: Appi on September 09, 2008, 04:41:30 AM
hi,
i'am new in this forum. i orderd the sbc68ec a week ago.
i will be happy if someone can send me the code for this project.
do you have a howto for the implementation of the code ( c code and webpages)?

congratulations for your interestig wheather project.

greetings

remo


 
Title: Re: making a wheather station with LCD AND WEB interface
Post by: mohandino on February 12, 2009, 08:32:07 AM
hi,
i'am new in this forum. i orderd the sbc68ec a week ago.
i will be happy if someone can send me the code for this project.
do you have a howto for the implementation of the code ( c code and webpages)?

congratulations for your interestig wheather project.

greetings

remo


me too !


 
Title: making a wheather station with LCD AND WEB interface
Post by: Aletstero on December 12, 2009, 04:35:57 AM
So ,  what is the theme ?

More like castlevania, resident evil, empire earth, etc ?

I can help you on making the enemies, and level.  And, maybe I can help you in the making of the game.

Ps :  Is the enemy monsters or what ?   and, is this going to be sticks ?