Saturday, September 13, 2014

Samsung Galaxy S3 LTE and VOIP Microphone Issue

I heard about FreedomPOP from my brother, basically you get 200 minutes, 500 Texts and 500MB data free each month. They use the Sprint network and support 3G & LTE. The way it works is everything goes over the data connection. Calls are routed over VOIP and texts are about the same. This actually works really good for me as I get basically no service at home on Verizon or Sprint, but I have good WiFi. It will route over any available internet connection, so you could even use it overseas (on WiFi). There are some issues I can't resolve ATM. Here's What I've run into so far:

I'm running a SlimKAT 7.0 on a Samsung Galaxy S3 (Sprint), so these may or may not work for you. I TAKE NO RESPONSIBILITY IF YOU BRICK OR DAMAGE YOUR DEVICE!

Problem 1 - No LTE

No LTE, 3g works fine, but when you get an LTE Connection you don't get an IP. This is an APN problem. LTE Works fine on stock, but not on SlimKAT / CM11 (tested).

Solution:  You have to activate on stock (you should have a nandroid right?). After you've got everything working on stock you have to backup your APN list, then flash your custom ROM.
Next you have to restore your APN list, reboot and LTE will work! Unfortunately it's harder to do than it seems. an unprivileged app can no longer write to the APN list. So here's my solution (you may or may not need to do this on stock to read them):

  1. Make sure your phone is rooted (and has supersu or something on it)
  2. Install APN Backup and Restore from the Play Store.
  3. Install ES File Explorer File Manager from the Play Store.
  4. Launch ES File Explorer and in the setting enable "Root Explorer"
  5. Navigate to "/data/app" and long press and "cut" "com.riteshsahu.APNBackupRestore-1.apk"
  6. Navigate to "/system/priv-app" and paste the apk file there. 
  7. Long press on the apk and hit properties. Permissions should be "rw-r--r--" Owner and Group should both be "root"
  8. Reboot
  9. Open APN Backup and Restore, close the ICS warning, hit menu, then disable ICS checking.
  10. Now you can backup and restore your APN's

Notes:

  • If you're restoring you may want to make a backup, delete the APN's that came with your ROM, then restore the stock ones. 
  • You may need to find and move the stock file with ES File Exporer if it didn't save to "/storage/emulated/0/ApnBackupRestore". 
  • I don't recall where it saved them on stock, but you may want to find it and make sure it's not going to get deleted when you flash. 
  • Reboot when you're done.

 Problem 2 - VOIP Apps use top microphone

I fought with this for quite a while, in the freedompop messaging app I could turn on various settings and it would work until they updated the app, then it would require a different set of options. I thought it was a freedompop problem until I started playing with the new Google Hangouts. It only used the top microphone, and there were no options to fix it.

Solution: It's a build.prop issue.
  1. Install Build Prop Editor From the play store. (or use whatever method you want)
  2. Change "persist.audio.handset.mic" from "digital" to "analog"
  3. Reboot 
Note: I removed some lines in "/etc/audio_policy.conf" related to VOIP before finding the build.prop issue and it didn't fix it. But it may have changed things, I'm looking into this.
UPDATE: Just confirmed from my brother - the build.prop edit fixes the problem.

Problem 3 - Amazon Music Won't Play Downloaded Prime Songs

Symptoms: Streams Prime music fine, plays music I've bought and downloaded, plays MP3's from the phone fine, crashes when trying to play Prime Music I've downloaded.

No solution so far.

Monday, May 26, 2014

Adventures in 3d printing Or "I Finally Built a RepRap!"

I've wanted a 3d printer for quite some time. A few years ago I stared building one that, to say the least, was poorly engineered and under constructed. It never actually worked at all. Some of the designs could have worked, especially in a large CNC machine, but were just not a good fit for a small 3d printer. I've been eyeing the RepRap i3 models for a while now, last week I bought a kit (less electronics).

RepRap i3 with cooling fans and filament spool.
Note spool is on backwards to allow for the sloped ceiling in my lab.


Assembly was quite straightforward, there is a partial guide, though it skips (or I missed) some key steps.

A few tips:

  • Final alignment of the XZ (vertical) frame should be done after assembly. Just line it up so the extruder will reach the front and back of the Y frame and is square.
  • I printed thumbnuts to fine tune the bed leveling, it makes it really easy to get it spot on. I used these "Easy Heated Bed Leveling Thumbnuts"
  • The Z axis endstop was a pain, part of it was I used the wrong mount, but I printed this "Adjustable Z-Axis Endstop Arm" to make it easier

Fire in the Hole!

Everything I (and probably everyone else) build has some "teething" issues. I had (and am still having) a few. After I got it set up fairly good I started a print and it seemed to be working nicely, then the Sanguinololou literally caught fire (there were flames). The bug list for the Sanguinololou says the traces for the heated bed are too small, so I had reinforced them with wires before this point, it was the wires that caught fire. Turns out the mosFET shorted and the bed just stayed on continuously drawing ~16A. I salvaged the board and put a new mosFET (all I had on hand was a 12A logic level one) put it back together, set it to pwm at 50% and it lasted about 30 seconds before shorting too (I was watching this time). I swapped it again, added a reverse diode and ran it through an automotive relay (so the mosFET turns the relay on and off). That works really good.

Electronics, complete with rats nest

Now that the fires were out It was time to try some real prints. The filament won't stick to the bed. No matter what I do it won't stick. I tried cleaning really well, nope. gluestick helped, allowed me to print the upgrades I mentioned, but was hit or miss. I researched, tweaked settings, spent the better part of a day on it. Finally my brother was over and (looking on his tablet) said "they say here that Reprapper brand glossy black PLA won't stick to glass, use blue tape". Yep, I had Reprapper brand glossy black PLA filament, and yes, it sticks really well to blue tape.

A Sheep! Here's the first print that I took a picture of.

A few remain

Now I can print, I've still got a few issues left, mostly "dialing in" problems.

  • Overhangs and bridging don't work quite right. I've been lowering the extrusion temperature and it really helps. I started at 200C and am down to 180C for the first layer and 175C after that. A box fan after ~5 layers helps even more.
  • I printed some large parts and they warped, pulling the blue tape off the glass. The cooling fan bracket printed really nice with the 182C/177C and bed at 35C settings. this might be licked, but can't say yet. 
  • The first layer of big parts will bunch up a bit during infill, leaving stuff sticking up that can catch the extruder. If it gets 3 layers or so it will bury the problem and will complete fine. I might still be a touch close on my z-axis start point or it might be something else.

Future plans

  • Upgrade to optical endstop for Z-axis. It should be considerably more repeatable than a mechanical endstop, so I think it would be a big improvement. The X and Y axis are not nearly as critical, so I don't see any need to change those endstops.
  • Upgrade the electronics so I don't need a computer hooked to it and add cooling fan support. I've got several options: MosFET board and sd adapter, MosFET board and android tablet, Panelolou (includes Mosfets on the interface board and SD on the panel). I'm leaning toward the tablet option. The software looks really cool. I need to try it sometime.
UPDATE: I printed a bracket to mount some 40mm cooling fans, but all my small fans are 50mm, so I printed a 50mm bracket. Seems I chose one bad fan (rattles) so I'll have to replace that at some point. It makes a huge difference. I'll do another post on integrating it with the electronics.

Links

http://www.thingiverse.com/thing:208137 - thumbscrews
http://www.thingiverse.com/thing:267927 - Z-Axis Endstop Arm

Sunday, March 2, 2014

1997 Dodge Dakota PCM Repair

My transportation situation in 2014 has started out bad. My car decided it doesn't want to run when on pavement anymore (works fine in the driveway). I'd been two weeks trying to fix it (along with working a 50hrs/week and studying for CS50x) when my truck started stalling randomly. The first time I was pulling out of the driveway on the way to work, it cranked for a minute then started and ran fine. The second time (same day) I was driving through town on my way home from work and it just started coasting. Fortunately it re-started just as I was preparing to coast onto the shoulder. I got home and pulled the codes.

Diagnosis

  • P0320 - Crankshaft Position Sensor
  • P0351 - Ignition coil A
I know I pinched the CPS wires when I put the transmission back in, I just hadn't got around to replacing it. I searched for P0351 and it seems it's usually not the coil, but the PCM failing. I also found that there is a header in the PCM that can cause stalling problems. It's on the voltage regulator board.

I replaced the CPS and coil just to be on the safe side. Then started it up and wiggled the wires at the PCM. The center (white) connector would cause it to skip. So I pulled the PCM and re-soldered the header (see links).

Repair

What a pain that was! it's mounted to a aluminum plate that sucks the heat out of the connector. I ended up with a hot air rework gun at 300C and my soldering iron at 400C. It barely melted the solder, even after heating it for a few minutes! If I do this again I'll put it on my BGA rework pre-heater (electric griddle) and heat the whole board up!

1997 Dodge PCM Voltage Regulator Daughter Board?


Anyway, I reassembled the PCM and sprayed all the connectors with De-oxit. Wiggling the wires no longer has any effect on the engine. At least I'm (hopefully) back to one driveable vehicle. If I have to I'll try to pull the board under the potting and re-solder that too, but for now it seems to be working again.

UPDATE: It worked for a while, but started acting up again. I bought a used one off ebay and the truck has run great ever since. I pulled the main board out of the case and started cleaning the goo off it, I think it's the connectors where the harness plugs in, but that's as far as I've got.

Links

CS50x

Late last year I signed up for CS50x from Harvardx on EDUx.

So far it's an interesting course. When I signed up I thought we only had 12 weeks to complete it, but it turns out we have an entire year. Which is great because I started a full-time job three days after CS50x started! I've been putting off writing about it, but I want to get started. My progress is slow, as I'm working 50+hrs/week and trying to keep up with everything else (car broke down the first week, then the truck, you get the picture).

I'm going to do a post on each Problem Set, and try to describe and explain the issues I ran into and how I solved them, without violating the cs50x policy of course (no complete solutions will be available here). Remember, I'm new at this, so my solution may not be the most efficient nor elegant by any means. But it should work.

Overview

The lectures have a lively feel to them and are available in many formats, I have been streaming the videos from the courseware page and occasionally downloading the mp3's to listen to on the way to work.

The shorts are really cool 5-10min explanations of things related to the course. Did you know that in ASCII to change from capital to lower case (and vise versa) only one bit changes? Yep, it was in a short.

The appliance is a virtual machine running Linux with a selection of tools to help you. I used virtualbox under Arch Linux, but it runs on Windows, Linux and Mac. It could be really slow on old or low-powered systems. it's a bit slow on my HTPC, but OK on my laptop. It took a while to get everything running smoothly, but that was mostly vitrualbox issues rather than appliance problems.

The problem sets start easy (scratch) and get harder really fast, but it's supposed to be a challenge right? There is a standard edition and a hacker edition, only the standard counts toward completing the course, so I've concentrated on them. I'll go back and do the hackers as time permits (or when I'm procrastinating on the final project).

The final project is a dilemma for me, so far all the ideas I've had fit one of these categories: too simple, too complicated, already been done, or not sufficiently interesting to me. Hopefully I'll come up with a good idea before I'm through with problem sets.

Links

http://www.reddit.com/r/cs50/
https://www.edx.org/course/harvardx/harvardx-cs50x-introduction-computer-1022

Sunday, November 24, 2013

Belkin F7D7301 DD-WRT & OPTWARE

I've been using a Buffalo wzr-hp-g300nh as my wireless router for about a year and a half, before that I was using it as one end on a 900ft link with a bi-quad antenna attached to a small satellite dish. It provided internet to my sisters house. All in all it's been a good router, but it's had a rough life and it was starting to show. The 2nd Ethernet port intermittently stopped working and it started dropping the wifi randomly. I'd mess with it, upgrade the firmware and it seemed to do OK for a while (on the WiFi, port 2 was completely dead at this point). Then it would start in on the same old problems. I knew it was failing so when I saw the F7D7301 for $25 shipped I bought one to have on hand. I paid $80 for the buffalo, and I like it better, but it needs to work. As far as specs go they are very similar.

Belkin F7D7301

Belkin F7D7301 Specs:

  • Broadcom BCM4716 CPU @ 450mhz
  • 64MB Ram
  • 8MB Flash
  • 32K NVRAM
  • Wireless N 2.4GHZ radio (up to 300mbps), 2 internal antennas
  • 5 Gigabit Ethernet ports (1 WAN, 4 LAN)
  • 2x usb ports
  • Supports DD-WRT and OPTWARE

DD-WRT

DD-WRT is easy to install, I tried to follow the instructions from trythistv.com, but I couldn't get to the CFE page, probably needed a hub, so I just uploaded the mini version from the Belkin firmware upgrade page. It worked just fine. After it rebooted I put a Kong build on it (r22200/usb-ftp-samba3-dlna-nv32k-broadcom.bin). That worked too. I did my normal config run through.

Config

Note: I recommend you investigate and test each option for yourself, I may be doing something stupid in here and not know it. YMMV

Basic Setup Page:
I use a slightly different ip range on my internal network, so I set that up

I use DD-WRT to cache DNS requests, so I turn on local-dns and add my router IP to the first static DNS (I don't know if it's needed or not). I check "Use DNSMasq for DHCP", "Use DNSMasq for DNS" and "DHCP Authoritative".

I set up the NTP for my timezone and use "0.north-america.pool.ntp.org" as the server.

Wireless Basic Page:
In Wireless it defaults to channel 6 (my neighbor is on 6), I use 40mhz width, upper extension channel and 11 as the channel. NOTE: You need to do it in that order and press save each time you change one of these settings, it will reset and / or not show options if you don't. (that really aggravated me until i figured it out)

Wireless Security Page:
WPA2 Personal, TKIP+AES

Wireless Advanced:
I'm using the defaults at the moment, I've barely started tweaking these yet.


Services Page:
I enable "DNSMasq", "Local DNS", and "No DNS Rebind".
I add:
cache-size=2000
no-negcache
to Additional DNSMasq Options

USB Page:
I Enable "Core USB", "USB Storage", "Automatic Drive Mount"

OPTWARE

Disk:
I used a 4gb thumbdrive with a ~3GB and a ~500MB partition.
The 3GB is ext2 and the Label is "Optware"
The 500MB is Linux-Swap and the label is "Swap"
DD-WRT detects and mounts them properly to /opt and as swap.

Install:
First I used "Optware The Right Way", got it all going and realized it was outdated and there is now "Optware The Right Way , Take 2". So I re-did it with that. It went smoothly, I enabled the services I wanted (with the "service" command). Disabled the one that oddly comes enabled that I don't think should: "Transmission", the bittorrent client. 

Well I tried to anyway, I stopped it, turned it off, and rebooted. It seemed fine, but something was using 100% of the cpu. It was "gunzip" trying to extract "level1.gz", the bittorent block list. I tried to stop it, but it refused, it kept coming back whenever I rebooted. So I figured I'd just let it run. 5hrs later the CPU was still pegged at 100% with "gunzip level1.gz" at the top of "top". I don't need bittorrent at all, I don't use it, and if I did I'd use it on my little server that runs 24/7 anyway. I figured I'd uninstall it. "ipkg" complained it needed jffs, nope wrong command. "opkg" claimed there were no packages installed. It was opkg on atheros, I thought it was ipkg on broadcom. So a bit of hunting and I found it was "ipkg-opt". I removed Transmission, rebooted and now it's apparently enabled as a service again, but at least it's not hogging the cpu anymore. Why won't it go away?

Services I am trying at the moment:
Asiablock
Stophammer
Fixtables
pixelserv

I tried mypage, which is cool, but seems to be a bit of a resource hog so I disabled it, I can turn it on if I need info from it.

Wall Mount

One other issue I had with the Belkin is it only has a stand on the bottom. The buffalo would mount neatly to the wall. I removed the stand, bent a little piece of metal I had lying around to attach the Belkin to the wall. It's not pretty, but it works (and the bracket's out of sight).


Notes:

  • I think the Kong stuff is now in the main DD-WRT source, so I don't know what the best place to get a build is anymore. (probably not a kong build anymore, Arhhh)
  • I'm sure there are some errors in here, I don't mess with routers much (as long as they work right?).

Links


Thanks! DD-WRT and OPTWARE folks! Thanks to you we can turn a crappy router into an awesome router, basically a miniature, full featured, headless server!

Friday, October 18, 2013

Electric Fence Charger Repair

Electric Fencer
My parents keep some goats. An electric fence is the best way they've found to contain them. Basically you run multiple strands of metal wire around the field supported by insulators, then hook it up to a "fencer" that pulses a high voltage, pulse through it once or twice a second.

Never Do This (rant)

I've heard of people just hooking the (fence) wire up to a 110/220 volt line. That's a dangerously bad idea! Grab a line hooked up to a fencer and you'll get a jolt, but it's intermittent, and it won't kill you (pacemakers / various health conditions excluded). Grab a 110VAC line in wet boots and you're going to have a very bad day, you could DIE! or your kids, or whoever, it's a really really bad idea! DON"T DO IT!

Back to the topic

Lightning is a potential problem with these as they have electronics in them and they are hooked to (potentially) several miles of wire. A strike within a few miles may well induce a serious spike in it. They are pretty rugged though, as they expect to have thousands of volts present during normal operation (20KV insulation is specified for the hookup wires).

Anyway, we've been using this one for years (10+?) before it just stopped working. We've had to replace the fuses several times, and they were blown, but replacing them didn't fix it this time, so I took it apart. We swapped in a new unit while this one was broken, as we had no way to tell when or if I could fix it.

Operation (seems to go like this, I could be wrong)

  • 120VAC is run through a transformer that (I think) both steps up and down the voltage (I didn't test this, and couldn't see any markings) There are fuses and MOV's on the a/c input for protection / filtering. 
  • The high voltage feed is rectified and charges the big capacitor. (there could be some flyback or something going on here too, idk) The low voltage is rectified and powers most of the circuit board. (probably some regulation in here)
  • The large cap is discharged by the SCR through a second transformer that steps the capacitor voltage from hundreds to thousands of volts. The output is connected directly to the case (ground) and a heavily insulated terminal (fence). The case is grounded by multiple grounding rods with the first no more than 20ft away.
  • The whole unit is built into a grounded metal box (Faraday cage?), there should be no arcing inside it (or anywhere actually), but there is a very audible "Tick" when it's working. A wire, grounded to the case, placed near the insulated output will jump a bright blue spark over 3/4 of an inch!

Diagnosis

  • This isn't something I want to test on my bench, as the voltages / EM pulses could easily damage my test equipment. 
  • Fortunately it's a pretty simple circuit, so it's not that hard to figure out. 
  • A visual inspection didn't turn up anything obvious. 
  • A few minutes tracing circuits indicated that the TO-220 SCR (2n6509GOS) would be the place to start (this would take the brunt of a surge on the fence loop). 
  • I tried to test the SCR in-circuit. It failed, but I couldn't be sure the other components weren't interfering so I removed and tested it. It still failed. So for ~$1.50 I ordered a new one and now it works!

If you mess around in one of these be very, very careful! High voltages all over the place! That cap looks like it could kill a horse!

Top PCB
The main (active) components were the 2n6509, a 2n6028, and a LM324. I ordered all of these, but only needed the SCR.
Bottom PCB
The SCR is a 2n6509GOS 800V 25A
Failed SCR, Doesn't look damaged, but it tested as failed, and replacing it restored the unit to operation.

Links

http://www.circuitstoday.com/how-to-test-an-scr

Friday, September 27, 2013

Underground Leak Location (Failed, but interesting)

My brother has a water leak in the plastic line between his house and the street. We don't know where the pipe runs and haven't been able to find a wet spot. It's not a huge leak, so he can just shut it off at the meter most of the time.

Cool Little Amplifier

The first problem is locating the pipe, we know where it is on both ends, but there's 400ft and a concrete driveway in between.

Options

  • I found ground penetrating radar first, but it would cost way more than just running a new pipe to buy and it's well out of my capabilities to build. Maybe in a few years, but we don't have that kind of time.
  • Metal detectors don't work on plastic pipe unless you put something metal in them (steel cable), which requires disconnecting the pipe. If we had a metal detector this would be a reasonable starting point. It's still on the table, but we have other options to try.
  • A smaller wire could be pushed down the pipe and connected to a small transmitter. Then a receiver would locate the signal and pinpoint the pipe.
  • With a ground microphone and an amplifier it's possible to listen to sounds under ground. A wrench or solenoid can be used to tap on the pipe, which will transfer down the pipe a ways and (hopefully) be audible near the pipes location. The leak may also be audible within a few feet.
Schematic - Pretty much exactly as in the source link

I've build a amplifier based on a circuit for an amplified ear I found on the internet. It seems to work good, but I'm having a real problem with the microphone. It will pick up sounds from all over, but nothing from the ground. I've tried several different ideas to transfer the sound, but so far I've come up dry. I think a piezo buzzer element is the key, and I managed to break the only one I had. I've got several more on the way, but it will be at least Saturday, probably Monday before I have them. We can't start digging before Monday (call-before-you-dig), so I'm hoping for Sat.

Prototype and RevA001 PCB

Results So Far

  • It's a really cool little amplifier, Q3 varies the gain of Q1 so that faint noises are highly amplified and loud noises have little amplification. If I can sort out the microphone problem it should work really well. It would also work great as an electronic stethoscope.
  • It doesn't seem to work as I intended to use it. I really need the digikey parts before passing judgement, but I think it should have a variable bandpass filter in it to isolate the desired noises. I can hear all kinds of stuff, but not what I'm listening for.
  • I ended up connecting a piece of wire to a fish tape, shoving it down the pipe and hooking a arduino clicking a relay that shorts a (low output) battery charger across the wire to transmit a clicking noise. I only had a 50ft tape so I couldn't trace much of the line, but it looks like a bee line. I used 30 turns around a cool-whip container (approx 15cm diameter) connected to the microphone input to listen for the clicks. It (barely) picks up the clicks, but AC lines are VERY obvious (loud buzz). I think I found the pipe and the end of the tape, but gave up as I didn't feel I was accomplishing anything. I could divide the pipe into (up to) 8 pieces and find the leak, but that would mean 8 potential future leak points (and 8+ holes to dig of unknown depth).
  • Unless the digikey parts are here tomorrow and I locate and fix the leak (unlikely) we're digging in a new line with a trencher on Monday. It's not looking good. I'm not shelving this project yet though, it would be very useful for locating noises in various equipment and it should work for finding pipes, if I can come up with a working mic. Perhaps I'll modify it for a bandpass filter too. 

Notes

  • R1 is specified as 10K, but my mic element specified 2.2K and worked much better with that. For the piezo transducer and the wire coil I disconnected the resistor.
  • The audio jack is connected with wires, I didn't have time to make a footprint for the one I had.
  • I did the PCB in a hurry, and I really should redo it, I make no promises as to it's performance.
Underside of PCB

Links