I am resuming the discussion started here:
since this is probably a more appropriate place to continue it.
Basically, I'd like to replace the code in the AAG RS485 Weather Station because the suppliers haven't done a very good job exploiting its potential and they aren't very responsive to communication so they're not likely to improve it on their own. In their defense, they buy it preassembled from a Chinese supplier and they may not have a lot of control over it. Regardless, it's a nice piece of hardware and by definition "I own it" because I can take it apart and reprogram it.
I've spent a little while figuring out the communication protocol and having done so, I have decided it can be improved. As it comes from the supplier, it has a half duplex RS485 transceiver chip for communication but uses a proprietary protocol that doesn't use the standard RS485 slave addressing method or as it is referred to in the Atmega literature, Multi-processor Communication mode (MPCM). I intend to change that as well as some other things that I consider are shortcomings.
It is a descendent of the 1-wire Dallas weather station, which AAG still make. One of the advantages of 1-wire is the ease by which networks of sensors can be wired, typically with cat5 cable. Sometimes when these networks get lengthy or "branchy" they aren't as reliable to communicate with. RS485 solves some of those problems but adds some of its own. For example, it doesn't easily provide a way to utilize existing 1-wire sensors.
It would be nice to be able to extend the 1-wire bus that currently exists inside the weather station (WS). There is a DS18S20 temperature chip inside that is virtually useless for outside temperature because the sealed enclosure heats up to over 140 degrees F on a sunny day. There is a feed-thru right by the chip that I will use to extend the 1-wire buss outside the enclosure. That way it can be used for ambient temperature and what ever other 1-wire sensors one might already have an want to use close to the WS.
I disassembled my WS this morning to try to get an idea just how hard it's going to be to "fix". The PCB is easy to remove with two connectors for communication and power. It's a 4 wire system, all though you wouldn't guess from the RJ45 that AAG connects with. They have +5VDC, +12VDC, and RS485 A and B wired to the connector but only +12VDC and RS485 are used. The logic part of the circuit draws very little current and regulates the +12 to +5 on board with a TO-92 style three terminal regulator. The +12 is used to power the 35 LEDS that one may or may not want to keep. I'm going to forget about the LEDS and I initially intend to reduce the Vcc to 3.3VDC.
The RS485 transceiver is accessible enough to put in a Hi-Z state so that I can initially program the Atmega8L with the Arduino boot loader. Currently, I think that will be the easiest way to start.
I broke the needle tip on my soldering iron so it will be a couple of days before I can start soldering on leads for the USB-serial interface. It has a 5-pin programming header already on the PCB.
As mentioned earlier, the processor is an Atmega8L and the clock is crystal controlled at 3.686MHz. I'll need some guidance about how to handle the initial reprogramming based on this clock speed. I'd like to end up with an 8MHz clock. The crystal is a through-hole.
Coding Badly and Graynomad have given me some good advice about how to proceed and I hope they and others keep doing that!