Saturday, November 01, 2008
Sunday, August 31, 2008
Sunday, May 04, 2008
Sunday, April 13, 2008
This program will take 2 files and 2 keys and spits out one large encrypted file(It was made after a discussing this article with a friend). You can use this data to retrieve either one file or the other depending on which key you give it. The encrypted data is interleaved with each other, so no message's encryption is stronger than the other. The secrecy of the message is determined by how strong the method is for hashing from the key given, in this implementation it should be equivalent to brute forcing a 128bit key.
This is a program that allows transferring files over a network from the client to the server. It is part of my prep work for a P2P app I'm slowly working on. It tries to do everything 'correctly', such as buffered socket connections transfer and writing of large blocks at a time, etc. So it is larger than you'd think for a relatively simple task.
Monday, April 07, 2008
Friday, March 21, 2008
Tuesday, March 18, 2008
Wednesday, March 05, 2008
- H-bridge based DC motor driver
- Rechargeable power supply
- Basic microcontroller setup
- A chassis from an old lamp with a custom done under carriage made from a PSU's ventilation gratings for attaching parts.
My current ideas are(From most reasonable to less reasonable):
- Buy a cheapy RC car from Wally World or some other bargain store and grab it's wheel assembly(Just kinda seems like cheating to me)
- Try to use a belt system to drive it. (Seems like it would quickly get too big for the chassis)
- Get a mill and try to machine a solution myself. (Mills are expensive and even if I had one it would take forever to be good enough to make anything useful if I didn't CNC it).
Monday, February 18, 2008
The program is pretty simple. It has 2 threads, a main one to deal with the lights and convert analog values, the other is for monitoring switch presses(I didn't use button interrupts like I should have). There is some bit fiddling to guestimate a speed, and this would change significantly with a different thermistor. Also my alternating states suck, and I didn't feel like desoldering to fix them. The problem is the computer's LEDs are bigger than the ones I was testing with, so the alternating algorithm always makes one weaker looking. The random flashing patterns are made using some modulus magic and adding variations using the analog input. The MCC18 code can be downloaded here, and the hex can be obtained here.
* 4.7 Kohms Resistor
* 1 Kohm resistor
* 220 Ohm resistor -- should match close to the thermistor, give or take for adjustment
* 7.200 Oscillator(Could be about any, although speeds would need adjusted)
* 3 sets of pins to hook up connectors (Salvaged from an old computer)
* 300 Ohm Thermistor
I ended up using 2 boards, one that just held the thermisistor and could plug into a spare slot under the CPU, picture below:
Everything hooked up:
Running at a slightly warm temperature:
Friday, February 08, 2008
- Basically it locks a door using a pull type solenoid. Pretty simple, the only caveat is that I wanted to use the doorknob as a combo lock. So it works by turning the knob until you see the appropriate number, holding it on that number(The period next to it lights up when it's considered inputted), and keep doing this for all numbers in the combo. Once it's done correctly the lock opens.
- I did make a much simpler version as an intermediary, that I think anyone could do in a couple hours.
- Electronics -- This consists mainly of the display, relay, power, solenoid, and a PIC to drive the whole thing.
- Hardware -- This is a modification to the door handle to have it turn a trim-pot and an eye bolt used to catch the solenoid's piston.
- It works without any problems. Doorknob is responsive, locks solidly, and will allow you to unlock it twice in succession with a single correct password(So it can be shut again)
- Minimal damage to the door, only required 2 small screws into the frame to hold up the solenoid.
- Three power supplies! It could easily be done with 2, I just didn't find one lying around that matched what I needed. I'm sure there is a way to do just 1, but I didn't spend enough time get it.
- The trim-pot is held on with hot glue, which I don't trust but hasn't given me trouble so far
- The wiring is horrendous, since it has wires sticking out from the door, to the wall, and too the door handle from the inside. I used a phone jack even to plug the PIC into the trim-pot, adding to the mess further. It's all tucked away fairly neatly now(Except the phone wire), but is still horrible.
- Hook up the trim pot by using something that clamps to the sides, instead of keying a dowel and gluing it on.
- Put everything inside the door itself so it looks much neater. This would mean swapping the positions of the solenoid and the eye screw. I didn't want to harm the door itself is why I didn't do this, since it is the 'correct' solution.
- Use 2 solenoids so it could be defeated by simple removing the hinges
- Use one power supply
Thursday, February 07, 2008
> Square dowel that will fit into the door knob.
> Trim-pot(See electronics section)
> Needle nosed pliers
> Hot glue gun
> Sanding drum for Dremel
- The door handle must be modified, since it only allows 90 degrees of freedom, and a standard trim pot is usually just shy of a full 180. It's 'simply' bending anything that hits the side upwards till it doesn't hit. This includes 2 spring ends and 2 metal tabs. I used normal needle nosed pliers and a flat tip screwdriver and got it with not too much effort. Pic below:
- Next a dowel needs to be cut to fit to the proper length. Should be enough to mount the trimpot inside the metal and then have it be snug against There is a picture further down when I discuss gluing that shows this better. Below is a picture of the dowel in the door(I was retarded and had to shape a circular one to work), it's sticking out a little just so I could feel how tight it was in the handle:
- This is the most difficult part IMO, since it's prone to screwing up, and helps if done correctly. The end of the dowel needs to be carved to fit into the trim pot. For example if your trim pot has a straight slit for a flat tip screwdriver then you need to carve something roughly resembling a flat tip head on the dowel. I used a Dremel sanding tool to to this. In the end you should be able to control the potentiometer with the dowel.
- Next glue the Dowel onto the trimpot, you'll have to take off the door handle assembly entirely for this to get it straight. I originally tried epoxy but it didn't stick to the trimpot plastic so I went with hot glue which worked well. Picture of it 'clamped' up below:
- Solder up wiring to the trim pot for later use since it will be hard to get to after it's in place.
- Finally put it all back on the door. You can no longer put in the latch(The middle section) since it also hinders rotation. The dowel should slide into the handle, and turning the handle should now turn the trim pot.
Sunday, February 03, 2008
- Cheap pull type solenoid -- $2
- Wireless Control -- $15
- Scrap wood(I used furring boards) -- $2
- Eye bolt, 2 nuts, and 2 lock washers-- $2
- Small machine screw and nut -- $1
- Spare wire(I used speaker wire) -- Hopefully free or about $2
- A pair of 2 inch wood screws -- Hopfully free, since they are hard to find without getting a $5 box
- Scrap metal(I used the casing of an old PSU) -- Free hopefully
- 12-24V 1A Power supply -- Hopefully free, salvaged mine from an old printer, else $10
- Extension cord(Only needed if what you are adding the lock to doesn't have a power plugin inside) -- $2
- Electrical tape -- $1
- Powerful Hand Drill or Drill press
- Soldering iron and solder
- Assorted drill bits
- Dremel with metal cutting blades
- Philips screw driver
- Some sort of saw(Hack, back, miter, band, table any will work)
- Marker or pencil
- 1 Amp is more than enough current to kill a person. Thankfully the voltage is low so it shouldn't penetrate the skin. Don't be dumb and work with it while wet or jam it into your body.
- Thin non-clamped metal + Powerful drill = Spinning razor blade of death. Seriously clamp it down before drilling or the drill(Especially with larger bits) will grab it and spin it around. Same goes for small pieces of wood, although they aren't nearly as dangerous. This is from experience.
- Solenoids can get hot enough to partially melt themselves! Do not leave intermittent duty ones on, or repeatedly pump them. Also don't put them near anything flammable.
- Strip the ends of your speaker wire, and then solder it onto the solenoid's leads. Secure with electrical tape.
- Strip the ends of your power supply and solder on the speaker wire. Secure with electrical tape.
- Next cut a block of wood. It should be big enough to put your solenoid onto, but not much bigger.
- Drill a large hole near the top, where you want the piston of the solenoid to stop. This should be big enough for your machine screw to fit completely through(Including the head).
- Put the machine screw on the solenoid loosely.
- Mount the solenoid through the wood onto the door frame, leave off the piston for now. Make sure you've already routed through the machine screw. There should be a total of three screws(2 into the wall and the machine screw to stop it). A finished picture of the mount is below:
- Now put in the piston(You will probably have to loosen the machine screw). To tighten the machine screw, hold the tip of the thread with pliers and rotate the hex nut(Hand tight should be fine). You have to do this since you can't reach the back of the screw anymore.
- Finally plug everything into the wireless control, which should be inside the closet one way or another. Turn it on and the solenoid should depress. Turn it off fairly shortly afterwards to
- Video of the electronics working:
- First take apart the door knob in question. There should be three parts the inside handle, outside handle, and latch. Also 4 screws, 2 for the latch and 2 for the knob. We won't be needing the the inside door knob so store it away. Put the front and the latch back in place.
- Take the scrap metal and bend it so it is across the doorknob hole and where the latch is. Mark where the 4 screw holes are.
- Drill out the 4 holes, then screw on the plate to the door. Remember to clamp it down since it can easily spin around and cut you.
- Next we need to figure out where to mount the eye screw. I found it easiest to put it on the solenoid piston, then go in and shut the closet(With the flashlight and a pencil) and then mark where the eye beam would hit the metal.
- Take back off the metal and drill the new hole.
- Put in the eye screw and lock it down with the bolts and lock washers. If you are like me and don't have lock washers, or just want to make sure it stays you can use epoxy instead.
- Remount the metal piece. It may bend a bit due to the bolt sticking out a tad behind it. Picture of it mounted(Note: The large center hole isn't needed) :
- Get inside the closet again to make any final adjustments so it will latch properly when shut.
- After that you are finished. Simply hit On to open or close the door and Off to relock it.
- Below is a video of everything working together:
Saturday, February 02, 2008
- Cheap Trimpot, ohm rating doesn't matter as long as it goes from zero resistance to pretty much a short
- LM7805 -- Linear regulator
- Power supply for the microcontroller, needs to have around 300 mA of current.
- Power supply for solenoid, needs about an amp of current and roughly 18V give or take
- Pull type solenoid
- 47 uF electrolytic capacitor, to clean up the power signal
- Dual seven segment display -- pinout
- NPN Transistor
- Electromagnetic Relay
- Crystal Oscillator(I used 10 MHZ, but it doesn't matter)
- PIC18F4520, could be any PIC with enough IO, this is just what I started with.
Below is the basic schematic. One thing to note is constant power is given to light up a C(For closed) on the second display, and one of the output pins on the pic is shorted to several to create the O(For open) when needed.
The circuit was quite easy, although I did have to plus up my microcontroller power supply with a 9V, to get enough current to drive the relay(I originally had a smaller display that broke, and adding the larger one sucked just enough amps to stop the relay from reliably switching).
The code for the PIC is in MCC18 and was compiled in MPLab. Source code can be downloaded here. Also the hex file for PIC18F4520 is here.
It's a pretty simple analog to digital conversion, then chop off all but the upper bits to get the proper hex value. It uses a separate thread to monitor how long the number was held for. One issue that took me forever to debug is the conversion takes several cycles and the number you are storing to has no definite value at that time. Meaning if another thread interrupts in the middle and tries to read that value it will get garbage. This is easily mitigated with a temporary variable being used during the conversion.
Soldering it up was hassle free, although I had a lot of wires that were required. 2 Power supplies to the control box, then 4 wires of power to the solenoid and microcontroller, 9 wires from the microcontoller to the control box for the display, and then a phone cord was used to hook up the trim pot to the microcontroller. If I had been willing to, it would have been *much* nicer to have embedded everything into the door, control box and all, so there were only the power wires.
Picture of the spaghetti wiring:
Rehashed video from an earlier post of the electronics running(Note: I'm manipulating a potentiometer offscreen to scroll through the numbers):
First I made a simple sawhorse design like this:
But it was uncomfortable due to the wood on top, and was like a teeter totter if you sat right on either edge since the legs are in the middle(They really are on upside down). So since it looked like crap anyway I decided to add more legs to make it sturdier and add some more ledges underneath to hold parts. Then I decided that those extra legs might as well hold some parts and drilled holes and added nails. Afterwards it looked like this:
Next I spray painted it black and then had my wife help me upholster(We screwed up a bit on one side with all the pliers). Some pics of the finished product:
Monday, January 28, 2008
I'm moving my *sigh* Windows computer up there tomorrow so I can reprogram the chip. I'm getting a wireless PCI card so I can just leave it there.
Also I'm working on finishing up the little bit of wood-working for my workshop. The main part is Frankenbench(A simple sawhorse style bench I made that I've been slowly 'augmenting'), which I still need to:
- Attach 2 more legs ( There will be 8 total ;)
- Modify those new legs to hold more tools
- Modify the underside to hold books better
- Round the edges where I sit
- Add some cushioning.
Thursday, January 24, 2008
* It helps to place solder on the contact first then heat up the pin on top of the solder
* A light touch with the soldering tip, and then drag it along the contact seems to work the best
* A completely cleaned up soldering tip is the best thing at desoldering bridges between hair-pins
I also epoxied the fucker in place afterwards so it will never come loose again. Picture below, although there's nothing to see since the pins are in epoxy and underneath the actual plug-in:(UPDATE: The computer can't read the bastard, although I can hear it trying to spin, damnit)
Also I did take the effort/spend the $1 on spray paint to fix up my control box a little more for the solenoid lock. I did it outside on my balcony in a cardboard box, since I didn't want the neighbors seeing some random black electronic counter looking thing with wires sticking out sitting around ;)
Still not perfect due to the electrical tape covering the Dremel flaws I introduced by being to lazy to switch to a smaller cutting wheel, and the fact that it's crooked:
Last I never did put my pictures up of our latest downtown DC excursion for my family, so here they are(Barring anything with our faces):
Unsurprisingly only college aged kids were at the Colbert portrait, at least when we were there. We got there right at the opening of the Portrait Gallery(11:30) and there was a line within a few minutes in front of it.