Hi! This Instr. is one of my own projects to make a UNIVERSAL PCB-SETUP
for the Attiny –84 only, (the one in ATMEGA family with 14-pin/ 12 I/O’s). I have tryed to develope as flexible- and multipurposal unit as possible, for my own needs. I’ve broken it down to 3 specific sections: TOP, MAIN and BOT, with each on separate PCB, Them electrical schemas have a extention of *.ISS or the expression *ISS in it’s name, (the *ISS comes from my PCB-program CADPAK, that creates them files with that ext.). I’ll attach all of them files hereby. The electrical schema; them gerber files for them PCB’s etc. I got them PCB’s from my manufacturor I-Tead, wery happy with their products (have had many orders from them). I’ll attach the code for my project: LOKKI_CODE.doc. Them comments are in Finnish, I didn’t wanna pay for the translating $$$$, and to use the Google transl. would be a ”mesh”. Howewer, there are a couple of some errors in my layout, (missing connection, + some), not bad ones but still, so if you are going to use them PCB’s hereby, please contact me to get them corrected details from firstname.lastname@example.org
In my instr. here I use a ”proto” product with the name of ”GULL”, (the bird often seen in harbours, specially with them having them fishing boats near by, wasteland places etc.).
The idea here is to have a ”PIR” sensor, (Passive Infra Red- AKA motion sensor, to sence them ”gulls” and then play a certain ”LOUD” noice, via the sound-IC ISD2560 via the TDA amplifer to scare the Gulls away?. Not tested yet. The ”scare-away” sound could be any of your choise to be used, (download any sound from your PC to the ISD25xx core. Multiply differential messages for diff. events in the same core can be done ).
Gee… I came off the topics, sorry?
Back to the topics, with the Attiny 84 I have 12 I/O pins for my usage now. I substract the reset pin so, now I have 11 pins left for my usage. In my solution I use 2 data gateways, from the MAIN-board with the ATtiny using 3 pins each for them 2 gateways for the 74HC595 SIPO, dedicated in the setup: DATA; CLOCK and STROBE, (latch, enable, sce…..shit, why do they use so many different names for the one and same thing, latch?)
1.) Gateway1 to the Top, for them switches and led's, this takes 3 lines of the ATtiny
2.) Gateway2 to the Audio ISD25xx and to the Bot, this takes 3 lines of the ATtiny
So far 6 pins used, 5 left?? OK.
For ”Top” and ”Bot” I use as a ”return path's” called RET1 and RET2 . These are the inputs for the multiplexed info, (via them diods, see schema). Now 3 pins left!! 2 of these I use here for them channels PIR1 and PIR2, (could be just any kind of input with a logical level). The remaining 1 I use to Analog ”IN” , the potentiometer from the ”Top”. Out of pins now, except for the reset, that ”could” be allso used as a I/O.
Here’s where the party starts and the ”goodies” comes:
Them gateways are sending data in a form of Serial In => Parallel Out via the 74HC595. In them both cases I’m using the benefit of the 74HC595 output Q’, which allowes you to cascade data in a chain, ”right” thrue the chip to the next one.
By using the advantage of the Q’ I can chain 2 or more of them ”595”, thus resulting in the ”AMAZING” I/O’s to be with using 2 ”595”’s to be 16 I/O’s. It goes boath for TOP and BOT. Here I’m using 2 ”595” on TOP (16 I/O's), 1 "595" on MAIN (8 I/O's) that allso cascades via the "Q'" to 1 "595" in BOT (8 I/O's), hence now I'm having 32 I/O’s.
Why do I call them all the time for I/O’s, hence the ”595” is a OUTPUT ONLY?
Tadaa…. I use a multiplexing of them outputs for some, and read them as RET1, and RET2 signals, respectievely, (refer to the schema). I’ll run this on a ”bit level” not on ”byte” level. e.g. I do:
bitWrite(scan_bank,0,1); // set LSB , drive out the ”595” in a for loop
shiftOut (data_1,clock_1,MSBFIRST,scan_swb) ; // Shift Out the data from scan_swb to the 74HC595
//Read the ”RET1”
if (bitRead(data_swb,0)== HIGH))
scan_swb = scan_swb <<1 ; // shift left the mask bit to read the next bit
.data_swb = new_swb ;
// Next bit to the mask Now the bit 0 becomes to be the bit 1;
Make the 7 loop. Now you got them all 8 bits in a ”hold register” new_data.,
actually it makes 7 iterations because the first bit (0) is allready "set" at the start.
To have them ”595” as outputs for targets are gonna need some more ”current”, therefore
I use them ULN2803 drivers, (the data says: up to 300mA), (exept for them nultiplexed ones).
MARK!: them bits are now in a order => LSB (bit7) to MSB (bit0) in the register,
(no problems there as long as you keep that in your mind).
For the ”debounce”, (and other functions), I use a subroutine, called ”aikageneraattori” = ”time_generator” , this subroutine is of a magnitude of about 100 better, compared to the ”delay()” function.
Ooohh… the topics? Now I got the data, (after debounce time), in the data_swb register.
So now it’s time to start work on the bases of that data.
The same goes for the BOT, there I allso got a multiplexed input: RET2
Sum Sumarum In my example of the ”Gull”, I’m NOT explaining the function of the unit, but rather giving you hints of how you can approach the benefits of using them 74HC595 SIPO, serial IN paralllel OUT, in a way to apply it to your own systems
In my example I use on the MAIN board a Voice recording IC ISD2560, but you can replace the one with your own design. Yet, the TOP and BOT can be used ”as is” in all other apps.
Gee…. ,again, there’s so much more to tell about this built. You can feel free to contact me with questions for more details: email@example.com