Author Topic: Design weather station (irrigation controller/home automation,... Z80 based)  (Read 4635 times)

0 Members and 1 Guest are viewing this topic.

Offline BendbaTopic starter

  • Regular Contributor
  • *
  • Posts: 216
  • Country: au
Hi,

I'm at the early stage of designing my own weather station (multi zone) / irrigation controller / home automation built around a Z80A microprocessor (I wanted to make something else than a classic homebrew computer or blinky light box, even though I'll probably do that too as I have 5 of those processors)

I'm testing a lot of things on breadboard at the moment.

The way I imagine it is a backplane based system so I can expand as I develop it.
I would like (one day, eventually, maybe, ...) to implement the following options:

- Nixie tube clock/calendar (remote wired display with a real time clock chip on the processor board, I have a couple of older 8 bit parallel chip, just need to graft a new battery on them. And I have a box of IN-14 nixie tubes coming) I might add an infrared timer/counter/alarm clock to it.

- Multi-zone weather station (At this point, I'm prototyping around an Atmega328 controller with arduino for the remote sensors, 433MHz serial link)

- Main display on either CRT screen (I'd try to find an uncommon older display) or other (I'm having a try at the 7" Nextion touchscreen but might keep that display for another project. I also have a nice 7" color plasma display from a scrapped vital signs monitor, I have to work out how to get the boost converter power supply to work)

- Home automation controller (lights, heating/cooling, presence simulator,...) for that, I don't know yet weather to have a big interface controlled entirely by the processor or having a board with its own processor that interfaces with the main unit.

- Internet connection for telemetry and/or remote control (I have both dial-up and adsl at home. GSM/GPRS/3G are also available but I've never tried that, ... yet)

- Data logging on IDE drive (if not, SD or compact flash card)

- Bidirectional remote control  (rf, probably on the same 433MHz serial link as the remote sensors of the weather station)

- Whatever else I'll think of.


I'll have a lot of questions obviously. If anyone feels like taking time to give some answers, or ideas, they would be welcome.

First question I have is regarding the humidity sensing. Is there any sensor that stands out amongst the dodgy ones you can find on ebay? I'd rather buy a sensor chip then one of those pre made sensor board.

Thanks for your time.
Stop dreaming your life, start leaving your dreams.
 

Offline capt bullshot

  • Super Contributor
  • ***
  • Posts: 3033
  • Country: de
    • Mostly useless stuff, but nice to have: wunderkis.de
IMO still the best available humidity sensors are the ones from Sensirion, like the SHT15 etc.
I'm running some home (not so) automation (more sensor data acquistion) for many years now, these sensors are proven in use for me.
A litte description of the system: http://wunderkis.de/datenkrake/index.html

BTW
never use SD cards for data that you want to keep alive (SD cards and USB thumb drives are the most unrealiable data storage devices today)

I'm using a server based on a Intel Atom dev board (Minnowboard) and a SATA SSD as the primary data storage system (consuming about 5W), and another small server using a Banana Pi board, also attached to a SATA SSD as a auxiliary and GPS disciplined NTP server (just because it was convenient to locate this box in another floor)

To record and visualize the data, I use the RRDTool collection as the backend
Safety devices hinder evolution
 

Offline BendbaTopic starter

  • Regular Contributor
  • *
  • Posts: 216
  • Country: au
Hi capt bullshot,

Thanks for the advise.  I was contemplating a couple of others from the same brand. Do you gave any idea what the big difference between a $4 sensor and a $40 sensor? Is it in the calibration? The linearity? The resistance to contaminations?

Also,with that sensor, do you need to use a memory consuming look up table to convert the reading to the RH value or just an algorithm?

About the SD card, that's a good point. I lost a few files on sd cards and usb sticks. What about compact flash? Are they more reliable? I don't really feel like trying to interface a Sata drive yet. That's why I'd go with IDE/ATA (something like one backup every 10 minutes in a CSV file.
Stop dreaming your life, start leaving your dreams.
 

Offline capt bullshot

  • Super Contributor
  • ***
  • Posts: 3033
  • Country: de
    • Mostly useless stuff, but nice to have: wunderkis.de
Regarding the sensors, AFAIR the sensirion ones were quite the first to offer a sensor of such outstanding precision with a digital interface (there were some quite good analog ones from Honeywell), which justified the rather high price tag then. As time passes by, Sensirion has some successors using a more standard interface (like real I2C), don't know the price tag but expect the same accuracy. Other well known semiconductor manufacturers have now similar specced sensors at lower price tags, I think (like the STM HTS221). The "knack" in humidity sensors is the actual sensor material, I've seen simple and cheap sensors that lost all of their accuracy over time because of material detoriation.

The SHT15 sensor doesn't need lookup tables to calculate the results, the "digital read out" to "measured value" algorithm is documented in their application notes. It takes some (float, should be transferrable to integer) calculations. Typically you'll have 512 Bytes of lookup to do some CRC calculation for their protocol.

Yes, a CF is supposed to be way more reliable than the average SD / USB thumb drive. I had a (quite small) linux server running on a 32G CF card for many years without failure.

Edit:
Some time ago, I was able to "recover" one of my SHT15 sensors from totally "broken" state (this one was submerged into water by accident and afterwards contaminated by electrolytic oozes) to a "very near to normal" state by thoroughly cleaning (pushing alcohol and afterwards DI water with a syringe through the sensor hole) and baking the sensor. So much for their reiliability.
« Last Edit: March 30, 2017, 01:47:14 pm by capt bullshot »
Safety devices hinder evolution
 

Offline picandmix

  • Frequent Contributor
  • **
  • Posts: 395
  • Country: gb
Agree with BS that the Sensiron sensors are good but rather expensive and like any devices easy to blow if you make a wrong connection etc.

Is your need for a humidity sensors just for  weather monitoring or for some specialised humidity controlled enviroment ?

Perhaps while you are playing around and learning  with all your various devices you could use the much cheaper ebay ones like the DHT11 or DHT22 which give reasonable readings, again like the SHT11 range the DHTs respond with a digital output.

The catch is that for Arduino users they have ready made libraries available both devices but your your Z80A expect you will have to code their custom serial interface yourself,  it is do-able, did it myself in pic assembler code.
 

Offline BendbaTopic starter

  • Regular Contributor
  • *
  • Posts: 216
  • Country: au
Hi,

capt bullsho,
I went through the page of your project, very interesting. I like the idea of using the solar panel as a light sensor.

Quote
The SHT15 sensorThe SHT15 sensor doesn't need lookup tables to calculate the results, the "digital read out" to "measured value" algorithm is documented in their application notes. It takes some (float, should be transferrable to integer) calculations. Typically you'll have 512 Bytes of lookup to do some CRC calculation for their protocol.

That's good news. It's the only thing I'm not too sure how to handle yet, the memory, being only a 16 bit address bus.

One thing I've considered (is probably a bad/crazy idea) is to have something like 32k of shared ROM/RAM and then, each card would have the other 32k with the specific software and use an I/O address to select which card is running and just cycle through them as needed. That way, I could have up to 256 cards theoretically and not have to rewrite the whole software every time I implement a new one.

The catch is that for Arduino users they have ready made libraries available both devices but your your Z80A expect you will have to code their custom serial interface yourself,  it is do-able, did it myself in pic assembler code.

I know, that's why I plan on using arduino for the external peripherals, one processor to code for in assembly is enough to start with (I know there are some C compilers for the Z80 but I'm not into that, yet)

I guess your argument about the humidity sensors is a good one too. I probably should do the first prototyping with a cheap one and then use the good one in the final design.

This might be a silly question but, are the sensirion analog humidity sensors any good? I just figured that for the sensor measuring inside the house, it would be more fun to build a analog/parallel interface to connect one directly on the bus than having to use a I2C/UART interface as it seems that most those sensors use I2C
Stop dreaming your life, start leaving your dreams.
 

Offline Vtile

  • Super Contributor
  • ***
  • Posts: 1146
  • Country: fi
  • Ingineer
Isn't there a lots of tools from CP/M era for the Zilog Z80? Also isn't most of the older TI-calculators are using it. Then there is some Forth implementations for it (I'm on both Forth and a real fever atm. sry.) But I'm noob, I might mix up something now.
« Last Edit: March 30, 2017, 11:27:45 pm by Vtile »
 

Offline BendbaTopic starter

  • Regular Contributor
  • *
  • Posts: 216
  • Country: au
Hi Vtile,

CP/M is an option indeed but to this point, I've experimented a fair bit in assembly, that's why I am going down that road. I'm probably going to consider CP/M for a more "normal" Z80 homebrew computer one day.


Edit: actually, cp/m is only one of the many z80 system I wouldn't mind trying, there are "only" dozens of them out there, and people writing new ones every day. I'm certainly not trying to reinvent the wheel.
« Last Edit: March 30, 2017, 11:39:38 pm by Bendba »
Stop dreaming your life, start leaving your dreams.
 

Offline Vtile

  • Super Contributor
  • ***
  • Posts: 1146
  • Country: fi
  • Ingineer
Ok, you are on the assy path of self development. Nice project, I wish you have lots of fun with it.  ;D 

Hi Vtile,

CP/M is an option indeed but to this point, I've experimented a fair bit in assembly, that's why I am going down that road. I'm probably going to consider CP/M for a more "normal" Z80 homebrew computer one day.


Edit: actually, cp/m is only one of the many z80 system I wouldn't mind trying, there are "only" dozens of them out there, and people writing new ones every day. I'm certainly not trying to reinvent the wheel.
 

Offline BendbaTopic starter

  • Regular Contributor
  • *
  • Posts: 216
  • Country: au
Yes, I know, not the most efficient way to do it but at this point, it sounds easier to work on something that I sort of know than learning something new
Stop dreaming your life, start leaving your dreams.
 

Offline capt bullshot

  • Super Contributor
  • ***
  • Posts: 3033
  • Country: de
    • Mostly useless stuff, but nice to have: wunderkis.de

That's good news. It's the only thing I'm not too sure how to handle yet, the memory, being only a 16 bit address bus.

One thing I've considered (is probably a bad/crazy idea) is to have something like 32k of shared ROM/RAM and then, each card would have the other 32k with the specific software and use an I/O address to select which card is running and just cycle through them as needed. That way, I could have up to 256 cards theoretically and not have to rewrite the whole software every time I implement a new one.


That ain't a bad idea. I former times, things were done exactly that way. The Apple ][ computer had a few expansion slot, each one providing access to 256 Bytes of ROM, and another (1K or 2K) range that was switched semi automatically to that slot whose 256B range was accessed last. In one of my former projects (a ROM disk expansion card for that Apple ][ computer) I had then some 128k or 256k of EPROM mapped into that range. That amount of memory was quite comparable to a 8G Flash card nowadays (in terms of what you could do with it). The ROM disk was able to boot CP/M (to the Z80 expansion card) and provide quite a few of often used programs (like Turbo Pascal).
And then I had somewhen a 1.2MB PC floppy disk drive attached to the very same Apple computer, that was just like large HD today.
Safety devices hinder evolution
 

Offline BendbaTopic starter

  • Regular Contributor
  • *
  • Posts: 216
  • Country: au

That ain't a bad idea. I former times, things were done exactly that way. The Apple ][ computer had a few expansion slot, each one providing access to 256 Bytes of ROM, and another (1K or 2K) range that was switched semi automatically to that slot whose 256B range was accessed last. In one of my former projects (a ROM disk expansion card for that Apple ][ computer) I had then some 128k or 256k of EPROM mapped into that range. That amount of memory was quite comparable to a 8G Flash card nowadays (in terms of what you could do with it). The ROM disk was able to boot CP/M (to the Z80 expansion card) and provide quite a few of often used programs (like Turbo Pascal).
And then I had somewhen a 1.2MB PC floppy disk drive attached to the very same Apple computer, that was just like large HD today.


There you go, I didn't know it was commonly done with that much memory.
Using a floppy drive for data storage could be a fun thing to do. It might be hard to get some floppy discs in good enough a condition to still be reliable (though I've never lost any data on 5"1/4 floppy, lost plenty on 3"1/2)



There is another idea that might be interesting to experiment with, using a couple of 27c1001 eprom's in parallel to create a 17 bit in 16 bit out PLA equivalent to replace all the combinational logic, so I can modify it at will. But then, I expect to run into some timing issues, unless I can find a couple of faster ones (all the eprom's I have are 90 or 120ns)


I also ordered a couple of DHT22 and a SHT15 humidity sensors, as well as a barometric sensor. Just gotta wait for them now.

The next big thing will be to decide of a backplane design, decent backplane connectors are relatively expensive.
And the power supply, or supplies, as I will need a few different voltages and will need to keep the high voltage for the nixie tubes away from the main board.

I'm trying to find some decent batteries for the remote sensors to make them solar powered. But it seems to be very hard to find something legit online. (I'm thinking something like 3.7 or 7.4 li-ion, between 10 and 30 Wh (preferably those pouch ones, they are less space hungry)
« Last Edit: March 31, 2017, 08:37:24 pm by Bendba »
Stop dreaming your life, start leaving your dreams.
 

Offline BendbaTopic starter

  • Regular Contributor
  • *
  • Posts: 216
  • Country: au
Hi,

Here are a couple more questions,

1. Can I buy LiPo batteries online? I know ebay batteries are not good quality but I want to buy just one to use for my prototyping board before investing in a decent definitive battery. Do they allow shipping from overseas? I know they don't like them on planes anymore (thanks to Samsung? )

2. Bringing back the idea of using an eprom to replace the logic circuits, I'm planning on running at 4MHz, that's a 250ns clock cycle and according to the manual's timing graphs, there is always at least a full clock cycle between a change of state and the processor expecting a response.
I have a couple of M27C1001-12 which have a maximum 120ns reaction time. So if i have to read an eprom after the logic reacts, that gives me a total reaction time of maximum 240ns, which is less than 250ns but there would be some bus capacitance to deal with I guess. Is that going to work or am I pushing a bit? I guess I could bring the clock down to around 3MHz if needed, or use some proper ttl logic.

3. Does anyone have some decent connectors to recommend for the backplane?

Thanks
Stop dreaming your life, start leaving your dreams.
 

Offline ebclr

  • Super Contributor
  • ***
  • Posts: 2331
  • Country: 00
KISS.... :popcorn:


 


Offline ebclr

  • Super Contributor
  • ***
  • Posts: 2331
  • Country: 00
If you really insist on that z80 obsolet thing

This may help

https://sourceforge.net/projects/z80-pascal/

And for the more educational ideal

https://opencores.org/project,a-z80
« Last Edit: April 02, 2017, 02:15:19 pm by ebclr »
 

Offline BendbaTopic starter

  • Regular Contributor
  • *
  • Posts: 216
  • Country: au
Hi ebclr,

Thank you very much for the information. Those ESP modules are certainly awesome, I actually do have a couple of similar modules to play with. Though, calling a Z80 project nonsense is a wee bit offensive.
That weather station from aliexpress would certainly be cheaper and up faster but would take away all the fun for me.
The Z80 on an FPGA sounds like a really good project, I'll definitely read more about that one.

I know I'm stubborn but I like retro techs I want to learn more about and master it before concentrating on newer techs.
Stop dreaming your life, start leaving your dreams.
 

Offline BendbaTopic starter

  • Regular Contributor
  • *
  • Posts: 216
  • Country: au
Hi,

I'm back, still working on the project, I have just been away for a few weeks (work)
I spent a fair bit of time regrouping all the electronic stuff I have, which is a lot. I'll need a room just for that,... one day. In the meantime, the lounge-room floor is my work-zone.
I was also waiting for some parts I purchased on Ebay to be delivered.

I think I got most of the bit and pieces I want for that big project. So, here are a few photos (I tried to structure by type of functions) of what I have found/salvaged/bought. Most of them, I have more than one item, only taking one out for the photos.




Power supply:

A few battery cells from a dead laptop battery.
A lipo cell from Ebay, sold as a 5000mAh, probably more like 2500 but for $17, not too bad.
Solar cell to charge remote devices.
USB plugs, will probably come in handy.
The red board is a 3.7V to 5V boost converter.
The blue one is a charge controller circuit.
Not on the photo: multiple main power supplies, chargers



Inputs:

Switches, lot of switches, dip switches, push buttons, toggle,...
Key switch.
A nice rotary encoder from a video edition console. It is an optical encoder, has a 300° rotation by default but if you push on the knob, you get infinite rotation and when you push again, it goes back to the limited rotation but is automatically reset to centre. Unfortunately, I only have two of them.
A RGB scanner bar, pretty easy to interface.
Moisture sensors, one salvaged from a printer, the white ones are purchased. I ended up going with the DHT22
Under that, a atmospheric pressure sensor and an accelerometer.
A RFID reader and cards.
Multiple IR remote.
Beside the accelerometer, a GPS receiver.
Multi-turn potentiometer.
Microphone, composite video camera, AM/FM tuner (SPI interface) and a pressure sensor (I have yet to work out how to interface that one.
On the RFID card: IR receiver, LM35DZ, hall effect sensor, tilt sensor, rotary encoder, the tiny little squares are light sensors out of a rear projection TV - turns out they are actually tiny little photovoltaic cells - , LDR, laser sensor from a CD player.



Processing power:

80386 and 80486
Z80, 6 of them
ADSP-2101 (that one might be out of my league, I just kept it because it was free)
Two 68000's
PIC, Adruino, Picaxe and ESP8266



Memory:

SRAM, DRAM, EPROM's, lot of EPROM's, SD card, in the tube are dual ported RAM (for the video), and just for fun, ferrite cores, and a battery to turn some of the SRAM into non volatile RAM
Real time clock and timers/counters.



Input/output:

Top left is a parallel I/O card with status LED's I use in many projects to simulate situations.
Stepper motors are here because I plan on making the control circuitry able to detect mechanically induced rotation and its direction as well as sensing jamming.
That display is a Nextion 7", touch screen display. I'm not really impressed by the processing speed of the display.
The chip is a Z80 serial I/O chip.
Not on the photo: many ADC/DAC chips, parallel I/O chips, shift registers,...



Communications:

5.8 GHz video transmitter.
True bluetooth transmceiver.
HC-05 bluetooth serial transceiver and Android phone.
Wifi transceiver.
GPS/GPRS/GSM module.
433MHz transmitters/receivers.
The big cards are for the backplane and boards.
IR LED and receiver.



Outputs:

A pretty cool little usage timer based on a mercury coulometer.
A R/2R ladder DAC card I started to make.
Solenoids, motors, servo, laser diodes, RGB LED's, IR LED's, LED 8x8 matrix, 7 segments,...
The black strip is the heater element out of a laser printer.



Displays:

Dekatrons, VFD tubes, Nixie tubes, VFD displays, all easy to interface.



More displays:

The biggest one is a plasma display from a medical vitals monitor, I still try to make it work, it might be dead.
A composite video monitor.
A few Hitachi displays, two of them have a serial interface.
And a few DIL311 displays (I wish I had more of them)



And more:

That's a Russian MC6205 display, still trying to translate the datasheets.



Miscellaneous/forgotten:

Xbox chatpad for the keyboard I'm planing on attaching to the Nextion display to make a tablet-like interface.
Synaptic touch pad, still need to handle the interfacing of that one.
Top left is just a beeping buzzer circuit (I hate beeping things but sometime you need them to alert you of something urgent)
A few opto forks.
Bottom left is a variable base time I use for prototyping.
Bottom right is the scanning mirror from a laser printer, I'd like to make some simple laser raster scan projector for Christmas displays.

Not on the photos: heaps more stuff like lots of logic IC's, enclosures, lots of datasheets and sketches and scribbled schematics,...



The next move is going to be soldering the backplane, the processor board and the main power supply.
« Last Edit: May 18, 2017, 03:12:05 am by Bendba »
Stop dreaming your life, start leaving your dreams.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf