Travel, Code, and Engineering
on December 11, 2016 by Kurt Tomlinson
I've been using Ruby on Rails for a while now to build websites. One important file in any Ruby on Rails project is the Gemfile. This file has no extension, so it's a bit annoying to open in Windows. Windows doesn't let you easily set a default program for extensionless files, so you have to choose which file to use to open it every single time, But there is a way to set a default program for extensionless files if you're comfortable with the Windows command line.
In cmd.exe, enter the command below. Replace C:\Program Files\Sublime Text 3\sublime_text.exe with the path to the program you want to use to open extensionless files.
ftype "No Extension"="C:\Program Files\Sublime Text 3\sublime_text.exe" "%1"
Do you have another Windows tip or trick you'd like to share? Let me know in the comments!
on December 4, 2016 by Kurt Tomlinson
I recently polished my car's headlights because they had gotten quite foggy. I learned some things that I'd like to share, and the results are pretty impressive.
I used a Turtle Wax Headlight Restorer Kit that I got on Amazon for $7.99. This kit comes with a lot of things, but I only used half of them. The results I got aren't perfect, but they're pretty good considering I only spent about 30 minutes doing this.
First, I used some water and a clean old t-shirt to wipe any dirt off of my headlights. The kit includes a "Lens Clarifying Compound" which I then applied in small dabs about the size of a dime every 4 inches or so. I rubbed the restoration compound into the headlights in a circular motion until I couldn't see any more compound on the headlights. I repeated this three or four times using a clean section of the t-shirt each time. Finally, I buffed the headlights as much as possible to make sure there was no more clarifying compound on them.
The headlights were pretty clear after that, so I called it a day and skipped the next step. (So I didn't use the "Spray Lubricant" or the "Restoration Pads".) I opened up the "Lens Base Coat Wipe" and wiped it on each of the headlights. After waiting a couple minutes for the headlights to dry, I opened up the "Lens Sealing Wipe" and wiped it on both of the headlights.
My headlights still have some chips in them from rocks, but they're no longer foggy.
Do you have any car tips that you'd like to share? Let me know in the comments!
on November 27, 2016 by Kurt Tomlinson
I just got my own 3D printer, and I had no idea what to expect. I was excited and nervous, but mostly intimidated by a machine that could magically produce real, useful objects seemingly out of thin air. Here's what my experience was like.
Unpacking the Monoprice MP Select Mini was uneventful. The only assembly required was sliding the spool holder into a slot on the side of the machine.
Next, I had to level the print bed. I did that but turning all the bed-leveling screws clockwise a couple times to make sure the print head's nozzle cleared the bed everywhere. I then moved the print head near each of the four corners, but I made sure the print head was far enough away from the corners that I could easily access the bed-leveling screws. Then I tightened each screw one at a time until I felt a very slight bump from the nozzle when sliding a piece of paper under it. Finally, I snipped the end of the sample filament at an angle with a pair of scissors to give it a point and inserted it into the 3D printer.
I printed the cat.gcode model included on the SD card. The print worked the first time, but the sample filament was only enough for half of the cat to print.
I pulled out the last couple inches of the sample filament that didn't get used and replaced it with a roll of blue filament I had bought. I tried printing the cat model again, but the next two prints failed. The cat partially lifted off the print bed both times. Luckily, I was monitoring the print both times, so I was able to abort the print and save the printer from wasting any more PLA.
The third time I tried to print the cat with my blue filament was a success, and it came out beautifully. I'm really impressed with how well this $200 3D printer does considering its super low price. I'd highly recommend it for anyone looking to get started with 3D printing.
I'm looking for useful things to make with my 3D printer. Do you have any ideas for me? Let me know in the comments!
Photo by MKzero
on October 23, 2016 by Kurt Tomlinson
I recently bought a pack of LED Night Lights from China on Amazon. They were very cheaply made, so of course I wondered what they were like on the inside. Today I tried to unplug one from the wall to move it to another outlet, and the front cover came off. Since it practically disassembled itself for me, I decided to take a closer look at its circuit and figure out how it worked.
The first step was to figure out what everything was. That was pretty easy. The LEDs are the four yellow boxes at the outside corners of the circuit board. The resistors are all labeled with three numbers "XYZ" where the value of the resistor is XY10^Z (e.g. 754 --> 7510^4 = 750k). The squiggly thing in the middle is clearly a photoresistor. The big blue thing is clearly a capacitor that is marked with "400V 224J" where "400V" is the voltage rating of the capacitor, and "224" indicates the value is 22*10^-4 and "J" indicates it has 5% tolerance on the value.
The two big blobs of solder are where the AC power comes in from the wall. And the two ICs were a little more difficult. The small 3-pin device is marked "J3Y". A quick Google search for J3Y turns up the S8050 NPN transistor from Shenzhen City Koo Chin Electronics Limited. I guessed the four-pin device was a bridge rectifier based on the "+" and "-" markings near two of its pins. I was not able to identify its part number though.
Next I traced out the circuit with the continuity checker function on my multi-meter and transferred it into LTSpice for simulation purposes.
I've labeled each section of the schematic to show what each section does.
Resistor R1 and capacitor C1 work together to limit the maximum current and voltage delivered to the load. If the current is too high, the LEDs will overheat and break. If the voltage is too high, then the bridge rectifier will fail and cease to continue rectifying the AC current into DC current.
R1 and C1 must be sized together in order to properly limit the voltage and current supplied to the bridge rectifier. If C1 is too large, then it will never charge, and it will act like a short circuit. In that case, the voltage dropped across the bridge rectifier will be somewhere around V_S*R4/(R1+R4) where V_S is the peak voltage of the mains power. In the USA, V_S is about 120 * sqrt(2) = 169.7 V. All bridge rectifiers have a maximum rating called the "Maximum DC blocking voltage". In cheaper bridge rectifiers, this number is lower, and can be in the range of 50 V. Given V_S = 169.7 V, R4 = 330, and R1 = 510, the voltage across the bridge rectifier would be about 67 V if C1 is too large.
On the other hand, if C1 is too small then it will act like an open circuit and no current will flow through the load. If no current flows through the LEDs, they will never turn on.
Given the maximum voltage desired across the bridge rectifier and the maximum current through the load, resistor R1 can be sized using Ohm's law. Once the value of R1 is known, C1 must be sized so that the current through the load will charge/discharge it at the appropriate rate in order to keep the voltage across the bridge rectifier within an acceptable range.
Finally, the resistor R5 is simply used to discharge the capacitor C1 when the device is disconnected from the wall so that the maximum voltage difference between the capacitor and mains voltage is never more than V_S.
The bridge rectifier is standard. It forces current to flow in only one direction in the rest of the circuit. It's just four diodes in a single package.
The power burner makes use of a photoresistor to turn off the LEDs when there is ambient light. The photoresistor, marked PSR (for photosensitive resistor) has a resistance of about 2k in a brightly lit room and a resistance of about 25k in a dark room. When exposed to light, the photoresistor decreases its resistance and supplies the NPN transistor with a base current. The base current turns the transistor on, and it conducts current from its collector to its emitter. This starves the LEDs for current (because only a fixed amount of current is available due to the current limiting resistor R1), and they turn off.
When there is no ambient light, the photocell's resistance increases, the base current is removed from the NPN transistor, the transistor turns off, and current flows through the LEDs. This turns the LEDs on at night time.
Since the same amount of current is passing through the cicruit whether the LEDs are on or off, the night light uses the same amount of power all the time. That's why I called this portion of the circuit the power burner.
Finally, the load is just four LEDs and an additional current limiting resistor. I haven't dug into this circuit enough to figure out exactly why a second current limiting resistor is necessary. I think it could be removed without impacting the circuit's functionality. If you know why it's there, feel free to let me know in the comments.
I also simulated how the circuit works in nighttime and daytime. The first simulation below is the daytime simulation. It shows a maximum of about 14 mA flowing through the collector of Q1 and almost no current flowing through the LEDs.
The second simulation is the nighttime simulation. You can see that it's just the opposite of the daytime simulation: current flows through the LEDs and not the transistor.
on September 25, 2016 by Kurt Tomlinson
My aging laptop was having trouble keeping up. It slowed to a crawl. Even opening up more than one tab in Chrome seemed to be too much for it. That's when I decided to take things into my own hands and fix it in a surprising way.
I drilled holes in my laptop.
When I was using my laptop, it used to get so hot. The fan always sounded like it was running at top speed. Considering the age of the laptop and the low price I had originally paid for it, I decided it was time to open it up and see what I could do. The warranty had long since expired, and I wouldn't be too upset if I broke it and had to buy a new one.
So I unscrewed every screw I could find on the bottom of the case and gently pried the bottom panel off. (It really was that easy. Thanks, Sony, for making my particular model laptop so easy to open up!)
Once I had it open, I actually found the root of the problem very quickly. There is a single heat pipe going from the CPU to an array of aluminum fins that are cooled by a blower fan. The fan blows air through the fins and the hot air would get exhausted out the side of the laptop case.
The problem was that there wasn't anywhere for the fan to take in cool air from outside the case! The fan was pressed tight between the motherboard and the plastic bottom panel. Maybe some air could leak in somewhere, but I couldn't really see any obvious air intake locations.
Initially I thought about cutting a big hole in the case and covering that hole with metal mesh to filter out dust, but I settled on drilling a lot of small holes in a circular pattern after doing a bit of searching on the internet about how other people how modified their own laptop cases for improved cooling.
I took a couple of random circular objects I had lying in my room (a Carmex container and a button) and traced out two circles on the bottom panel centered on where the fan was centered. I then used a Sharpie to place 16 dots in a circle half-way between the two circles. I kept the dots evenly spaced by placing dots every 90 degrees, and then halfway between those dots, and then halfway between again. I filled in the two circles with another two rows of sixteen dots: one inside the first row and one outside the first row. I offset the inner and outer rows from the middle row so the drill holes wouldn't be too close together.
I then drilled holes where all the dots were with a drill press and what I can only guess was about a 1/8" drill bit. The result looks so much better than I had hoped especially after seeing the ridiculously lop-sided and uneven patterns other people had drilled into their own laptops on the the internet.
I noticed a distinct performance improvement after drilling those holes into my laptop case. (Sorry, I don't have any benchmarks to prove this.) The CPU used to overheat and scale down its frequency all the time. Now, it runs much cooler and is able to sustain a higher higher workload for much longer without having to slow down due to thermal issues. Now my laptop actually feels faster than the day I bought it (but that's probably mostly because I upgraded the hard drive to an SSD.)
Have you done something similar on your computer? Let me know in the comments.