The American People’s obsession with Crap.

Recently, the outside blower motor on our heat pump started to go bad.  It made a horrible noise on startup, and upon inspection, the bearings were going out.  I replaced it with the help of my good friend Bill McCain and afterwards cracked it open in the shop to see what went wrong.  I was expecting worn bearings, but I was ASTONISHED at what I found.

This motor DIDN’T HAVE ANY BEARINGS.  Instead, it had sleeves / bushings, and this crappy oil soaked felt that had disintegrated around them.  Upon further research, I found out that none of the smaller HVAC blower motors have real bearings in them!  This article here: http://www.practicalmachinist.com/vb/transformers-phase-converters-and-vfd/hvac-fractional-hp-fan-motors-why-most-them-junk-how-get-better-ones-247476/ has a good explanation of why.  There is no demand for them, because no one wants to pay extra for them!

User Jraef posted:

“I used to work for a company that as a side line, represented a mfr of muffin fans for enclosure cooling. They offered “maintenance free” fans and they offered ball bearing versions, which cost about 50% more. Nobody, and I mean NOBODY, bought the ball bearing fans. 5 years at that company, their sales of ball bearing fans was zero. The mfr was angry about it because they made more profit on the ball bearing fans and wanted our salesmen to push for the upgrade since they were made in the USA and the others were brand-labeled cheap imports from Asia. Didn’t matter, nobody wanted to pay extra for them.

That company eventually sold out to an Asian competitor and the US production was shuttered. So what I am saying is, we (as consumers) get what we collectively ask for.”

And he has hit the nail on the head.  We, collectively, don’t want to pay extra for better quality.  That is also why Walmart is putting small businesses out of business.  If we didn’t flock to their stores and buy their low-priced items, the smaller stores wouldn’t have disappeared.

To make it sound better, sleeves are advertised as “bearings”, and real bearings are marketed as “ball bearings”.  (Or needle bearings, etc…).

Old PCs are Treasure Troves for Makers

I recently got 2 old PCs (Windows XP Era) from work.  They were throwing them out, and I grabbed them.  I really just wanted the power supplies, but as I took them apart, I realized just how much useful stuff they have inside

Lets start with the power supply.  35A-50A @ 5v…  You could charge A LOT of USB devices at once with that.  You could also use the 12v side to power things made for cars.  Such as: Car Stereos, A Car Amplifier, CB Radio, Ham Radio, LED Lights, Headlights for a super bright work light.  Hobby RC Battery Chargers.  You could even put in a current limiting resistor and use it to charge your car battery…

Then you have the CPU heat sync.  That is a match made in heaven for one of those flat super high-power LEDs you can get from ebay…  You could also carefully cut it into pieces, and use it for TO-220 heat syncs.

The CPU Fan, and optional Case Fan could be turned into a small working hover craft.

The hard drive contains a few super strong Neodymium magnets.  A brush-less motor, and usually a small solenoid.  Not to mention the case is made of solid aluminum that you can melt down to cast your own stuff.

The CD-ROM drive can be turned into a 3D printer if you have a few of them.  If it’s a dvd burner you can use the laser diodes to make a low power laser cutter.

If it’s old enough to have a floppy drive, there is another stepper motor for you.

The metal case provides some sheet metal you could use to bend your own enclosures if you get a brake.  You can make a shelf out of it (even I’ll admit that’s kind of ghetto…)

The old IDE and Floppy cables make great connectors to breakout the GPIO header on a Rasp Pi or other SOC computers.

Some computers have a tiny speaker attached to the motherboard pins for that annoying BIOS diagnostic beep on boot.  Others have a larger speaker in the front grill.

From the motherboard, you could de-solder the usb connectors for the aforementioned device charger.  The audio ports could also be used to connect a portable device into the car amp you’re powering from the power supply as well.

If you were really adventurous, you could use the onboard DVI and HDMI connectors to make your own HDMI to DVI adapter. Here is a schematic to get you started.

And all the other random bits are great for a day at the range :)

Joey

Upgrading A Windows Machine To a Smaller SSD using dd.

There are so many articles on migrating to a large magnetic drive to a smaller ssd drive.  I’ve tried a number of tools in the past, and all have worked.  But recently I’ve tried using some old-school methods.  dd is a tool that has been around for ages, it lets you take an in file / stream, and write it to an out file / stream.  So, for example, lets say you have two identical hard disks, you want to copy everything from one to another, say the source drive is /dev/sda, and the destination is /dev/sdb,  you can just do “dd if=/dev/sda of=/dev/sdb”.  It is a pretty powerful, but basic tool.  so it won’t provide any indication it’s doing anything.  And, if you accidentally mix up the if and of parameters, you have just destroyed data :)

But! What if you can’t get both drives into the computer at the same time?  I have a laptop I wanted to upgrade from a 500gb hdd to a 120gb ssd.  But, I didn’t have what I needed to connect both drives at the same time, but, I have a linux server on our home network.  Shrinking a drive is easy now days.  You can boot up a linux live usb stick, and use ntfs re-size to shrink the partition so the data is all at the beginning of the disk.

I used dd and ssh together to pipe the output of dd to a file on the server.  i.e.  “dd if=/dev/sda bs=1048 count=(some large number) | ssh joey@fs1 dd of=/data_brick2/laptop.img”  that’s it.  That easy.  Then, I swapped out the drives (while the laptop was running, you can do that safely with sata) and ran “ssh joey@fs1 dd if=/data_brick2/laptop.img | dd of=/dev/sda”

I didn’t dump the whole 500gb to the server, rather, using the bs, and count parameters, you can control how much data dd dumps.  I knew I had about 100gb of data on the drive, and since Ir an ntsf resize, it was all at the beginning, so I set the bs (block size) to 10k or so (1024 * 10), and then set the count to 1024*1024*1024*105/(1024 * 10).  Then, I used iftop to monitor the network traffic between the server and my laptop and could tell when the job was done.

Once the data was on the new ssd drive, you have to use parted or fdisk to change the partition size to be legal.  See, ntfs resize doesn’t actually change the partition size, it just moves all the data for the file system to the beginning of the partition, and resizes the file-system.  So the boot record that dd copied over says the partition was 500gb in size.  But, now it’s on a 120gb ssd.  Parted has an easy to use resize command.  I did that, it resized the partition, but it didn’t resize the file system…

So, the next step is to boot back into windows, run the disk partition tool, and you should be able to expand the partition by a few mb…  When you do this, Windows also resizes the file system at the same time, and Viola!  Now you have access to all the space on the SSD, everything is good, and you didn’t have to download or install anything.

If you’ve never used dd before, give it a try next time.  Just be 100% absolutely sure that you have if and of correct, and you know which drive is where so that you don’t loose any data.

 

 

OpenSCAD for Notepad++

The OpenSCAD editor leaves some things to be desired.  OpenSCAD isn’t supposed to be an IDE, it’s a really awesome scripting language to generate 3d and 2d models.  And I think they threw the editor in there to make it easier for people to get started.

Notepad++ for windows has a pretty sophisticated syntax styler, and someone out there has an xml file you can import for Notepad++ but it only looks good if you use black for your background by default, and they had a lot of the key words seperated.  It just wasn’t for me.

I took theirs (it’s on thingiverse, but I don’t want to put the URL here because I don’t want to improve their SEO, since I think this one is far far better :) ), changed some colors, added a few things, and this is the result.

To use it, click here: https://gist.githubusercontent.com/joeynovak/f7a4427d8f4733daaa4c and then click on “Download ZIP” and extract it to your desktop (or where ever).  Then open NotePad++ -> Language -> User Defined -> Import…  and select the file.  VIOLA!

Independant Contractors almost always get the short end of the stick in Contracts…

(RANT) As a small business owner frequently working with larger clients I frequently get asked to sign contracts. What I have discovered as my legal proficiency has increased is that attorney’s usually write contracts that protect their clients interests only, and not the other party. i.e. We don’t employ legal counsel yet, and so the client’s attorney always writes the contracts. So the contracts we get are almost always un-fair to us and we have to go back to the client and point out where the contract isn’t what we verbally agreed to, which isn’t the clients fault, it’s their attorney doing their job.

Some of the things we frequently see is for them to have power to terminate the agreement whenever they want with notice but we cannot. Or, the most recent one, had an attachment which if we had signed, would have assigned to them all property rights to anything we delivered to them (which, since we use a framework, and all the solutions we deliver include the framework, would have given them property rights to our entire framework).

We also frequently get contracts that say the work we do for them is a “work-made-for-hire” which is pointless for a contract to say. Because… The Copy Right Act of 1976 defines what a “work-made-for-hire” is and because of the way the act is written, a contract cannot re-define what a “work-made-for-hire” is. (i.e. A Duck is a Duck regardless of what you call it). And according to law, the author of a work has the copyright unless they assign it to somebody else, or the author created the work as a “work-made-for-hire”.  So the wording is in there to scare contractors into thinking because the client paid for the work, the client owns rights to id, which is never the case, unless certain things are met. See: https://en.wikipedia.org/wiki/Work_for_hire for more details, and here: http://copyright.gov/circs/circ09.pdf for a publication from the US Copyright Office.

So…  Read contracts carefully, because unless your attorney wrote it, or there are laws to protect you, you are going to get screwed.

18650 Battery Capacity Tester

I scrounge electronic parts from dead things all the time.  I’ve collected about 20 18650 cells in the last few years from drill battery packs and laptop batteries.  I’ve made a few 7.2v packs for my RC car, but I hesitate to do much with the rest until I find out the capacity of each cell.  I’ve also been wanting to play with a MOSFET and my DigiSpark.  So I built this capacity tester.  It basically connects the 18650 to a load (a hot water heating element, about 10Ohms of resistance).  The DigiSpark monitors the voltage of the battery using an analogRead call on pin p2.  It keeps the relay closed (via the MOSFET) until the battery voltage drops below a preset voltage (3.1v is what I’m checking for, but some people say it can go as low as 2.7 v without damage).  Once the voltage drops below the preset value, the relay opens, and a variable is set so that the digispark won’t try to re-engage the relay until it is reset.

I used Deans connectors to connect the 18650 holder I made with the circuit.  This allows me to easily swap in other batteries with a Deans connector once I add a voltage divider so higher voltages can be read.  If you haven’t seen deans connectors before, you may want to check them out.  The knock offs are cheap, and they work really well.  Some people have difficulty soldering them, and I had a problem for my first 10 pairs or so, but now, it’s a piece of cake.

Although it looks like a jumble of wires, all the connections are soldered and covered with heat shrink tubing, and it turned out pretty nice.

2015-09-29 21.39.03

The relay and the clock both get their ground from the MOSFET, so when the digispark opens the relay, the analog clock stops as well, recording how long it took to discharge the battery.

2015-09-29 21_32_06-SchemeIt _ Free Online Schematic Drawing Tool _ DigiKey Electronics

All the while, the Digispark tells me the analogRead value via morse code and the LED.  Thanks to Mark Fickett’s arduinomorse library.  To convert the analogRead value to voltage, divided by 2 (5v = 1024, so 205 per volt, if we divide by 2 we get the number of hundredths of a volt).

It’s not a perfect system, since the battery voltage drops as it discharges so the current changes over time.  But it works good enough for me to match cells based on approx capacity.

The code is really simple:

#include "morse.h"
#include <math.h>

#define PIN_STATUS 1
#define BATT_LOW_VOLTAGE 3.11 

int sensorValue = 0;
double voltage = 0;
bool stopped = false;
LEDMorseSender morseSender(PIN_STATUS);

void setup() { 
  // initialize the digital pin as an output.
  pinMode(1, OUTPUT); //LED on Model B 
  pinMode(0, OUTPUT); //Relay 
  morseSender.setup(); 
  digitalWrite(0, HIGH); 
}

// the loop routine runs over and over again forever:
void loop() {
  sensorValue = analogRead(1); //P2 
  voltage = (sensorValue * 1.0) / 205.0;
  voltage = round(voltage * 100) / 100.0;
  if(voltage > BATT_LOW_VOLTAGE && !stopped){
    digitalWrite(0, HIGH); 
  } else {
    stopped = true;
    digitalWrite(0, LOW); 
  }
  morseSender.setMessage(sensorValue / 2);
  morseSender.sendBlocking(); 
  delay(2000);
}

 

Using a Raspberry Pi to get started with SPI

I am working on a USB Credit Card reader for iOS and it’s going to require some serious hacking, and using SPI.  SPI is a simple protocol that many electronic components / microchips use to talk to each other.  I’ve never used it before, and am new to microchips so I hesitate to jump right in without some experience.   Electronics and microchips can be a pain / impossible to debug so I want to get something working before I start really hacking so that I always have a point of reference to come back to.  While the best solution would be a protocol analyzer so I can visualize the communication between devices and troubleshoot that way, instead, I’m going to setup a loop back on a Raspberry Pi using both the Raspberry Pi’s built in SPI feature, and bit banging on a few of the Pi’s GPIO pins.   This should result in me being able to send data from the built-in SPI feature and receive it on the bit-banging program.   For quick reference, SPI can be a 3 wire system.  With a clock pin, a read and a write pin (SCLK, MOSI, MISO).

But, before I get there, I’m first going to setup just the Raspberry Pi’s SPI feature to echo and run some test programs to make sure I’m using that correctly.

gpio-led2015-09-22 00.24.06To do this, we just need to short the read and write (MOSI / MISO) pins together.  They are side by side on the GPIO header, so you can short them with just a jumper.  Unfortunatly, I couldn’t find any, so I used a random connector that fit and shorted the wires together (See my lincoln log case, sweet huh?).  Be very careful here, there are a few places on the GPIO where GND and 5v or 3.3V are present and attaching this jumper would be a bad thing there.

Now, we need to enable the SPI port, it’s disabled by default, just do “sudo raspi-config” and go to Advanced Options, then look for the SPI option and enable it, then reboot.  This should take all of 10 seconds (other then the reboot).

2015-09-22 00.46.55Once you are rebooted, type “ls /dev” you should see “spidev0.0” and “spidev0.1”  SPI has a 4th wire called “Chip Select”, If you have more then 2 devices on the SPI “bus” the master device can set chip select high for the chip you want to send / receive data to / from.  Both of the SPI devices are the same, they just make different GPIO pins high to select a different chip on the bus…  blah blah blah…  In our case, we’re just ignoring this.

At this point, we should be able to echo data…  There is a SPI test program as part of the linux kernel, but we need to get an older version, so “wget -O spidev_test.c https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/plain/Documentation/spi/spidev_test.c?id=95b1ed2ac7ffe3205afc6f5a20320fbdb984da92 ”  then, “gcc -o spidev_test spidev_test.c”, and finally “./spidev_test -D /dev/spidev0.0”  You should get results like the ones on this page: https://www.raspberrypi.org/documentation/hardware/raspberrypi/spi/README.md  If you remove the jumper and run it again, you should get all zeros…  Now, it’s time to do some bit banging….

2015-09-22 22_50_16-Console2 - MINGW32__c_u_wwwgpio-led-miso 3.3vFirst, let’s verify that connecting MISO to 3.3v will produce what we want.  Remember when we have MISO and MOSI not shorted we get all zeros back from the test program.  If we connect 3.3v to MISO we should get all FFs.

And we do!!!  Yay!!!  Now, lets connect MISO to a GPIO pin and see if we can get the pin to go High (+3.3v) on demand.

First, let’s install a python library to help us work with the GPIO easier.  Follow Step 3 here: http://openmicros.org/index.php/articles/94-ciseco-product-documentation/raspberry-pi/217-getting-started-with-raspberry-pi-gpio-and-python

Now, I was tired of doing all this through a terminal, so I took a break and installed samba, according to these instructions: http://raspberrywebserver.com/serveradmin/share-your-raspberry-pis-files-and-folders-across-a-network.html

gpio-led 18tomisoThe script I created is:

import RPi.GPIO as GPIO
import time
GPIO.setup(12, GPIO.OUT)
GPIO.output(12, True)
time.sleep(60)

I then connected Pin 18 (to RPi.GPIO this is Pin 12).  Ran my python program, and ran the test program.  Viola!!! It works.  All FFs again.

Now we change the Program to:

import RPi.GPIO as GPIO
import time
GPIO.setup(12, GPIO.OUT)
while True:
GPIO.output(12, True)
GPIO.output(12, False)

Run it, and while it’s running run our test script.  We should get a mix of FFs, and 00s, and between the sets of FFs and 00s there will be smaller numbers (like FC).

To Be Continued…

Raspberry Pi GPIO Connectors

I have had a Pi  for a long time…  I’ve wanted to play with the GPIO on several occasions, but connecting to the GPIO header seemed difficult.  Well, I was stupid.  Connecting to the GPIO is SO SO EASY.  See…  PC Board manufacturers are pretty sharp and there are some standard dimensions for components and pin headers.  And, as it turns out, there are A LOT of connectors that use these same pin sizes and dimensions.  Some examples I’ve found are:

Small Stepper Motor Connectors, PC Fan Connectors, old IDE and Floppy Disk ribbon cables, That collection of 1, 2, and 3 pin connectors that attach a motherboard to buttons and lights in a pc case.  R/C Servo connectors, and lots of other random connectors inside consumer electronics…  Odds are that you’ve got a connector that will work in your random parts and wires bucket (you’ve got one of those, right?).  If not, go buy something like an old tape deck or vcr from a thrift store and cannibalize them for some Pi GPIO connectors.

2015-09-22 00.32.37 2015-09-22 00.32.48 2015-09-22 00.32.28

 

 

The Chateau Sport FSM / Shop Manual

An uncle on my wife’s side has an RV, and it broke recently.  He asked if I could look at it, which I was happy to do.  Unfortunatly, for those who don’t know, getting technical information on the vehicle part of an RV is not easy.  The RV comes with all kinds of books, schematics, etc…  For the RV itself, but the engine, transmission, body, etc…  Can be a mystery.

The Chateau Sport (which is manufactured by Four Winds) came / comes in two chassis options.  A Ford, or a Chevy / GM.  The RV itself is almost identical for both, but the wheels, engine, transmission, cab, etc… is what changes.  It took me about 3 hours of googling to find out that the Chateau Sport (2004) is built on a GM Van Chassis (which you wouldn’t expect since it is a dually in the back).  So, the whole reason for this post, is to hopefully help some poor soul who is looking for the Factory Service Manual for the GM Chassis of a 2004 Chateau Sport.  GM has a website dedicated to “Up Fitters” (people who buy incomplete vehicles, and built purpose built vehicles, like ambulances, utility trucks, and RVs).

So, if you are looking for the electrical diagrams for a 2004 – 2006ish? Maybe 2007/8 go here:   Look under “Light Duty 2006”, and “G/H Full Size Vans”.  There it is.

Once I had the manual in hand, I easily found that the problem with the RV was that a fuse was blown (there are a lot of fuses, so I’m not surprised we missed one the first time around.)

Fuseinbox

Chateau Sport FSM PDF

 

The “Water Survival Pill”

Someone should make a “Water Survival Pill”.  It is a pill that helps you float by giving you really bad gas…  According to this page: http://hypertextbook.com/facts/2000/JonathanCheng.shtml The stomach can hold up to 4 liters when it stretches, but my guess is that that is terribly painful.  Wikipedia’s article on the Gallon Challange (aka Milk Chug)  says the stomach holds about 2 liters.  2 liters of water weighs 4.4 lbs.  So filling your stomach with 2 liters of gas would be the equivalent of dropping 4.4 lbs of weight.  It’s not much, but when treading water for days at a time, 4.4 lbs could make a big difference.

Could you just swallow enough air to make it work?