Links to stuff on this blog

Use the Site Index of Projects page link above for an easier way to find stuff on my blog that you might be looking for!

Saturday, June 26, 2010

More Work On The Table That Otto Jr. and I Are Making

Some of you may remember the table that I wrote about back in January more or less. As I mentioned back then this is part of a dining room table that I had and decided to chop up and burn to heat the house. The decision was also motivated by the fact that I don't need or have room for a dining room table so I had to get rid of it anyway. If you are having trouble remembering it HERE is a link and also HERE to a couple of the posts about it. The key thing that this table base was missing was a table top and today I got one!!
  
As I might have written back then I had to kind of stop working on the table  base (I had to table the table project in other words) because the weather was bad and I had other things to do. Anyway today Otto Jr. and I started working on it a bit again and the inspiration for today's activities came in a very inspiring way. We were headed out to a really good Taqueria to get some tortas for lunch and we drove past a garage sale. The guy at the garage sale was selling a bunch of old broken tools and he had a couple of busted up tables for sale as well. We stopped to see what he had and there was a round table 'blank' next to a box of broken tools. I offered him $5.00 for the table blank and an old bow saw - he took the offer. This table blank is one of the 2' diameter laminated pine blanks you can get at the hardware store and it is unfinished as well as a bit beaten up. Perfect for a piece of furniture that will go in my living room! Below is a picture of the table top sitting on top of the table base. Both need a lot of sanding and finishing but you get the idea of what this is someday going to look like.
  
 
Click below for more exciting details!!
 

Sunday, June 20, 2010

EPSON Stylus NX100 Dismantled and Destroyed

This week I have another "Parts Project" along the lines of the fax and phone system that Otto Jr. and I took apart HERE. As I mentioned in that post people that know me offer to give me a lot of the old electronics 'junk' that they don't want anymore and I really can't bring myself to say "No thanks, I don't want (need) it...". So what I usually do with this kind of stuff is take it apart and keep all the interesting bits that I think I might use someday, and throw away all the other parts (or recycle them). I enjoy doing this because not only do I get to increase my stockpile of motors, screws, springs and other neat stuff but I also get to see how various things are put together. I consider this a career related learning experience because as I have mentioned I design stuff for a living and it's fun and educational for me to see how other designers and engineers have solved packaging and construction projects.
  
This time I was given a used EPSON Stylus NX100 ink jet / scanner / printer. Ink jet printers are always full of little motors, springs, cam mechanisms, and of course ink. This is probably the third or maybe fourth printer that I have taken apart and they are all very similar inside even though they are designed and built by different companies. This one was especially neat because it had DC brush motors instead of the more common stepper motors in it for the paper feed. The scan head was driven by a small stepper and steppers are neat but as I have mentioned before they are a bit trickier to use in other projects as the electronics needed to drive them are a bit more complicated. Anyway I got 2 DC motors, one stepper and a bunch of gears and springs that I might use someday. As always the most useful part is the power supply and this one had a very simple one with 2 voltage output. Lots of fun and maybe I'll use it for something later.
  
  
Above is a picture of more or less what was left after I removed the things I wanted. In the top of the picture you can see the power supply with all the little cooling holes in the metal shield, the DC motors and a couple of the gears. I'm going to recycle the base in the above picture but I wanted to include it in the picture to highlight a couple of interesting things. As I mentioned all the printers that I have taken apart tend to be very similar in construction and operation. One of the more interesting commonalities of these devices is how the excess ink is dealt with.
  
First off this is a view looking down on the top of the device as it would sit on the table. The top of the picture is the back of the unit. On the right side by the Yellow arrow is where the printer head sits when it's not printing. The print head moves from the right to the left as it prints depositing ink onto the paper as it goes. That small black rectangular shape that the Yellow arrow is pointing to is what the actual print head sits on when it's not moving. That thing is a plastic encased metal 'grate' that has some sponge foam on it. The excess ink from the print head gets sucked into the grate and through the gray tube by the little gear driven pump that you can see by the Green arrow. The ink then passes through more of the gray tube and spills out the plastic funnel highlighted by the Red arrow. That little funnel is laying on it's side in the picture but when it's in it's installed location it is sitting on top of some felt like material that you can see just between the Green and Red arrows in the picture - the dark black square area in the picture.
  
Around that dark black square area you can see the white felt material and it has some black speckles and spots. Those speckles and spots are the excess ink that was dumped out of the gray tube and funnel into the felt. All of this felt and foam is in a recess at the bottom of the printer and the more you use the printer the more ink that gets deposited into and soaked up by the felt. Every printer that I have disassembled is similar in this respect. All the unused ink gets 'dumped' into felt at the bottom of the printer. The more you use the printer the more saturated the felt becomes. I don't know how well used this particular printer was but there isn't much ink sloshing around in there. I have taken some printers apart that had the felt soaked in ink with even more ink puddles in the bottom and all over the inside of the printer.
  
Why am I writing about this? I'm writing about it for no reason other than I think it's interesting and something you might want to consider if you ever move a well used ink jet printer. If there is enough ink in there and you were to turn it on it's side or upside down, the ink will all come spilling out or at least it will get all over the inside of the printer and destroy it. Pretty cool!!! I guess there isn't a better way of dealing with excess ink and because these printers are at this point basically disposable (and free if you buy a computer in many cases) they figure that you will get rid of the printer before it ever fills up with ink. If you are the kind of person that keeps things as long as they can and takes care of them I suppose that someday your printer will just fill up with ink and it will come spilling out the holes and seams someday. I just find this odd... I have not read the users manual on any of these printers and maybe they mention this someplace in the instructions.
  
That's about it for today. Even if this post wasn't all that useful or interesting it is what I did today and it gave me something to write about. Happy printing!

Saturday, June 12, 2010

Roman Numeral Clock: IV or ΛI (what time is it?)

Sometimes I get confused easily and this is one of them. Several times over the years I have looked at clocks that have Roman Numerals on them and I have wondered why they all seem to be different. I'm not talking about the heated debate over the number 4 written as IV or IIII  (click HERE for more about that specifically) but I'm wondering why sometimes the '4' is upside down. To me this isn't just strange, it has been a source of confusion when I want to know what time it is and (as if Roman Numerals aren't confusing enough by themselves) they put the IV on the clock face upside down. Below are a couple of pictures that show what I mean:
 

This first picture above I got HERE and it seems to be one of the most common ways that the numerals are placed on the clock face. Have a look at the number IV on that, it's right side up if you are standing in the center of the clock face.
 

Now have a look at this next picture above and compare it to the first one. The number 4 is upside down in relation to the other numbers on the face?! In other words if you were in the center of the clock looking out at the numbers everything would look OK and make sense until you got to the number IV which would look like ΛI - and be upside down. Every time I see a clock like this I get confused for a second as I look at it and I have to think for a second or two to figure out what is wrong before I can read the time. It's a subliminal confusion that makes me stop and think "it's upside down" before my brain figures out what time it is. By then it's too late!!! (kidding)
  
I would think that after so many years of clock making and a planet full of people constantly wondering what time it is that someone would have come up with a standard way of doing this but I guess I'm wrong - or maybe that is exactly the reason that there isn't a standard way...
 
  
The last picture I got from THIS site and it's an electronic projector version of a mechanical clock. They are selling this clock and I'm not endorsing it but I thought I'd put it in this post because it is yet another way that I have seen clocks made. In this case again the number IV is upside down relative to the clock center but so is V, VI, VII and VIII (relative to the center). The IX through XII are right side up relative to the center (the I , II and III work either way). Another way to say this would be that everything is upside down relative to the center except the last 4 numbers. I guess the reason for doing it this way is the IX and the XI would be easily confused as they would essentially be reversed if the entire face were upside down relative to the center (the 9 where the 11 should be and visa-versa).
  
I suppose the best way to deal with this is not to make any more Roman Numeral clocks! It's not like there is any advantage to using Roman Numerals except they look 'old' and 'sophisticated' but who needs that? I might build a clock just to see if I can do it any better when the time is right.

Saturday, June 5, 2010

MS Excel DEC2BIN 32 bit, Rotate No Carry, Sub Table, XOR and Num 0's

I use Microsoft Excel for just about everything all the time. Below is a list of some of the more offbeat things that I have done with it and I find useful. Some of these things I have included in other blog posts where I was writing about something else, and I found that from time to time I would go back to my own blog and look for them to copy into a spreadsheet that I was working on. It's so much easier to copy something than it is to figure it out again... Even though I wrote the blog post, and I don't have too many posts, it was a pain to find the things I was looking for. I decided to not only put them in one place for my own reference I figured I might as well explain more or less how they work in case anyone else was interested. Here you go:
 
  
Decimal To Binary Conversion With Lots of Bits in Excel: DEC2BIN
 
Up to 10 Bit Decimal To Binary Conversion
=DEC2BIN(G22,10)
Yeah big deal!! This is just the built in function in Excel that we all hate because it only converts up to 10 bit numbers. Anything bigger than that and you get that super fun " #NUM! " error... but wait it's worse than that! They actually only allow negative numbers to 512 and positive ones to 511 with the most significant bit being the +/- sign so you don't even get all 10 bits really... That sucks because I always find myself needing more bits than that. Below are some uses of the same DEC2BIN function to get more bits:
 
16 bit Decimal To Binary Conversion (a hard to read version)
=DEC2BIN(INT(G22/256),8)&DEC2BIN(MOD(G22,256),8)
The above line will give you a 16 bit number with all the bits "stuck together" of whatever 16 decimal value is in cell G22 like this:
1011010110011101
  
As you can see all the bits are 'stuck together'. That can be very hard to read especially when you are interested in one bit in particular - like the 9'th one from the right - and you have to count them to find it. To fix that you can change the above line to add a decimal point, a space or anything else between each group of 8 bits (each byte) in the &" "& below:
  
16 bit Decimal To Binary Conversion (easier to read) 
=DEC2BIN(INT(G23/256),8)&" "&DEC2BIN(MOD(G23,256),8)
and the above number becomes this:
10110101 10011101
  
With the space in there (or anything else...) it's so much easier to read. The below examples have a decimal point in between the bytes but you can put in anything you like between the quotes &" "& and it will be between the bytes.
 
How does this work?? Good question! It works by doing some math to break the "big number" (bigger than 8 bits) down into 8 bit values then converting them individually and then sticking them together with the & (ampersand). That is why in the above example the first part to the left of the & is INT(G23/256) to give the upper 8 bits and the lower 8 bits being derived by the MOD(G23,256) part. If you want to see each of the 8 bits of the 16 bit value in different cells on the spreadsheet just take everything to the left of the ampersand and put it in one cell and everything to the right in another cell.

To get more bits converted its a simple matter of sticking more math conversions together with more &'s like the examples below:
 
24 Bit Decimal To Binary Conversion
=DEC2BIN(INT(G24/65536),8)&"."&DEC2BIN(MOD(G24/256,256),8)&"."&DEC2BIN(MOD(G24,256),8)
   
If you look close at the above 24 bit conversion you can see the last 2 parts separated by the &" "& is very similar to the 16 bit conversion above except a MOD has been switched into the location where the INT was. In addition the upper 8 bits of the 24 bit value is being calculated with the INT(G24/65536) part.
 
32 Bit Decimal To Binary Conversion
=DEC2BIN(MOD(G24/16777216,256),8)&"."&DEC2BIN(MOD(G24/65536,256),8)&"."&DEC2BIN(MOD(G24/256,256),8)&"."&DEC2BIN(MOD(G24,256),8)

The 32 bit example above HAS BEEN FIXED on July 13, 2010 and  is a continuation of the same thing and by now it should be obvious how it works.
 
 
Rotate No Carry: (bit shift with a rotated bit carry)
   
Rotate No Carry is the geeky way to say I want to shift all the bits of my number one direction and if the bits 'fall off' the end just rotate them around to the other side. HERE is a Wikipedia entry about it if you want to know more about it.
  
Math is cool for so many reasons but one really cool reason is if you multiply a number by 2 mod 2^n-1 what you are really doing is a Rotate No Carry to the left one place (almost), where n is the number of bits in your number. If you multiply by 4 mod 2^n-1 you are rotating two places, multiply by 8 mod 2^n-1 is three places, 16, 32, 64 and 128 is obviously rotating more places to the left etc... 
   
So lets say you have an 8 bit number like 01100000 and you multiply it by 8 mod 255 (which is 8 mod 2^n-1), you get 00000011. So in other words the two 1's in the first number above have rotated  three places to the left and back around to the right. I said this math trick almost works because there is one case that it doesn't work and for an 8 bit number that is when the number you are rotating is 255. 
The problem is if you multiply 255 by anything mod 255 you get 0. That sucks because 255 is 11111111 (all one's) so if you multiply 255 by any amount you get all 0' and not all 1's. To get around this little inconvenience I use the IF statement in Excel and say "if the number to rotate is less than 255 then rotate it, otherwise leave it at 255"
So in the 8 Bit Rotate No Carry line below the IF statement is saying "IF(the value in A24 is less then 255) then (multiply A24 by the value in cell C18 mod 255) otherwise (it equals 255)
 
8 Bit Rotate No Carry
  
=IF(A24<255,(MOD(A24*C18,255)),255)
  
This line will Rotate No Carry the 8 bit value in cell A24 to the left the number of bits determined by cell C18.
One important thing to know is what value to use in the C18 position to rotate the bits the desired number of positions. I created a really confusing chart to do that and to also help count from the right or to the left depending on which direction you are trying to rotate.

Confusing Chart:
IN IN BINARY IN ROTATED IN ROTATED X BY
2 00000010 00000100 4 2
2 00000010 00001000 8 4
2 00000010 00010000 16 8
2 00000010 00100000 32 16
2 00000010 01000000 64 32
2 00000010 10000000 128 64
2 00000010 00000001 1 128
2 00000010 00000010 2 256
  
What this chart is saying is start with the IN number 2 which IN BINARY is 00000010. To rotate it one position to the left X BY 2 (the rotated value is 4 by the way) .  To rotate two positions to the left X BY 4; three positions to the left X BY 8 etc...
Pretty obvious I know but what if you want to rotate it to the right 6 places? It's still pretty obvious but I always find myself scribbling 1's and 0's on scratch paper and counting them. Now I have a chart to look at and so do you!
  
What about rotating values that are more than 8 bits you ask??
This is the exact same thing but instead of using the value of 2^8-1 (255) in the above IF statement for 8 bits you replace it with 2^16-1 (65535) for 16 bits or for 24 bits use 2^24-1 (16777215) and finally for 32 bits use 2^32-1 (4294967295). Below is what that looks like for a Rotate NO Carry of a 24 bit value:
  
24 Bit Rotate No Carry
=IF(G24<16777215,(MOD(G24*4,16777215)),16777215)
   
Again I like confusing charts so I made another one for reference during hot and heavy bit rotation calculations where confusion can be a bit killer. The values in Red above I got out of this chart:
Function Value -1
2^8 256 255
2^16 65536 65535
2^24 16777216 16777215
2^32 4294967296 4294967295
  
Here is an exciting example of  the 24 bit DEC2BIN and the Rotate No Carry function!
Say we start with a decimal number like 12632064 in cell G24 which in binary is:
   
11000000 11000000 00000000 (24 Bits)
   
Then we decide to Rotate with No Carry (24 bit) this number left 2 places (multiply by 4):
=IF(G24<16777215,(MOD(G24*4,16777215)),16777215)
   
We get: 196611 which in binary is:
   
00000011 00000000 00000011
   
You can see that it all got rotated two places to the left and the left most 2 bits got rotated around to the right most positions! Thoroughly exciting!!!
  
  
Sub Table OFFSET: (substitute)
The OFFSET function in Excel is handy if you want to substitute one number with another number. OFFSET works just like an array lookup (but the LOOKUP function in excel doesn't, so don't use that one). This is useful if you want to convert numbers from one value to another without any mathematical relationship between the two like a substitution table in a cipher. Here is an example:
 
=(OFFSET(D43,D40,0,1,1))
 
What this will do is count down cells by the value in D40 starting in cell D43 and return whatever value it finds there. For example if the value in cell D40 is 0 then you get the value of D43. If the value in cell D40 is 1 then you get the value of the cell right below D43. If the value in cell D40 is 6 then you get the value in the cell 6 cells below D43and so on...
  
You can also use this to do 2 dimensional array style substitutions and probably a whole lot more. Actually the OFFSET functions does all kinds of neat stuff but I won't go into everything it does because I don't use it for anything else.
  
  
Count Number of 0's: (parity)
  
This is handy when you have a cell with a bunch of different numbers (or characters) in it and you want to know how many of a particular number (or type of character) is in that cell. I use it for counting the number of 1's in a cell that contains a binary number. This is a useful way to find the parity of a binary number or just for counting 1's which is super fun all by itself.
  
=LEN(C5)-LEN(SUBSTITUTE(C5,"1",""))
  
The above line will count the number of 1's (or anything else you put in the blue location) and return how many of them there are. If it's a binary number it will count the number of 1's. You can couple that with something like:
  
=IF(MOD(L12,2)=0,"EVEN","ODD")
  
The above line will tell you if there is an EVEN or an ODD parity or number of 1's (or whatever) in that cell. Endless fun for the entire family!!!
  
   
Exclusive OR XOR:
This one is a MS Excel Visual Basic Function and if you don't know how to write custom functions I suggest you figure it out. It's easy to do by going to Excel and clicking on the Developer Tab (usually far right) and then the Visual Basic tab (usually far left). A new window opens and you can click on that windows HELP button to get the Visual Basic help menu. Also Google "MS Excel Visual Basic" and there is a lot out there to explain it. IMPORTANT: You have to set Excel to a Macro-Enabled worksheet and enable macros in the security properties to get it to work. Once it does work copy the below code into the Visual Basic window and save it. When you go back into excel click on any cell and start typing =EXCLUSIVEOR and at that point the function EXCLUSIVEOR will show up (it didn't before) just like any other built in Excel function.
  
Function EXCLUSIVEOR(Byte1 As Long, Byte2 As Long)
'
' EXCLUSIVEOR (Byte1 , Byte2)
' XOR Exclusive Or of Two 8 bit Byte's
' June 2010 http://ottobelden.blogspot.com
'
EXCLUSIVEOR = Byte1 Xor Byte2
End Function
   
This is really handy if you are doing a lot of bit and byte things. The syntax for it is:
  
=EXCLUSIVEOR(C11,C12)

   

What you will get is the logical XOR (Exclusive Or) of the values in cells C11and C12. You can write your own functions of course and give them different names as long as they are not the same names as built in Excel functions like SUM or OFFSET or anything else. To make functions that do other logical operations change the Xor above to And or Not or something similar! Wow!!
  
You can even write your own Visual Basic code to do pretty much anything as long as it's an "enabled" workbook. For some examples of other code I have written check out these blog posts (scroll to the bottom of each blog post for the example code):
Linear Approximation Table for Cryptanalysis in MS Excel 

More Excel Fun

Those are two of many...

  

That pretty much is the end of everything that I wanted to write today. I may add some more to this post or I might add another post and link to it here if I think of anything else. Like I mentioned at the beginning of this post I wrote this for myself to have a place to put a few of the things I use a lot so I'll have them in one spot.