It became clear to me, that I will be most flexible, if I design my own controller. But I had to decide which components I wanted to include to the controller; components such as power supply, sensors, memory etc. So I created a list of sensors, which I present here:
- Temperature Sensor
- Humidity Sensor
- Real Time Clock (is this a sensor? Let's say yes)
- Rain Sensor
Due to this distribution of sensors around the basement, it was necessary to think about a bus system, or alternatively wireless. The decission came in favor of a bus system. The rationals are listed in one of the posts below, so I will not elaborate. After doing some research and discussions with colleagues, I found a bus system called one wire from Dallas instruments (now Maxim). The one wire bus looked very promissing because:
- the wire needs only one strand (in theory)
- sensors are available, such as the temperature sensor (DS18B20)
- drivers are available, it converts I2C into one wire signals (DS2482S-100)
The one wire driverThe one wire driver DS2482S-100 is the device interface between a master processor and the devices attached on the one wire bus. Unfortunately I realized pretty late that this chip actually implements only the physical layer of the one wire protocol, so there was a lot work left for me to implement the driver software. However this presentation has helped me to implement the driver: one wire overview.
The real time clockI tried to find a real time clock which has a I2C or SPI interface, so it can be connected to an atmel processor. I chose the RV 3029-C2, because it was available from the distributor from where I usually order. This real time clock is convenient, because it has a crystal included and that it can be powered with 5V and 3,3V.
The power supplyI created a couple of circuits before and I always used the LM2575 from National Semiconductors (or Texas Instruments) to generate regulatated 5V. It is a step down regulator and it is supposed to use less power than a linear voltage regulator.
The CAN driversCAN pins from the processor cannot be connected directly to the CAN bus. The signals need to be leveled and there are chips available for this. They are called CAN tranceivers. One widely available chip is the PCA82C250 from NXP. The drawback of this chip is that it can only be powered with 5V. But there are also other chips with the same packaging and pinout which can be powever by 3,3V (e.g. the SN65HVD230D).
The EEPROMThere is persistent memory needed for the data the processor collects, so I tried to find an eeprom with large memory capacity. My distributor had the 24AA1025 available, so I decided to use this one. It can store up to 125kBytes of data, but it needs an extra pin to select the two separate devices on the same chip. The protocol for accessing the chip is I2C.
The USB driverI had to add an interface to access the data from the processor and the eeprom from my laptop. I used a FT232R from FTDI for this purpose. This chip can be connected to the processor via the RS232 interface and it converts the signals to USB. A special driver needs to installed on the laptop to access the chip. I used windows terminal for this purpose.
The processorAs mentioned above, I used to work with atmel processors before and it came natural that I choose an atmel processor for this project again. There is one atmel processor which has a CAN interface which is the AT90CAN128. It has 128kByte flash size. The gcc compiler for this processor is available here, and jtag devices for program download is widely available.
The one wire controllerBelow a picture of my one wire controller. I used eagle from CADSoft to create the schematics and the layout. A PCB manufacturer created the board for me. Like always I created layout mistakes, which I had to correct somehow, such as I underestimated the package size of the eeprom. Somehow I was able to solder it on the board anyway.
Final WordsBefore I would create such a layout again, I would do some research if I could use one of the Arduino boards. I am not sure if these boards were available during the time I created my cicuit, however they became pretty popular by now.
I would probably completely take out the USB port, because it became quite useless, since I access the one wire controller from the raspberry pi through CAN. For debugging it was very useful, but I could do the same now through CAN as well.