Friday, March 18, 2016

Custom phone car mount

I was over at microcenter a couple weeks ago and picked up a generic phone mount for my truck. It mounts in the vent and has a nice ball joint for adjusting. Similar to this:


Perfect, I thought. Then I installed it and headed down the road...

One problem, while the vent may seem like an attractive mount point, what happens when you have a vent that pivots? With every turn your phone flings to the right or left. I was about to return it but then remembered I have a buddy with a 3d printer =D

30 minutes later, with the help of SketchUp, I designed this: (.stl file)


It's a simple block with two screw holes for mounting and a hole to receive the peg end of the ball joint. My buddy recommended separating the parts to reduce the amount of scaffolding needed to print the parts. A bit of acetone on the peg, insert that into the block, and the parts will naturally fuse together.

I will screw this into a useless pocket in my truck's dashboard and the phone mount will secure nicely.


Lastly, I will run a usb cable power supply, hard wired, out of a small hole in the bottom of that pocket, allowing for a convenient power supply for my device.

I'll update with pictures once the install is complete!

Wednesday, March 16, 2016

Postgresql upgrade issues - Checking for reg* system OID user data types

So I am prepping for an upgrade of postgres from version 9.2 to 9.4. Since this is a major version upgrade, I chose to use pg_upgrade to try and minimize downtime. My first attempt in one of our dev environments went fairly well, up until I actually launched the upgrade process.

My stopwatch was ready, my commands were ready, my server was ready!

Start the stopwatch...
#/etc/init.d/postgresql-9.2  stop#sudo -u postgres /usr/pgsql-9.4/bin/pg_upgrade --old-datadir=/var/lib/pgsql/9.2/data/ --new-datadir=/var/lib/pgsql/9.4/data/ --old-bindir=/usr/pgsql-9.2/bin/ --new-bindir=/usr/pgsql-9.4/bin/


HERE WE GO!

Performing Consistency Checks
-----------------------------
Checking cluster versions                                   ok
Checking database user is a superuser                       ok
Checking database connection settings                       ok
Checking for prepared transactions                          ok
Checking for reg* system OID user data types                fatal

NOOOOOO!!!!




Quick.....
#/etc/init.d/postgresql-9.2 start

Thank goodness that was only dev... So what now?? Running cat of tables_using_reg.txt, showed me that there were several tables affected:

  public.pg_ts_dict.dict_init
  public.pg_ts_dict.dict_lexize
  public.pg_ts_parser.prs_start
  public.pg_ts_parser.prs_nexttoken
  public.pg_ts_parser.prs_end
  public.pg_ts_parser.prs_headline
  public.pg_ts_parser.prs_lextype

The good news is, it looks like these are remnants of the old pgsql 8.x days when tsearch2 was not part of the distribution.

My solution? Drop pg_ts_dict & pg_ts_parser. Once upgraded, I'll test everything, as long as there are not any issues, we are good to go. Worst case scenario, I can dump those two tables (5 rows total between them) and run an import post upgrade.

Monday, March 14, 2016

First go with AliExpress

So in search of some components for some arduino/rasp-pi hacking, I was getting frustrated with cost of some of the most basic components. I should not have to spend $10-15 on a simple Temperature & Humidity sensor! Sadly, that is one of the cheaper components.
Humidity and Temperature Sensor - RHT03


After some digging, I stumbled upon AliExpress!

www.aliexpress.com

They are basically the Amazon of China. Loads of great deals on about anything you can think of... but this is especially true of electronic components. That sensor alone, also known as a DHT22, is priced at a full 1/4 of the US based outlets (that's $2.50 if you don't want to do the math)!

And that's not all! They also have dozens of component kits on the seriously cheap, like this 37 sensor kit for just over $12! Or how about 600 misc. resistors for $2.60!
http://g03.a.alicdn.com/kf/HTB1DcfKLpXXXXa8XFXXq6xXFXXXN/37-IN-1-SENSOR-KITS-FOR-ARDUINO-HIGH-QUALITY-FREE-SHIPPING-Works-with-Official-for-Arduino.jpghttp://g02.a.alicdn.com/kf/HTB1z17WKFXXXXc8XXXXq6xXFXXXO/Free-Shipping-600-Pcs-30-Kinds-Each-Value-Metal-Film-Resistor-pack-1-4W-1-resistor.jpg

I feel like a kid in a penny candy store!!!

Here's the best part, most of these components come with free shipping!

So what's the catch? Can you have your cake and eat it too? Is this all a bit scam?

The great new is, like amazon, this site is made up of hundreds of sellers, each trying to make a living, and their reputation will make or break their AliExpress store. On top of this, AliExpress seems to have some great dispute tools. In fact, they even hold your payment from the seller until after you have indicated that you have received your order and are satisfied with it!

The downsides? It's all being shipped from China, so unless you want to pay boatloads on shipping, you are not going to enjoy the same second day delivery that Amazon Prime has spoiled us with! We'll see how long things end up taking, so far, 5 of my 7 orders have shipped within 2 days of ordering. They still have to travel over the ocean and through our post office. At these crazy low prices though, they are totally worth the extra wait!

What can I say??? Crazy cheap prices! Free shipping! Excited to make something with my 7 year old!

Paper making: Take 1

So yesterday, I took my first stab at making paper. It's part of a larger goal of making my own Journal. It wasn't perfect, but you've gotta start somewhere. Unfortunately, I did not take pictures of the process, only the results. When I run my second trial, I'll be sure to take pictures of the whole process to share.

My observations thus far are:
  • I need a better frame. 
  • My frame size needs to accommodate for trimming the edges.
  • I need to figure out a better way to regulate the paper thickness. 
  • I need a bucket that is sized closer to my frame.
  • I need to figure out how to whiten the paper, if I am going to continue to use non-white recycling.

I'll give some details about the process after the pictures. Without further ado:

Here is my paper. It's about the thickness and texture of construction paper. It was made primarily of recycled paper bags plus a few old homework pages that were headed to the trash.

Here is the frame I used. It worked ok, but I sized it according to the page size I wanted, not counting for edge trimming. Also, because you need the frame to "catch" the pulp, I need to modify the frame so that the pulp cannot seep between the screen and the frame, which made paper removal very difficult. For my next trial, I will add some furring strips to the top of the frame, screwing the two pieces of wood together. I may actually end up using the furring strip side for the paper making, as the shallow depth might help with paper removal as well.

 Here is the back side of the frame. You can see that I just stapled the screen material to the frame.


Now for the process:

Making the pulp, Part 1:
To make the pulp, you have to start by tearing  and soaking the paper. I did this first so that it would have time to become nice and saturated.
  1. I gathered some misc. paper from the recycle bin. I had some brown paper bags and some old homework. I knew that the paper bag would cause the end result to be brown, I figured for this stage, that didn't matter much.
  2. Put a kettle of water on to boil. This is optional, but I've read that it greatly speeds up the soaking process.
  3. Tear the paper into shreds. I got my kids to help with this part, they loved it! Breaking the paper up like this will help it to saturate faster.
  4. Place the paper into a large boiling-water-safe bowl and pour the boiling water on top and give it a quick stir.
  5. We'll come back to the soaking paper later.

Build the frame:
  1. I cut a 1x2 we had lying around with 90deg. angles to the desired size. One mistake here was, I should have added a margin for error so that I had room for trimming the edges when the paper finished drying. I think an extra 1/2" in width and length would be plenty for trimming. Also, I used a skill saw instead of taking the time to break out our chop saw. It's hard (at least for me) to make accurate cuts, let alone accurate diagonal cuts using hand power tools. I knew this was a trial, so I just went with it.
  2. Next, I screwed the four sides at the corners. I used a 2x4 block to help keep things square during the screwing process. 
  3. I then measured diagonally for square and had to make a couple of minor adjustments by slightly loosening and tightening specific screws.
  4. I salvaged the screen material from an old window screen we had lying behind our shed. It was not perfect, but was good enough for the learning process. Like with the chop saw, when I get ready to build a set of production frames, I'll run to the big box and buy some new window screen.
  5. I attached the screen to one side of the frame with far more staples than I probably needed.
  6. Then stretched the screen around the front of the frame and attached the opposite side. I should have rinsed the screen first, as this turned out to be a dirty set of steps.
  7. I stretched the next side and secured it, then I folded the corners to keep everything nice an neat.
  8. Next, I stretched and attached the last side. 
  9. Lastly, I washed the whole frame, hoping the dirt and grim would not attach itself to my soon to be paper.
 Making the pulp, Part 2:
  1. Take the now saturated pulp and drop it into your favorite blender/food processor. I kept the batches to less than half our blender at a time.
  2. Add enough water to be sure the paper will blend.  I don't think there is any danger to using too much water in this step, though this was my first attempt, so....
  3. Blend away, until you have a nice smooth sludge.
  4. Pour the sludge into another bowl for safe keeping.
  5. Rinse & repeat, until you have blended all of your pulp.
Making the paper:
  1. Get a water proof box of some sort, I used a plastic bin we had in our garage, and fill it with a few inches of water. 
  2. Add a bit of liquid starch. This is not corn starch. You can find it in the cleaning section of the store, near the ironing stuff. This will "final" or "finish" the paper, allowing the ink to stick to the page without it bleeding and soaking through. I did not have any on hand, so I skipped it this time. I'll get some for my next attempt.
  3. Add your pulp. For my first attempt, I made the mistake of just adding it all. I think a measured amount will be key for making a consistent page thickness.
  4. Give your water/pulp a gentle stir to thin out the pulp and watch for big clumps. You'll want to remove any you find.
  5. Submerge your frame in the concoction and give the water a few seconds to settle. You'll see the pulp even out on the surface of the water. 
  6. Slowly lift the screen. Since mine is made of wood, it was buoyant and naturally floated. I found it helped if I left the screen *just* submerged, maybe an 1/8th of an inch to allow the pulp to settle on the screen.
  7. Slowly lift the screen out of the water and let the water drain out.
  8. Lay a towl on your counter and set the frame on top.
  9. Carefully lay another towel on top and start gently pressing the towel onto the paper.  Once you have the initial amount of water pressed out, it seems safe to start pressing harder. The goal here is to draw out as much of the water as possible. I've seen some people recommend using a sponge on top of the towel to draw out even more water. I'm thinking I'll get one of those squeegee towels that are super absorbent and wring out well.
  10. When you feel like you have removed as much of the moisture as you can, it's time to carefully pull the paper off the screen. One blog I read said to flip the frame and the paper should genitally fall off. This was not the case for me. Either my screen was too course, or the pulp that bleed between the screen and the frame prevent this all together. Either way, I had to get in there with a butter knife to peel up a corner, then I slowly pulled the paper off the screen. While the paper was somewhat fragile, it held together much better than I feared.
  11. Place the freshly peeled page onto a towel or parchment paper to dry a bit longer. From here, some people suggested hang-drying. I was impatient, so I heated the oven to 170 degrees, placed my pages inside and turned the oven off. This worked pretty well, though I will probably skip that with my next trail.
  12. Finally, when your paper is thoroughly and completely dry, trim your paper! My wife had a crafting paper cutter with a blade that follows a track. This made for nice clean edges all the way around.

What are my takeaways. I still have more to figure out. I need to fix the process of making and removing the fresh paper. Then I can focus on getting a consistent thickness. Finally, I'll start playing with pulp materials to work on the texture and color. I'm happy with using recycled paper, but I may experiment with plant based pulp as well.