2009-05-24

Solar Cells testing

This Sunday the sky was clear and the Sun strong, so I decided to check some of the solar cells I had in my components box. I have two types from solarbotics (this one and this other one) and other from pagermotors (this one).


All the cells are up to specification although I only tested them on open circuit voltage, it was too hot and too bright to do a test load. I also have no reason to believe the cells won't perform as specified.
I have two ideas for them:
  1. use one or two white bright LEDs and a couple of batteries to build a "light hours" extender for my chili peppers. I haven't decided yet if I'll use a micro-processor or I try to build a fully analog control system. Either way it will be quite complex as it involves two switching power supplies (charge batteries and supply LEDs) and some operation decision. I'll call this project the "Solar-Extender".
  2. revise the Mousebot to include a solar panel and a couple of rechargeable batteries, this one will definitely have a micro controller. It should harvest the sun and charge his batteries and when the sun is out it should hide in the darkest and coolest place of the house. Put some "simulated annealing" when it wake's up or goes to sleep in order to let him fool around and find some better places. This project I'll call the "Solar-Bug".
I hope to finish these two projects before the end of the summer, as from then on either the behavior of both the projects will be pushed to the maximum efficiency as light-hours decrease towards the winter-equinox.

8085 DRAM interface (30 pin SIMM)

After seeing this project on Make (or here) I felt like old DRAMs could have a better use... It is a bit sad that so much technology and development by semiconductor engineers and computer designers goes "wasted" on a light box. The light box looks good, don't get me wrong.. but.. so much engineering wasted in a light box... doesn't look right.
I always thought that using these SIMMs in microprocessor applications would be interesting and with the proper memory management it could be used with old 8 bit microprocessors. The likes of Z80, 8085, 6809, 6502 could go with a simple DRAM interface.
Trying to search for information online or even in books, application notes etc is quite elusive, there are three good sources of information:

  • This one (or here in pdf) is very specific regarding the Z80, and Z180...[...]

  • This one with a PIC processor connected directly to a DRAM chip (source code only).

  • And this one, where a FPGA and a 8051 microcontroller are connected to a 72 pin SIMM.

  • Most of the microprocessor or microcontroller projects online either use one or more large SRAMs (128K,256K and 512K bytes) are these are nowadays readily available.

    Although my projects don't need a large RAM size I wanted to probe the use of old SIMMs with the 8085. The Z80 makes it all a bit more simpler because it has been design to use DRAMs, so at the end of the instruction fetch cycle the RFSH and MREQ signals go low, the problem with this that the instruction fetch cycle is slightly (half cycle) shorter (see here).

    It seems logical the one would try to do the same in a different processor, while the processor is decoding and executing the fetched instruction the DRAM controller preforms a DRAM refresh, this way every instruction fetch a refresh is performed which normally is often enough. Except, in the 8085 case, if the processor is halted. The Z80 solved this problem by still performing instruction fetches during HALT (it executes NOPs). I decided to carry on accepting this problem and do not write any programs that halt to processor unless I want to lose the contents of the DRAM.

    In the 8085 there's no refresh cycle, but at the end of every instruction fetch, during 1 to 3 cycles (depending on the instruction just fetched), the CPU relinquishes the bus, these are called T4,T5 and T6 states (see here). Although a single cycle for refresh might not seem a lot, one could extend the cycle a bit more until ALE goes high, from then on the address on the bus is valid and a normal fetch should be made.

    The 8085 does have an slight advantage when compared to the Z80 (and Z8000), the read signal and write signal (RD and WR) are active for the same time weather in instruction fetch, memory read and or memory write (and even I/O these are extended in the Z80), so there's no need for a early-write signal when using the SIMMs.

    I designed the circuit as a combination of two sequential circuits, one generating RAS, CAS and Address inputs during a normal read/write and instruction fetch (accessing), and another circuit for refreshing the RAM on every instruction fetch (refreshing). During a instruction fetch from a non-selected memory the last cycle is used to do a CAS before RAS refresh, if the fetch is done from the DRAM, the access cycle is extended to do a hidden refresh (toggle of RAS line while CAS is low). When ALE goes high all DRAM access activities stop and the circuit waits for RD or WR to go low to start the RAS/Address Mux/ CAS sequence. I use the X2 output from the 8085 because it is at 2 times the CLK output, therefore it allows faster state switching and a longer memory access time.


    I've designed and assembled the circuit and I'm about to do extensive testing if it really works or not. Here's the schematic of the CAS/RAS generation, the connection to the SIMM is straight forward, the pin-out of a 30-pin SIMM is here, and some of the history of SIMM development is here.


    The 8085 is clocked at 8MHz, and on the oscilloscope RAS appears on top and CAS on the bottom. My only problem has been my EPROM emulator, and I need to do something about that in the future. It is only working in DOS... So now I need to do all the programming in DOS and test the system with the oscilloscope. I'm also using the SOD line to trigger the oscilloscope when the SIM instruction is executed, the current program is the following (beware, 8085 assembly follows):

    .title test_program 0
    .sbttl testing

    .area ram(abs,cseg)

    .org 0x0000
    reset:
    di
    lxi h,0xC000
    lp000:
    mvi a,#0xC0
    sim
    mov a,m
    jmp lp001
    lp001:
    mvi a,#0x40
    sim
    mov m,a
    jmp lp000

    SBC6120 Update

    This weekend I started with the finishing touches to my SBC6120. I found what appears to be a "suitable" casing for the board, a power supply and the disk drive.
    I would like to build inside a 12V and a 5V switching power supply from a 16-24V DC input, this power supply would allow the system to support either common 3.5 inch IDE drives or the smaller 2.5 inch laptop IDE drives (5V only).
    I also need a power switch, a reset switch, access to the status indicators and a DB9 serial port connection.
    For now I'm using a 1.4 inch IBM X40 drive and everything appears to fit. I would rather have a bit more room, but the next available case was too big.
    I haven't gave up on finding the "best"case, but for that I still need to find a suitable power supply, a some nice looking panel switches (ON/OFF and RESET) and the serial connector.
    An old chopping board is not the best background for an electronics project... but then again.. It's what I had at hand..

    Follow up on Balcony garden

    Our vegetables have been growing steadily for the past two weeks. I've been moving some of the sprouts that were born in the yogurt cups to the bigger vases, but now I don't have any more space. On some, instead of removing them from the cup, I just cut the cup bottom and push them into the vase.

    I learned that carrots don't like and should not be moved! No wonder now that they took so long to adapt, on the other hand tomatoes, kale and the celeriac don't seem to bother being moved and are developing nicely.
    On the "battle of the veggies" I seem to be up front in the kale, celeriac and carrots, unfortunately my tomatoes look like little dwarfs compared to Ana's..

    Last week my kale reached some "maturity" and before it became too hot to eat a soup we decided to try doing a caldo-verde.

    We used some of the bigger leaves of our kale to do it, with some "chouriço" and bread, hum ... delicious...

    2009-05-07

    SBC6120 Assembly

    Some time ago I started looking at a strange (in today's terms) old mini-computer PDP-8 from DEC. It is 12bit machine with one accumulator and program counter, further allows one level of indirection, some models had some memory positions that could be accessed with auto increment and others still had memory paging capabilities.
    This mini-computer was so wide-spread that two Integrated Circuit versions of it were produced (IM6100, IM6120) although they came a bit late to a market that progressed beyond the original design.
    The book "The Art of Digital Design - An Introduction to Top-Down Design"from Franklin P. Prosser and David E. Winkel describes how to design your own PDP-8 either using normal logic or using a bit slice components, something I would like to build... both versions... :-)
    But would I also like to test drive the CPU before I build one, the easy solution would be to find a IM6100 and build it in a bread board... During my search I found that Sparetimegizmos (a company in the US) was selling a kit that included the very hard to find chip! The first time I visited the site it said there were no more ICs, a month ago they had new kits available, so I bought one. They also have front panels but the price tag is bit over my budget, but still very interesting. Here are two pictures the original and the "original copy":



    I finished assembly of all the sockets and all the logic ICs, I had some difficulty in finding the IM6402 UART (it is also not cheap), the half-size oscillators, the interface connector and connector that look good on the board, so for now I have a "wrapped version" that I expect to put to work during this week. At least get something on my terminal window :-)
    A great thanks to Bob Amstrong and Sparetimegizmos for having the time to design, build and
    sell the kit.

    2009-05-05

    Munny Software

    Finally I had the time and the patience to write a "clean version" of the Munny code.
    I wanted to use avr-as instead of AVR-Studio, it was much more difficult than what I expected. Information about using avr-as is scarce and I was unable to find an example of an assembler only project for avr-as. The main problem was that when you use preprocessor commands you must use preprocessor comments!
    So remember the following:

    #define ADC_SETTLE -32 /* arround 20ms */ GOOD
    #define ADC_SETTLE -32 ;arround 20ms WRONG

    I'm not a web-wizard but I wanted to post the code "online", I tried using google code. Probably I'm not using correctly and I don't think it was designed for such small projects but here is the link to the download.
    Because the project might interest to more than one community I also tried to posted the project at the AVRFreaks site, usually the place to search for information when dealing with avr-gcc toolchain but unfortunately I cannot add a file to the project...
    Programming the flash is straight forward with avrdude, but programming the oscillator calibration value and the fuses needs some more work. I used the interactive mode of avrdude ( -t) :
    read calibration
    write flash 0x3ff calibration_value
    read flash 0x3ff 0x10
    Here is a picture of the PCB during testing:

    The software is a bit difficult to understand, the micro is put to sleep most of the time except once once every 32 times of watchdog resets.

    Then a temperature measure is made, a port pin is used to power the temperature sensor and the micro is put to sleep for some 20ms, then a analog to digital conversion is started and the micro put to sleep again until the conversion is finished. Then the value is stored and the sensor is powered down (to save maximum power).

    The following step is calculating the colors function of the temperature, according to the temperature one of Red, Green or Blue or a mix of two is calculated. Each color has a value of [0..255].

    Finally blinking the LED, a software 3 channel pwm controller is created, a counter is incremented every Timer1 output compare and the calculated color values are compared with this running counter. When the counter value is higher than the set value the corresponding LED color is turn off, otherwise turned on. Timer 1 is set to auto reload every 1/25.6 ms this gives a 256 bit resolution every 10ms, this make the colour mixing invisible to the eye. After 100 repeated counter runs the micro goes to sleep until next Watch dog reset.