Keymem project
The finished system will allow the portable use of a general computer keyboard and storage of typed content. Also, an interface will be available to download the content to a more usable platform. This document is flooded with heavy linkage.

Note: Some of the batteries, apparently, are 2500mAh, and some are 1850mAh.
The ATmega8 (~$3.55 USD (ATMEGA8-16AU)) microcontroller will serve as the control of the system. (datasheet)

The AT24C1024 (~$3.74 USD (AT24C1024W-10SU-2.7)) 1024K, 2-wire Bus Serial EEPROM with full memory array Write Protection, supporting up to 2 devices on a single 2-Wire bus will provide the local storage. Installing and implementing one will provide for the storage of 239674 (typed) words*. (datasheet) At 150 words per minute (my high for typing), it would take roughly 26 hours to fill up. Alternatively, the traditional USB mass storage device may be implemented, as it allows "immediate" transfer to any USB mass storage compliant system (nearly any that you will be in contact with). The advantages of the USB storage device compliancy route is that storage space is kicked up incredibly high. Spend some cash to buy the $358.62 Sandisk ULTRA II High Performance 8.0 GB CF Card (SDCFH-8192-901) and you can type until you die without ever worrying. Specifically, you probably type nearly 30 minutes per day, so you will have 8,362 years of storage space**. For comparison, it would take you nearly 3,000 of those years to type out the human genome at that pace.
The ATSTK500 (~$91.06 or $79 USD (ATSTK500-ND)) will allow quick wiring. (user guide)
My local desktop has a distribution of GNU/Linux installed and running (Debian/Knoppix). Pramode over at India has an article on hacking a microcontroller with GNU/Linux staring the Atmel ATmega8. Wieser provides thorough AVR (interfacing) support over at the University of Muenchen.
Periodically, Atmel releases application notes(?). One of particular interest here is the AVR313 (pdf), describing a PC keyboard connection for AVR microcontrollers. Also, AVR273 (pdf) describes the method by which some mass storage device can be interfaced through USB. Cyan Technology has released documentation on their AssetTracker which exposes some rather interesting components and ideas ... namely an interface to GSM to allow SMSing. This may be rather extreme, but for the lay person this means that the keymemproj device would be able to connect to the Internet. GSM support is an extreme measure and should only be thought of after consideration of general purpose EEPROM and USB mass storage devices.


voltage regulator with a good explanation about what to do for microcontroller connections. And hey, while you are at it, check out connecting computers and microcontrollers. It talks about wiring RS232 ports to each other and some details of the protocol.
Wiring the components to a voltage (power) supply is trivial. Get a 7805, a voltage regulator, which gives you 5 volts out of 7 to 30 volts and wasting the rest away as heat. The theoretical maximum of linear regulators in terms of efficiency is 5V/9V. It is usually about 3 pins (in, out, ground). Wire the out pin to the 5v ATmega8. The TLE4274V50 ($2.10 USD) looks like the best choice given the required current (datasheet PDF). This will provide for 800 mA. To see how many milliamps you need just sum up the current-requirements for all of the devices to be wired after the voltage regulator. By the way, the way that you can tell that you need more than 100 mA available from the voltage regulator is that places like this page say that the power specifications for the keyboard (at least the protocol?) states 275 mA is required. I have chosen to go over 300 mA (to 800 mA) just because I want some room to play with.
Use 22 AWG solid wire.
Extra notes
- On the PC try 'hyperterm' to view what the microcontroller is sending back.
- There is a RS232 to wireless Internet device, though it costs roughly $300. See Lantronix.
- (18:24:03) SarahEmm: if you need low current the 7805L, medium the 7805, high the 7805H
- (18:33:36) hype0: kanzure, digikey has tons of voltage regulators, i don't know how you are searching for them...
(18:34:22) hype0: kanzure, you may want to consider a 5V (or 5.1V) zener regulator circuit as well
(18:34:40) hype0: 9V batteries have really low capacity, so you might want to consider a high efficiency regulator as well
(18:37:31) hype0: digikey: parts search -> regulator
(18:37:36) hype0: Voltage Regulators(19273 items)
(18:38:26) hype0: the 7805s are really bad at wasting power
(18:38:51) hype0: so if you want any lifespan out of your 9V (which has almost no power...) i'd say get a high efficiency one
- (18:38:58) SarahEmm: kanzure: you want switching voltage regulators
- (18:42:04) elite01: kanzure, you need 5V for some ps2 keyboards, others work fine with 3.3V
- The PS/2 Keyboard Interface and the protocol information.
- (19:20:26) Exiles: wire it to a multimeter and 5v, and see
- Connecting a microcontroller to RS-232 ports and PS/2 devices (v-1.1) - this website also has other similar documents. Interesting photographs.
- (11:07:22) qdot: yes, level shifter, some of the MAX232 family (I always forget which is which)
(11:07:45) qdot: basicaly your MCU talks 0-3V and RS232 is -12 - 12V
(11:08:09) kanzure: oh, that's rather important ... so how does a level shifter work?
(11:08:27) qdot: some of them are fully integrated charge pumps
(11:08:43) kanzure: What is a charge pump?
(11:09:03) qdot: a device which among other things can easily generate -12V from 3V :)
(11:09:16) qdot: or actually.. -6V from 3V.. than another one goes to -12
(11:09:59) qdot: ugly beasts for digital designer, treat them as black boxes
(11:10:15) qdot: somehow they generate proper voltages and than they buffer IO
(11:10:26) kanzure: They also buffer I/O??
(11:10:39) qdot: well.. buffer, not latch
(11:10:45) qdot: they take 3V in and they make 12V
(11:10:54) qdot: or 0V and they make -12V
(11:11:17) UltraMagnus: hmm, they can take no potential difference and make one....
(11:11:42) qdot: yes, they are obviously powered with 3Vcc
(11:11:47) kanzure: qdot, any idea on the current-requirements for this device range?
(11:11:57) qdot: it's 0Vin -12Vout
(11:12:19) kanzure: and wiring it to the battery directly is fine, right? (not to the voltage regulator)
(11:12:29) qdot: kanzure: probably not
(11:12:43) qdot: kanzure: RS232 is quite sensitive.. get it through regulator
(11:12:57) qdot: kanzure: and they are ridiculously powerhungry
(11:13:04) qdot: kanzure: as all legacy protocols
(11:13:40) qdot: kanzure: run them separately and just use 3V SE serial link
(11:13:50) kanzure: you mean on a separate power circuit?
(11:14:17) qdot: if you're running from a battery, you don't need levelshifter unless it's connected to the PC
(11:14:34) kanzure: (only time this will be using RS-232 is when connected to PC)
(11:14:40) qdot: what I did was simple RS232 adapter cable
(11:16:10) kanzure: qdot, so I think I might want to hardwire a switch to turn on the levelshifter and RS232 lines, does that sound like a good idea? So I just need to throw in a level shifter, and ... what about the power requirements for interfacing with RS232? Do I have to go select a different voltage regulator?
(11:17:16) qdot: well, the level shifter would go off your voltage
(11:17:32) qdot: and power requirements are huge but most regulators can handle it
(11:17:39) qdot: my guess is around 100-120mA
(11:18:04) kanzure: oh, that's fine. The voltage regulator is at 800 mA :) (gave myself some room to play with)
(11:18:42) qdot: that is simply outrageous in battery powered device.. actually regulators are outrageos too, use switching power supplies if you want to run off odd voltags
(11:19:18) kanzure: you will have to explain this to me, I was only in here yesterday and some others were saying that the voltage regulator was what I wanted
(11:19:24) qdot: yeah
(11:19:26) qdot: good for start
(11:19:51) qdot: just at that power waste don't even think about running off watch batteries and stuff
(11:19:53) kanzure: why would a 800 mA voltage regulator be outrageous anyway?
(11:20:02) kanzure: ah, I was going to use a 9 volt battery
(11:20:19) qdot: because it's a freaking 9V * 800mA = 7W!!!
(11:21:36) qdot: really after you get used to it you will be making battery powered devices using less than 1mW of power
(11:21:42) kanzure: qdot, hm? Do you mean to say that the wattage-consumption is outrageously high? How would I calculate how long it would take to run the battery 'dead'?
(11:22:00) qdot: about 1hr, at best
(11:22:08) kanzure: how do you know this ?
(11:22:30) qdot: or actually a lot less for normal alkaline batteries
(11:23:14) qdot: kanzure: 210mAh / 800mA -> 0.25h -> 15min
(11:24:38) kanzure: hmm
(11:25:01) kanzure: well, I want to have a good 8 to 12 hours battery life, minimum .. so how could I possibly reduce my requirements? :(
(11:26:50) qdot: kanzure: make the first rev just like that
(11:26:55) qdot: kanzure: than try optimizing
(11:27:11) qdot: kanzure: probably you'd end up with 150mA /3V power consumption
(11:27:31) qdot: kanzure: with regulators you end up with about 1.5hr battery life
(11:27:41) UltraMagnus: kanzure: what are you making?
(11:27:43) kanzure: I know, I know - premature optimization is the root of all evil
(11:27:45) qdot: kanzure: with switching power supplies at about 5hrs
(11:27:52) kanzure: UltraMagnus: http://bbishop.heybryan.org/projects/keymemproj/project.html observe :)
(11:28:10) qdot: kanzure: and when you throw out the level shifter you end up with 20hr+ life :)
(11:28:44) kanzure: qdot, but how can I throw out the level shifter ?
(11:28:56) UltraMagnus: you need to increase a voltage?
(11:29:58) qdot: kanzure: you don't need it unless you are connected to the PC.. put it in the cable and power from PC
(11:30:00) kanzure: UltraMagnus, qdot suggested that I indeed do to interface the microcontroller with RS-232 (going to computer)
(11:30:14) kanzure: ah
(11:30:29) kanzure: yeah I was thinking of a switch to turn those wires on / off, but a custom wire would be fine
(11:30:38) UltraMagnus: rs232 to upload the stuff you type? or rs232 for the keyboard?
(11:30:58) kanzure: UltraMagnus: to upload stuff that I typed (stored in EEPROM)
(11:31:14) UltraMagnus: well, if you only need it for stuff you upload, couldnt that be in a "special" sync cable?
(11:31:34) UltraMagnus: just unplug it when you dont need it XD
(11:31:40) kanzure: yes, I think qdot just suggested that - but again I also suggested that it could be managed by a switch for "on/off" (the upload components)
(11:31:53) UltraMagnus: well, i dont see why not
(11:32:01) kanzure: seems like a good idea
(11:32:04) UltraMagnus: that would work
(11:32:11) kanzure: qdot also says that the voltage regulator would be eating up a lot of power
(11:32:33) UltraMagnus: if you need to use transistors, it will increase the voltage draw more when its on, obviously, but it will still increase battery life alot
(11:33:05) kanzure: Do I need to use transistors anywhere? I am quite clueless so far :)
(11:33:34) UltraMagnus: well, if you need to turn off quite a few data lines, then yes
(11:33:37) qdot: voltage regulators always waste excess power as heat
(11:33:48) qdot: and you don't need transistors
(11:33:54) UltraMagnus: if you just need to turn off the power supply to the chip, then no
(11:34:09) qdot: level shifter is a nice IC which handles the HV data lines internally
(11:34:15) kanzure: yarr, I meant to say *resistors (not transistors!)
(11:34:47) kanzure: I could use a level shifter instead of voltage regulator ?
(11:34:59) kanzure: * of a
(11:35:01) qdot: no
(11:35:21) qdot: but you could probably use some integrated DC-DC converter (Instead of the voltage regulator? - BAB)
(11:35:36) kanzure: What do you mean by 'integrated' ? - just a single component?
(11:35:40) qdot: yes
(11:36:10) kanzure: this would probably waste excess power too, but much less, I assume?
(11:39:21) qdot: well, + inductor, two caps, one diode and one resistor to make a switching power supply, but it's not as difficult as making the DC converter controller itself
(11:39:52) qdot: basically the way those things work is that they take energy in small chunks from input and deliver to output capacitor
(11:40:02) qdot: at different voltage
(11:40:35) qdot: lots of funny design problems but about 90% efficiency rather than 40% efficiency
*** (11:45:47) kanzure: so, DC-DC converter instead of voltage regulator, and a level shifter on the RS232 lines (?) that will only be on when I plug it into the PC, good summary so far ?
(11:49:42) kanzure: qdot, ?
(12:12:02) elite01_: kanzure, where's all the current going?
(12:13:17) elite01_: btw, you may integrate lzop :)
(12:13:45) kanzure: elite01_: 250 mA keyboard (at most), 3.6 mA microcontroller, and I don't even know about the EEPROM current-requirements
(12:13:47) elite01_: iirc it compiled to 4KiB or so, think it was compression and decompression, and i didn't care to make it any smaller
(12:13:51) kanzure: what is lzop and what would integrating lzop do?
(12:13:55) elite01_: eeprom is tiny
(12:13:59) elite01_: lzop is data compression
(12:14:13) elite01_: and the keyboard won't eat 250mA - use a multimeter to test it
(12:14:14) kanzure: ah
(12:14:19) elite01_: should be well below 100mA
(12:14:24) elite01_: it just _can_ eat 250mA
(12:15:09) elite01_: the microcontroller shouldn't use 3.6mA either when programmed properly (meaning it's in sleep mode most of the time) - maybe use an ATmega88 which uses even less power i think
(12:15:33) kanzure: elite01_, qdot has been suggesting a few things to me, I think this is a summary: DC-DC converter instead of voltage regulator, and a level shifter on the RS232 lines (?) that will only be on when I plug it into the PC,
(12:15:59) kanzure: but I am still wondering about the interface to EEPROM, do I just directly wire the ATmega8 to the EEPROM pins?
(12:16:02) elite01_: yes, good idea
(12:16:10) elite01_: exactly - you don't even need pull-up resistors
(12:16:26) elite01_: look at http://www.lzop.org/
(12:17:00) elite01_: too bad i will have _really_ high power need :(
(12:17:03) kanzure: sure will, and I think that the ATmega8 will be in a (semi?) sleep mode until interrupted by the keyboard
(12:17:11) kanzure: so it will not always be requiring 3.6 mA
(12:19:43) elite01_: kanzure, this one keyboard draws like 60mA
(12:19:45) kanzure: elite01_: So it looks like I have found all of the components required for this project ... only thing left to do is find a good DC-DC converter, a suitable level-shifter component, and then seek out a battery.
(12:19:47) elite01_: it's rather old
(12:19:52) kanzure: oh, that's great
(12:20:01) kanzure: much better than 250 mA :)
(12:25:05) elite01_: kanzure, you may save current by desoldering the keyboard LEDs :)
(12:25:32) kanzure: elite01_: How much current would I be saving? hehe
(12:25:46) elite01_: hmm somewhere between 1 and 20mA
(12:25:52) elite01_: may be like 5mA
(12:26:09) elite01_: but the led will probably be off anyway unless you do bidirectional ps/2 (only a software issue)
(12:26:22) elite01_: are you sure you can run your thing at 3.3V?
(12:26:33) elite01_: you should check with the keyboard (just feed it 3.3V)
(12:26:42) kanzure: elite01_: no, I am unsure :-/ I shall test it sometime soon
(12:27:18) kanzure: elite01_: Though that would be great, since the ATmega8 can also run at 3.3v apparently (IIRC)
(12:27:41) elite01_: ATmega8L8 (or so) can, ATmega8-16 won't (at least it's not specified to)
(12:28:03) elite01_: mega48/88/so can run down to 1.8V or 2.7V or something like that
(12:34:28) kanzure: elite01_: What about the possibility of using cellphone batteries and recharging the batteries through typical wall sockets? Know anything about that? A cell(phone) battery would be suitable for this project, right ?
(12:35:14) elite01_: kanzure, think they're li-ion or so - that'd be nice energy and power density
(12:36:18) kanzure: elite01_: So how do I wire a LI-ion battery into my circuit? And would I have to build my own LI-ion charger?
(12:37:23) hype0: kanzure, if you have to ask questions about a lithium battery, I would suggest not using one as it can be dangerous
(12:38:12) kanzure: hype0, oh? Anything in particular to watch out for?
(12:38:19) UltraMagnus: kanzure: there are commercial chargers, but they require the batteries to be removed
(12:38:34) UltraMagnus: kanzure: if overcharged or discharged too quickly they will explode
(12:38:37) kanzure: UltraMagnus: Know a price range?
(12:38:39) UltraMagnus: not can, will
(12:38:56) UltraMagnus: kanzure: i would use LiPoly instead to be honest
(12:39:39) kanzure: UltraMagnus, I could do that just as well :) Do these also have affordable commercial chargers?
(12:39:40) UltraMagnus: better energy density
(12:40:13) UltraMagnus: kanzure: well, the chargers are quite expensive, not really expensive though
(12:40:26) UltraMagnus: i think i saw them for sale on an american site for $50
(12:40:38) kanzure: 'erm, what about the battery itself?
(12:40:47) UltraMagnus: but, there are some website on the net that show how to use an AVR as a charger
(12:40:55) UltraMagnus: kanzure: depends on the size, they are quite cheap
(12:41:58) UltraMagnus: http://search.ebay.com/LiPoly_W0QQfrppZ50QQfsopZ1QQmaxrecordsreturnedZ300
(12:43:10) kanzure: uhh, let's say that I bought that 6000 mAh battery. Would that be a problem considering my circuit is probably going to be using only 200~ mA?
(12:43:47) UltraMagnus: i dont belive so
(12:44:04) UltraMagnus: IIRC they can be discharged above 1C
(12:44:14) LoRez: kanzure: no, just means you could supply it for 30 hours
(12:44:35) UltraMagnus: LoRez: he means, will it try to discharge it so fast that it will explode
(12:45:18) LoRez: a 6Ah battery being discharged at a rate of .2A is not working hardly at all :)
(12:45:50) kanzure: 30 hours, tis good
(12:46:07) kanzure: also, I do not know if that is .2Ah being discharged ...
(12:46:28) kanzure: the current-requirements I read were not in terms of amps per hour, :-/
(12:47:40) UltraMagnus: 1000mA = 1A
(12:47:53) UltraMagnus: 1000mAh = 1Ah
(12:48:06) kanzure: yeah ? but I do not know how many mAh the components are using
(12:48:18) UltraMagnus: i see
(12:48:42) UltraMagnus: the component datasheets should enlighten you of that
(12:48:46) kanzure: UltraMagnus, Hmm.. I can't seem to find any of those AVR LIpoly websites.
(12:48:52) kanzure: UltraMagnus, I'll doublecheck soon
(12:49:20) LoRez: kanzure: if it draws .2A, and you run it for 1h, that's .2Ah. it's .4Ah for .2A for 2h
(12:49:54) kanzure: oh, that's simple enough then :)
(12:50:26) UltraMagnus: kanzure: i am sure i saw it once, IIRC it might have been on atmels website
(12:51:20) kanzure: UltraMagnus, http://atmel.com/dyn/resources/prod_documents/doc1659.pdf ? is that it?
(12:52:08) UltraMagnus: yeah, must be
(12:56:19) kanzure: UltraMagnus, doesn't include LIpoly :-/ though ti does include: liIon, NiMH, and NiCd .. are any of those good alternatives to LIpoly?
(12:56:55) kanzure: perhaps NiMH?
(12:57:02) elite01_: NiMH should really be ok
(12:57:11) UltraMagnus: LiIon are the next best thing, although i really prefer LiPoly, have you tried googling for: "avr lipoly" or "diy lipoly charger" etc
(12:57:20) UltraMagnus: NiMH are crap compared to LiPoly
(12:57:33) UltraMagnus: might as well use SLA
(12:57:33) elite01_: of course - but much cheaper, more available, ...
(12:58:16) UltraMagnus: i can only think of a few situations where anyone would choose NiMh over LiPoly nowadays...
(12:59:02) elite01_: aren't they really expensive?
(12:59:35) UltraMagnus: they are more expensive yes......
(13:00:36) UltraMagnus: one of the only situations i can think of is if you know you might loose the thing you are making, or are making something that has to be cheap
(13:00:38) elite01_: what about discharge cycles and current?
(13:01:04) UltraMagnus: well, thats the third situation i can think of, if you are frequently charging and discharing the battery
(13:01:13) kanzure: how frequently?
(13:01:23) UltraMagnus: >10 a day
(13:01:35) UltraMagnus: sort of frequent
(13:01:36) kanzure: oh, nevermind
(13:06:27) kanzure: so could I possibly get something cheaper than LiPo batteries? What about typical AA or AAA batteries (or something else that you pick up at the store)? (LiPoly chargers; price range is around $45 to $150 ... - BAB)
(13:09:21) elite01_: don't know what's too bad about some AA/AAA NiMH cells
(13:09:48) kanzure: elite01_: What? My camera takes 4 AA batteries, for example. Are those NiMH cells?
(13:09:52) elite01_: like... 4 AA cells, each 2500mAh - would be quite cheap, but maybe too big
(13:09:59) elite01_: AA is just the size
(13:10:17) elite01_: they may be NiMH, NiCd, alkaline or anything else
(13:15:01) elite01_: say, you draw 100mA - now, some good NiMH cells may have 2500mAh... now, 2500mAh/100mA would be your 25 hours
(13:15:04) kanzure: elite01_: 10Ah would be appropriate, right? Looks like I've found my battery solution.
(13:15:10) elite01_: you'd just need a few cells to reach the voltage you need
(13:15:32) elite01_: if it's around 5V or 3.3V, 10Ah is really enough
(13:16:19) kanzure: so how would I wire the batteries in to the circuit? Isn't there a 'chasis' that devices commonly use?
(13:16:57) UltraMagnus: kanzure: what is the solution you have found?
(13:17:22) kanzure: UltraMagnus: rechargable 2.5Ah AA-type batteries
(13:17:33) kanzure: woops, *AA
(13:17:41) theatro: 2.5Ah AA ?
(13:17:42) UltraMagnus: NiMH i would guess?
(13:17:44) theatro: got a link ?
(13:17:51) kanzure: NiMH, yes
(13:17:57) kanzure: theatro: No, give me a few minutes to dig.
(13:17:59) theatro: nm ok
(13:18:03) theatro: no its ok
(13:19:29) kanzure: UltraMagnus, NH15-AA at 1.2v and 2500 mAh (the one that I hold in my hand is Energizer brand)
(13:20:28) kanzure: uhh, looks like I will have to use more than 4 of these batteries ... I will not have my 5.5 volts with 4 * 1.2v :(
(13:20:32) elite01_: kanzure, yes... when you have 4 of them, you have like around 4.8V
(13:20:53) kanzure: elite01_: Think I can get away with 4.8v instead of 5.5v ?
(13:21:34) elite01_: sure, most devices are 4.5V - 5.5V
(13:21:46) elite01_: your avr will be fine with less, no idea if you keyboard will be
(13:22:08) elite01_: but it is quite close - no idea how exactly voltage changes on discharge
(13:23:18) kanzure: does anybody know of the type of 'frame' that AA-size batteries are commonly put in? some names to search with, perhaps?
(13:24:02) elite01_: hmm battery holder?
(13:24:09) kanzure: haha, simple enough I suppose
(13:24:20) UltraMagnus: hehe
(13:30:49) kanzure: how do those work, anyway? Do you route all four of the positive ends into some wire to distribute to your circuit where a positive electron source is needed?
(13:31:30) UltraMagnus: alot of the time they will just have metal strips that connect them in series
(13:31:43) kanzure: alright
(13:31:48) UltraMagnus: or parallel
(13:31:53) UltraMagnus: make sure you get the right one
(13:32:01) kanzure: UltraMagnus, Right one what ?
(13:32:50) UltraMagnus: make sure you get a series battery holder
(13:35:54) elite01_: kanzure, look at http://www.der-hammer.info/terminal/index.htm - the program is english
(13:36:23) kanzure: isn't there "Hyper Terminal" on Windows? (maybe that is a Linux terminal)
(13:36:27) elite01_: quite nice for sending/receiving non-text data
(13:36:39) elite01_: no a windows one - the hyper terminal... sucks?
(13:37:02) kanzure: it does? Never used it :)
(13:37:26) elite01_: well, at least it does for what we'd want to use it for
(13:37:49) kanzure: Since it seems that I'd be getting 4.8 volts from my batteries, looks like I can drop the voltage regulator device or DC-DC converter. Right?
(13:38:39) elite01_: yes
(13:39:09) elite01_: maybe add additional cells and a buck regulator if you need precise 5V
(13:39:43) kanzure: By 'cells' you mean more batteries? What's a buck regulator, anyway?
(13:40:09) kanzure: (if these batteries have multiple cells then I do not know how to add less than the number of cells in these batteries)
(13:40:45) elite01_: a buck regulator is a switching regulator with Vout < Vin
(13:41:01) elite01_: AA are usually (always?) single cells
(13:43:56) UltraMagnus: yes
(13:54:27) kanzure: qdot, UltraMagnus, elite01_, LoRez - thank you for helping me out today.
(13:55:04) UltraMagnus: kanzure: no problem
(14:12:05) kanzure: elite01_: know if the ATmega8 allows for in-circuit programming?
(14:14:49) LoRez: it does
(14:15:00) LoRez: all the atmegas do ISP
(14:15:36) kanzure: then all you need to do is wire a MAX232, some wires to the serial port on the PC, and you're ready to do some programming
(14:15:42) kanzure: somehow I thought programmers were more complicated
(14:18:07) LoRez: no, no MAX232. they use parallel based programmers
(14:20:11) kanzure: LoRez: What? I thought that the chip's TTL levels would be incompatible with RS232 voltage levels?
(14:21:02) Casper: programmers use parallel port normally, not serial port
(14:21:20) LoRez: kanzure: "parallel based" not "serial based"
(14:21:48) ***LoRez gives kanzure a box of q-tips
(14:21:59) kanzure: So the parallel-port is on the right voltage levels?
(14:23:26) LoRez: kanzure: yep
(14:37:43) kanzure: what are those cables called that run from the parallel or serial port and cleanly expose the wires on the other end?
(14:38:45) theatro: cleanly expose the wires on the other end ??
(14:39:03) theatro: they dont always have a connector on both ends ?
(14:39:16) theatro: what do you mean kanzure
(14:39:19) kanzure: nah, I mean some plain wire ending, clearly labelled
(14:40:34) kanzure: say you wanted to wire the male-end of a RS232 cable, getting your hands inside the small 'snug' metal area is difficult (especially if you have large hands)
(14:41:53) theatro: ribbon cable ?
(14:42:01) theatro: that is what you are looking for ?
(14:42:07) kanzure: I am not sure
(14:45:07) theatro: well, now ?
(14:45:18) theatro: (I gave you 2 minutes to check google images :P)
(14:46:09) kanzure: looks like the ribbon cables are mainly for IDE connections
(14:46:39) kanzure: and they are 'just extensions' AFAIK
(14:47:11) theatro: ok right
(14:47:40) theatro: so you want to solder some rs232 connectors and you are looking for what cable to buy ?
(14:47:57) Casper: get a serial cable and cut the other end?
(14:48:08) kanzure: No. http://www.strout.net/info/robotics/tutorials/pics0410/linehunting.jpg <-- imagine doing that with the male side of the cable. I do not want to do that.
(14:48:21) kanzure: Casper, that's probably the solution but how would I know which wires are which?
(14:48:34) Casper: multimeter
- `Next, you have to figure out which wires correspond to the pins of interest. I couldn't find a list of standard colors for serial cable lines; I suspect there is no standard. So it was a matter of trial and error. Here's my method: Slightly bend the end of a short piece of breadboard wire, then insert it into one of the holes on the DB9 connector. (The bend is to make sure it has a good connection, and make it stick in the hole a little better.) Then hold the other end of the wire against one probe of your multimeter, as shown here.`
- `Then, set your multimeter to reading ohms (I set mine to 20 kOhm), and with the other probe, gently brush the ends of each of the colored wires sticking out of the cable. This is harder than it sounds, because each of these wires has more insulator than conductor. But with a bit of patience, you should find that the ohmmeter reacts to one of the wires. That's the wire connected to the hole you're testing; write its color down.`
(14:49:16) theatro: you need some kind of female pin to connect that way to a male header
(14:49:22) theatro: that is not very practical
(14:49:45) theatro: get an adapter to make it female like the picture
(14:49:54) theatro: does that help ?
(14:51:31) kanzure: yeah, sure, that is one alternative - get a male-to-female module
(14:53:36) theatro: http://jameco.com/webapp/wcs/stores/servlet/ProductDisplay?langId=-1&storeId=10001&catalogId=10001&productId=43369
(14:53:47) theatro: or get that and some 28 awg wire
(19:59:04) kanzure: Hm... looks like elite01 didn't check the documentation carefully enough. The EEPROM he's getting works only for 100K write cycles (which would be roughly 20K words, easily eaten up in a few hours of typing)
(20:00:11) kanzure: unless a 'write cycle' is a cycle of writing through the entire EEPROM .. ?
(20:01:23) Triffid_Hunter: kanzure: usually a write cycle is a write of a single block
(20:02:22) Triffid_Hunter: eeproms write a whole (usually 512 byte) block at once so they can't just call it a write - that implies a single byte write like ram chips
(20:05:37) kanzure: I see. Both of us (elite01 and I) are making similar projects, a portable keyboard so to speak. I am afraid that 1M EEPROM will not be able to last long. Have I done my calculations correctly? (Let's assume 1 word =~ 5 characters @ 7 bits each)
(20:07:10) kanzure: imagine that the 'delete' key is used frequently, that would involve the use of many of those "100K" write/erase cycles, wouldn't it? (if you are a cronic deleter ;))
(20:08:18) kanzure: s/cronic/chronic/
(20:08:51) Wowbagger_: Why not just a PDA?
(20:11:25) kanzure: Wowbagger_: Shhhh! :)
(20:11:45) Triffid_Hunter: kanzure: so add some ram and a save function
(20:11:52) kanzure: (have yet to find a suitable keyboard for PDAs, BTW)
(20:11:57) kanzure: Triffid_Hunter: The EEPROM *is* the "RAM"
(20:12:20) Triffid_Hunter: kanzure: how are you going to save up 100k worth of data to do a write cycle?
(20:12:37) Triffid_Hunter: you'll need ram for that
(20:13:08) Triffid_Hunter: you'll burn out your eeprom in no time if you try and use it as ram
(20:13:12) kanzure: Triffid_Hunter, what? No no. .. not '100 kilobytes of data' but instead '100,000 write/erase cycles' before the EEPROM starts to 'degrade' and 'malfunction' so to speak
(20:13:13) kanzure: oh
(20:13:30) kanzure: really?
(20:13:45) kanzure: it's not precisely the 'RAM' so to speak, it's just storing the typed data. The real RAM is on the microcontroller.
(20:13:59) Triffid_Hunter: there are 86,400 seconds in a day, so if you write once a second to a block, it'll last just over a day.
(20:14:54) kanzure: Looks like I need an alternative storage component. heh'
(20:14:58) Triffid_Hunter: however, there are only 8766 hours in a year, so if you write once an hour, it'll last for 11.4 years.
(20:16:26) Triffid_Hunter: kanzure: eeproms are best used like hard drives, for non-volatile long term storage. you still need ram for the short term stuff ;)
(20:16:31) kanzure: Maybe the microcontroller will write the data upon shut-down / power-off?
(20:16:46) Triffid_Hunter: kanzure: only if you program it to
(20:16:56) kanzure: but of course
(20:17:03) kanzure: just thinking through some alternatives
(20:17:18) Triffid_Hunter: an autosave every so often would be wise too, in case batteries die or something
(20:18:33) Triffid_Hunter: kanzure: I'd suggest looking at JFFS2 source, since it's designed to spread writes across flash devices evenly for greatest possible lifespan
(20:18:59) kanzure: JFFS2 source ? Is JFFS2 a program?
(20:19:39) Triffid_Hunter: JFFS2 = journalling flash filesystem 2, a filesystem for linux specially designed for flash storage
(20:20:06) kanzure: is it impossibly difficult to implement?
(20:20:36) Triffid_Hunter: I've never looked at it, I just know it exists and what it's for
(20:21:06) kanzure: http://sourceware.org/jffs2/
- `Flash chips are arranged into blocks which are typically 128KiB on NOR flash and 8KiB on NAND flash. Resetting bits from zero to one cannot be done individually, but only by resetting (or ``erasing'') a complete block. The lifetime of a flash chip is measured in such erase cycles, with the typical lifetime being 100,000 erases per block. To ensure that no one erase block reaches this limit before the rest of the chip, most users of flash chips attempt to ensure that erase cycles are evenly distributed around the flash; a process known as ``wear levelling''. `
(20:25:46) kanzure: `Although portability was intended, no ports have yet been completed, and the current code is only usable with the 2.4 series of Linux kernels.`
(20:26:13) Wowbagger_: Said somewhere that eCos supports it.
(20:26:24) kanzure: What is eCos?
(20:26:33) Wowbagger_: But Linux is a perfectly reasonable os for what you're trying to accomplish. :)
(20:27:01) Wowbagger_: The link you gave, where it says what os's it works under.
(20:28:03) kanzure: Wowbagger_, ah. Looks like eCos is meant to be small. I do not have any experience with embedded GNU/Linux, how much stripping would I have to do with the kernel?
(20:30:00) kanzure: the folks in #electronics suggest Linux for my embedded application,
(20:30:27) kanzure: how easy is to strip the Linux kernel down to the bare minimal requirements (and then implement JFFS2, a flash-journaling filesystem) ?
(20:38:35) Wowbagger_: kanzure: Not sure you really need to strip anything. It's a matter of not compiling stuff in. But you'll need a suitable processor and memory. Probably more than you want to deal with.
(20:41:57) kanzure: Wowbagger_: Suitable processor, eh? 16 MIPS at 16 MHz microprocessor with 1 kilobyte of SRAM ? (I know, really bad benchmarking numbers, but that's all I have at a glance)
(20:42:23) kanzure: will that do the trick, Wowbagger_ ? (My guess is no)
(20:42:56) Triffid_Hunter: kanzure: only 1k ram? ow..
(20:43:20) Triffid_Hunter: my robot has 32k, and is about to be upgraded to 160k if the ram chips I found in my parts box work
(20:45:15) kanzure: Triffid_Hunter: Not enough RAM? So how would I add some RAM components, anyway? Obviously shouldn't go for EEPROM ... hehe
(20:46:07) Triffid_Hunter: kanzure: check the reference manual for the microcontroller
(20:46:33) kanzure: Triffid_Hunter: And look for what?
(20:46:44) Triffid_Hunter: kanzure: should be an example circuit in the section that discusses external ram options
(20:46:56) kanzure: ah, alright
(21:05:17) Wowbagger_: kanzure: Was afk - 1k not nearly enough. I'd recommend at least 8M (but maybe you can probably make it go with less).
(21:06:29) Wowbagger_: And the processor must have an MMU (I think).
(21:53:29) kanzure: Wowbagger_: Alright
(21:53:40) kanzure: How about external DRAM?
(21:56:43) Wowbagger_: External DRAM (SDRAM or whatever) is generally how it's done.
(22:02:53) kanzure: Wowbagger_, digikey.com is giving me the option of "Mobile SDRAM" and "SDRAM". What's the difference if both are in the 'integrated circuits' category?
(22:07:51) leeeeee: kanzure possibly one has a low power mode
(22:08:06) Wowbagger_: Yup, lower power. Usually lower voltage.
(22:08:28) Wowbagger_: kanzure: If you're looking into SDRAM, first check that your processor can support SDRAM.
(22:17:14) kanzure: Wowbagger_, http://atmel.com/dyn/products/devices.asp?family_id=654 Would any of these be appropriate? 'PSRAM' ?
(22:19:22) Wowbagger_: kanzure: Without spending a lot of time on it, I can't really say.
(22:19:44) kanzure: Wowbagger_: Any parts that you would recommend that come to mind?
(22:20:04) Wowbagger_: Not really. It depends on your processor.
(22:21:08) Wowbagger_: Selecting appropriate memory for embedded applications can be a time consuming process.
(22:21:34) Wowbagger_: Memory is also one of those things which is sometimes difficult to get in small quantities for reasonable prices, in chip form.
(22:23:03) kanzure: What properties of the microprocessor should I consider when trying to figure out suitable external RAM components?
(22:23:34) Wowbagger_: Address/data bus voltage.
(22:23:59) Wowbagger_: The spec for the processor should fairly clearly say what kind of external ram it supporst.
(22:24:51) Wowbagger_: If it doesn't have a DRAM controller of any kind, then you need to use static ram.
(22:25:18) kanzure: The spec document is not telling me anything about external RAM, really. ( http://atmel.com/dyn/resources/prod_documents/doc2486.pdf )
(22:25:26) kanzure: There may be something that I am missing...
(22:26:43) Wowbagger_: Not going to happen with that processor.
(22:28:49) kanzure: Wowbagger_: Hm.. Are you sure? I guess the journaling filesystem will require some sort of operating system / kernel onboard, wouldn't it?
(22:29:02) Wowbagger_: kanzure: Yeah, linux.
(22:29:09) Wowbagger_: As far as I know anyway...
(22:29:21) kanzure: Right, and you're saying that Linux needs a few megabytes for the kernel to function appropriately
(22:29:29) Wowbagger_: Whole order or two of magnitude more complex then you're likely to be interested in dealing with.
(22:29:43) kanzure: most likely :)
(22:30:18) jules_verne: trying to run linux on which?
(22:30:42) kanzure: jules_verne, Nah, just trying to find a suitable method of storing data on a microprocessor project
(22:30:55) jules_verne: ah
(22:30:57) kanzure: one way of doing this is EEPROM with a journaling filesystem on it, but that would require a kernel running on the chip
(22:31:04) jules_verne: yep
(22:31:29) kanzure: so maybe there is an alternative to EEPROM that I am unaware of ? Something with more read/write cycles before it degrades?
(22:31:47) jules_verne: kanzure: compact flash
(22:31:49) raijin: um flash?
(22:31:57) raijin: any flash
(22:32:00) raijin: sd
(22:32:02) raijin: etc etc
(22:32:03) jules_verne: yea really raijin
(22:32:08) jules_verne: any flash memory kanzure
(22:32:37) kanzure: (searching)
(22:33:06) jules_verne: it is very, very easy to interface compact flash to a uC
(22:33:20) jules_verne: you can find hundreds if not thousands of examples everywhere kanzure
(22:35:02) Wowbagger_: Yeah... try CF.
(22:35:10) kanzure: How many erase cycles do these things usually have? What's a high-end range? Documents like http://atmel.com/dyn/resources/prod_documents/doc3623.pdf are just telling me 'minimum 100,000 erase cycles'
(22:35:28) jules_verne: flash?
(22:35:31) jules_verne: or EEPROM
(22:35:34) Wowbagger_: For the record, I wasn't the one who recommended JFFS2. ;) (Though I've used it, and it's fine... for a bigger processor)
(22:35:51) kanzure: Oops, I am sorry 'bout that Wowbagger
(22:36:08) kanzure: jules_verne: EEPROM seems to have the problem of a *max* of 100,000 read/write/erase cycles
(22:36:25) jules_verne: yea, it degrades over the life of the chip with every read/write cycle
(22:36:30) jules_verne: that's why we recommend flash
(22:36:33) jules_verne: virtually no limit
4 megabyte flash chip - AT49SV322D(T) see digikey.com with the AT49SV322A-80TU-ND for $3.71 ....
...
(22:40:43) kanzure: jules_verne: Oh, you're talking about compact flash cards? I was hoping to avoid USB interfaces
(22:40:56) jules_verne: kanzure: i'm not talking about USB...
(22:41:07) kanzure: How would you wire up a 16GB CF card (Samsung) then?
(22:41:11) kanzure: bah, nevermind
(22:41:15) Wowbagger_: Parallel.
(22:41:15) jules_verne: google's your friend dude
(22:41:26) jules_verne: i've done it a number of times on PIC micros
(22:41:39) kanzure: I'm too used to plugging cards into card readers without having to build the reader myself :)
(22:41:47) jules_verne: heh
(22:41:55) jules_verne: yea, this is where you buy the socket and wire it to the uC
----
(09:42:18) kanzure: elite01, hey
(09:42:37) kanzure: elite01, I think there is something that you have missed when planning your paperless typewritter
(09:43:30) kanzure: elite01, if you will check the EEPROM you have selected you will see that it will start to degrade within 24 hours of usage (at 1 write per second), so you have about 84,600 write cycles until it is dead. (1 write cycle = 512 bytes ? bits ?)
(10:06:45) Hotwire: why not use flash memory?
(10:12:44) kanzure: Hotwire, precisely. That's what I'm doing.
(10:13:02) kanzure: I'm thinking http://atmel.com/dyn/resources/prod_documents/doc3623.pdf
(10:14:39) Hotwire: looks good
(11:02:42) elite01: huh?
(11:02:57) elite01: b*llshit, kanzure :P
(11:04:28) elite01: got any reference?
(11:06:30) elite01: ah, i have the wrong datasheet in the wiki
(11:09:25) kanzure: go look at the documentation for the EEPROM part
(11:09:47) kanzure: I was using some Atmel EEPROM and they kindly put this sort of data on the first page of their PDFs :)
(11:11:08) elite01: they say 1M erase/write cycles
(11:11:43) elite01: what a did get wrong was kilobit/kilobyte
(11:12:57) elite01: i'll update the wiki
(11:14:06) kanzure: Can you link me to where it says 1 million erase/write cycles
(11:14:07) kanzure: ?
(11:14:17) elite01: http://ww1.microchip.com/downloads/en/DeviceDoc/21941C.pdf
(11:17:46) elite01: you may also download total endurance
(11:18:02) kanzure: Say, that's not too bad. I'm pretty sure that means there is a max of 122 kilobytes before it goes dead
(11:18:35) elite01: http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1406&dDocName=en010003
(11:18:35) kanzure: (I'm guessing 1 write/erase cycle = 1 bit ?)
(11:18:46) elite01: no
(11:18:55) elite01: you can write and erase each byte/block 1M times
(11:18:59) elite01: they don't influence each other
(11:19:10) elite01: so, you can even continue when one block is broken
(11:19:16) elite01: (if you know it's broken)
(11:19:21) elite01: just using the other blocks
(11:19:27) elite01: i updated the wiki page
(11:19:28) kanzure: 1 million times per block? That certainl changes things.
(11:19:55) elite01: "real" endurance seems to be different (depending on temperature, operating voltage and maybe other things)
(11:20:04) elite01: but seems to be much more than enough
(11:23:12) elite01: the thing that i mistook bits for bytes is like... worse :)
(11:34:48) elite01: he i _did_ the bit/byte right
----
(18:32:16) kanzure: So, final list: microcontroller, EEPROM or Flash, handful of resistors (220 ohms apparently for controller<->keyboard), and obviously: (keyboard), 22 AWG wire, solder, and a few breadboards
(18:32:20) kanzure: 'erm, plus battery case
(18:33:56) elite01: what about the ps2 connector? won't spend many euros sending it to you :P
(18:34:14) kanzure: nah, it's alright (I may be able to find one on my own anyway)
(18:34:48) elite01: a 100nF or so cap near the IC supply lines would be nice
(18:35:07) kanzure: Why would I need a capacitor?
(18:35:25) elite01: wait a minute
(18:36:01) elite01: mostly so that voltage/current spikes (generated by switching FET) won't be too bad
(18:36:06) elite01: (as far as i understand)
(18:36:13) kanzure: FET?
(18:36:32) elite01: field-effect transistors - the ones used in many ICs, they consume power when switching
(18:36:42) elite01: which is why your cpu produces more heat when clocked higher
(18:36:56) kanzure: alright
(18:36:57) elite01: http://www.electronicschat.org/index.cgi/Decoupling that's how one may do it
(18:37:03) elite01: i never needed it, btw :)
(18:37:29) elite01: but it's sure better - may be one of those problems which makes stuff unreliable and is easy to find
(18:37:47) elite01: main problem may be inductance of the supply lines
(18:40:58) elite01: you may also think about infrared :)
(18:41:11) kanzure: No! I am so close at the moment ;)
(18:41:12) kanzure: heh
(18:41:13) elite01: although it's a bit too slow to backup all the data (takes some minutes or so)
(18:41:21) elite01: close to what?
(18:41:45) kanzure: actually knowing what I have to do to get this built
- Note that the Atmel battery charger notes (PDF) may be of some assistance here.
(12:00:11) Hotwire: battery tech is getting better all the time
(12:00:24) Hotwire: have you considered using a mobile phone battery
(12:01:26) kanzure: Hotwire, not yet :) I think it's best if I can get the power consumption low enough first, then I can find a long-life battery (like a cellphone battery)
(12:01:36) Hotwire: true
- Interfacing the Serial / RS232 Port `Microcontroller's have also proven to be quite popular recently. Many of these have in built SCI (Serial Communications Interfaces) which can be used to talk to the outside world. Serial Communication reduces the pin count of these MPU's. Only two pins are commonly used, Transmit Data (TXD) and Receive Data (RXD) compared with at least 8 pins if you use a 8 bit Parallel method (You may also require a Strobe).`
- RS-232 Level Converters `Another device is the MAX-232. It includes a Charge Pump, which generates +10V and -10V from a single 5v supply. This I.C. also includes two receivers and two transmitters in the same package. This is handy in many cases when you only want to use the Transmit and Receive data Lines. You don't need to use two chips, one for the receive line and one for the transmit. However all this convenience comes at a price, but compared with the price of designing a new power supply it is very cheap.`
- `It is also possible to use microcontrollers to transmit and receive Serial data. As we have already covered, some of these MCU's (Micro Controller Units) have built in UART's among other things. Take the application we have used above. We want to monitor analog voltages using a ADC and then send them serially to the PC. If the Microcontroller also has a ADC built in along with the UART or SCI, then we could simply program the device and connect a RS-232 Line Driver. This would minimize your chip count and make your PCB much smaller.` http://www.beyondlogic.org/serial/serial1.htm#46
- `So far we have only discussed Full Duplex Transmission, that is that we can transmit and receive at the same time. If our Microcontroller doesn't have a SCI then we can Emulate a RS-232 port using a Parallel line under software control. However Emulation has it's dis-advantages. It only supports slow transmission speeds, commonly 2400, 9600 or maybe even 19,200 BPS if you are lucky. The other disadvantage is that it's really only effective in half duplex mode. That is, it can only communicate in one direction at any one given time. However in many applications this is not a problem.`
- Programming the AVR microcontroller with GCC - comes with a hardware list and software list, not to mention instructions on how to build the programmer hardware.
- Overview of the RS-232 standard - RS-232 Signals Functional Description
- # RS232C Level Converter A circuit for RS232C level converter, MAX232 and DS275.
- # Simple RS232C Level Converter using Transistors Cheap and easy circuit for converting TTL logic to RS232C level using small signal transistors.
- ATmega Programmer from Parallel Port
- `But what if you need 128 atmega programmer without any parts, then you can connect your microcontroller directly to LPT port or use protection resistors (220R) just in case. of course circuit works without resistors, but you put your LPT port at risk.
Just connect GND, SCK, MISO, MOSI and RESET to adequate LPT pins and you can program atmega’s flash memory without removing it from socket. Programming software can be PonyProg `
- MOSI to pin 7, MISO to pin 10, SCK to pin 6, RESET to pin 9, and GND (ground) to pin 25.
- Note: No resistor on the ground line.

- There is also a bit about interfacing the PC keyboard to the AVR microcontroller
- Wire AVR VCC to +5V keyboard. Wire the AVR's INT0 or INT1 to keyboard's clock. Wire AVR's Pxy to keyboard's Data pin. Wire AVR and keyboard's GND to ground.
- The link explains the keyboard's protocol.

- Application Note: Accessing the EEPROM
- Application Note: High Endurance EEPROM storage
- Application Note: Buffered Interrupt Controlled EEPROM Writes
- Application note that talks about connecting the ISP lines
- Application Note: Interfacing to PC AT Keyboard and source code

IBM Model M keyboard (nowhere to be found)
* ... where a word is assumed to be 5 characters long. This particular calculation ignored whitespaces.
** ... this assumes you type 150 words per minute*.

M68DEMO908QT4 with MC68HC908QT4 microcontroller ($25)
On June 2nd, 02007, Mike Grube was kind enough to offer the following information on ooPIC controllers (object-oriented PIC):
`Some Theory for Building a Logger
This is definitely more work than it's worth to most people, but that's what hackers are for, right? I would start with some small and easy to use microcontroller. There are many to choose from (68HC11, Basic Stamp, OOPic). I would choose the OOPIC(Object Oriented Programmable Integrated Circuit). The OOPic is relatively small, can store 64K of EEPROM and can be programmed in Basic, C++, or Java. I use C++ just out of familiarity. I purchased this from a distributor I found from www.oopic.com. The development kit set me back $70. The benefit I like with the controller is all of the objects that are included with it. The most relevant object for this application would be oSerial for obvious reasons. You can set the baud rate and everything. From that point on, connect the wires from the keyboard's PS/2 connector to some defined input pins on the OOPic, the wire some output pins up to a PS/2 extender...`