Wednesday, July 21, 2010

Surface Mount Board Reflow

I have been doing hardware design and prototyping using surface mount devices for quite some time.  I have tried many method of reflowing boards but I've found both the oven method and "hotplate" method to work quite well.

In the past I have been managing the oven and hotplate via a thermocouple and PID controller but I decided to move to a full ramping controller to make the process less labor intensive.

Old Reflow setup; digital controlled hot plate


I purchased the reflow oven controller kit from sparkfun, overall it works ok; the software is good but the hardware has some flaws.  Most notably is the driver for the relay; they're using a BJT which doesn't seem to want to drive the relay coil reliably (even after modding the base resistor).  I solder a mosfet in its place (note the uglyness in the pic below) I used a n-channel mosfet I had kicking around in my junk box.  Another flaw is their choice in relay; the one that was shipped to me didn't have blade connectors on the top (as pictured on the site) so I had to solder wires on the bottom (not very elegant).



The controller didn't work well for the hotplate; the hot plate has too much thermal mass and the control loop on the temperature controller is too simple to compensate.  The controller does work quite well for the oven (for which it was designed).

Oven with temperature control

The plan is to mount the controller in the oven chassis and run the LCD and buttons to a new front panel.

Results using this system have been good; I have been soldering the processor I'm using for a design (LM3S6965) in a TQFP-100 package; results have been good.  Minimal reword required; just wicking a few solder bridges.

TQFP 100 solder with the oven and controller

Powder Coating


Update2: Description, Schematics and boards
http://thegreatgeekery.blogspot.com/2011/10/powder-coating-system-mk-ii-progress.html


Update: added some more details
http://thegreatgeekery.blogspot.com/2010/12/powder-coating-build-follow-up.html

So over the last few months I have built a number of powder coating guns as well as a powder coating oven. I'm trying to make something better than the $60 harbor freight gun, from what I have read the HF gun tends to not give consistent powder output and struggle with multi coat.


Mark I:
This gun was inspired by this design http://hackaday.com/2006/07/05/diy-powder-coating-gun/
The overall design was pretty much the same; I used an old toaster oven to bake it. It worked ok, but the voltage was too low to get good powder adhesion on additional coats, and it was hard to clean and didn't put out a consistent powder flow.


Mark-I ghetto gun


BMW E36 caliper support brackets (before and after)


Mark II:
The second prototype moves the high voltage electronics into a separate unit; I also added previsions for a variable voltage supply, solenoid controlled air supply, and a separate powder chamber. Results were pretty good.  Its still very much a prototype, for the next revision I'm moving things around and sending PCBs to be made.

Main Power Supply and Control system

The system as I use it; lots of hours on it now.

Here is a picture of the power supply; There are three stages; a generic 110VAC to 36VDC 3A power supply; Provisions for an adjustable stage (36V to 10-32VDC 3A); High voltage step-up stage (10-32VDC to ~25KV done in the switching power supply section)



The AC-DC input stage is built around a standard toroid step down transformer; full bridge rectification and capacitor bank. The supply is controlled by a switch on the front.

The adjustable stage is currently not implemented; instead I have simply added a 12VDC regulator used for supply of the switching section of the HV supply and for the actuator control. In the next revision I will be adding the variable voltage control using a standard adjustable regulator (LM317) with pass transistors to provide additional current. This stage is controlled via a relay which is controlled by a switch on the gun.

The high voltage step up stage is basically a switching power supply driving a flyback transformer out of a CRT computer monitor. The frequency and pulse-width of the drive circuitry is tuned to match the transformer. I set the duty cycle to 20% and adjusted the frequency until maximum output was observed (by measuring arc length). A 555 timer was used for pulse generation; it feeds a IRF240 power mosfet which drives the primary winding of the transformer. The primary winding was made by wrapping 8 turns of 14 gauge transformer wire around the ferrite core of the transformer.



The flyback transformer is directly connected to the tip on the gun via 50KV high voltage wire bought off ebay.

The air supply is set via an adjustable regulator on the front of the chassis; after the regulator the air is connected to a solenoid which is activated by a switch on the gun.

Flyback and air control


The regulator air supply is fed to a powder container; it feeds at the bottom of the container in order to fluidize the powder; the powder then travels to the gun.

Third itteration of the powder pot; this one is quite solid and works very well

The gun its self is very simple it is simply PVC fittings which allow for attachment of various nozzles. The nozzles were purchased from powder by the pound (they're cheap ~$12 so It was easier to buy rather than build).  I've added a switch to the gun (not pictured) which switches on the HV and air.



When it all comes together I have had some pretty good results; powder attraction is much better than with the Mark-I gun and powder flow is more consistent. Multiple layers work well (tested up to three layers so far).

Oven:
 
Powder coatingis great; but the hard part is getting a big enough oven to cook the parts in. I ended up building my own oven from sheet metal and steel studs. Since I wanted to keep costs low I used left over bits from various projects and friends and family. It turned out pretty good; it doesn't look like much but it heats up quickly and holds its heat well.

Oven; inside dimensions 2' x 3' x 4'
240V 30A

30A contactor for controlling the elements

Auto Tuning PID temperature controller for driving the contactor


Some formerly brass trim from my fireplace (ready to be cooked)
For temperature control; the elements are fed by 240V at 30A; they are connected via a electrical contactor which is controlled by a auto-tuning PID temperature controller.

 


Powder Coating System Mark-III:

I've started building the MK-III version of my powder coating system. Here is the plan.

Features
- Move to larger 19" rack mount chassis
- Provisions in chassis for second regulator and PSI gauge for future addition of powder pump.
- Adjustable low voltage DC supply in chassis, all HV moved to gun
- Switching supply and AC fly back mounted on gun
- 5x Voltage multiplier on gun to bring output voltage up to 100KV for large number of coats
- Use custom PCB for switching supply;
- New Gun cabling using circular connectors
-

Monday, July 5, 2010

e36 M50 Manifold Swap





A few pics from the swap I did on my 1996 BMW 328is. I modified the M50 manifold such that all of the existing M52 piping works without modification.

This was accomplished by cutting the base of the M50 manifold such that it will accept the M52 ICV and oil separator mounting plate. I made an aluminum bracket (powder coated flat black) to allow the M50 manifold to mount to the M52 motor.




Posted by Picasa

Coffee Roasting

So I've been roasting coffee on and off for a few years. Below is a picture of my original method using an air-powered popcorn popper. I modified it such that the fan can be controlled independently of the heater. To make things simpler I experimented with different methods of temperature control. The picture below shows the Sparkfun electronics reflow oven controller connected to the popcorn machine. I programmed the reflow oven controller with a profile for roasting beans. It works well and allows for consistent hassle free roasting.






The big drawback of the hot air popper for a coffee roaster is the limit on the amount of beans you can roast at once. I rigged up a larger capacity roaster as seen in the pics below. It is essentially the pan and drive of a bread machine, an exhaust vent to take care of the chaff, a heat gun to provide the heat, a thermocouple and temperature controller to run the show. Results were good; consistent roast; no user intervention required.



Thursday, February 19, 2009

Fixing PS3 WIFI video pausing and other glitches.

I recently ran into an issue streaming video to my PS3. I had TCP re-transmits ( killing the UPNP connection ) and video pausing occuring destroying any enjoyment of my streamed video. I also use XMBC as a client and I can say that in most cases it's the PS3 firmware it's not buffering enough or is just too sensitive to lag, given the same server will work better with XBMC. The other thing is that you really have to transcode just to rate limit the data stream to around 4-6mb for any consistancy in playback. If you don't transcode, hit the triangle key and check the bitrates out, you'll see it burst upwards of 25mb or more and much choppier playback and long delays.

My gut feeling is that the latest PS3 firmware as of March 2009 is the socket buffering and app level video buffering or a combination is causing the problem. It's also sensitive to drops of UPNP server with cryptic errors messages ( really annoying ). If it is a result of our server setup then there are a few things we can do ...


So first a word on my setup, I have a Via C7 server running mediatomb ( UPNP server ) transmitting via a router to my PS3 over 802.1g. I also run the Java based PS3 MediaServer which is a zero config service highly recommended. The simple issue is that transcoding must be enabled to ensure consistant playback on the PS3 but I'll go through all optimization tricks first ...

My network is something like this ...

[Server] <.... 100 BaseT Ethernet wired ...> [ WiFi Router ] <..... 802.1g ...> [PS3]

Potential problems with over the air video transmission


1. Wireless packets lost due to channel interference, noise etc.

- 5 or so neighbour WiFi routers , nothing too serious
- I choose a channel far away from '6'!
- I boost power output to 80 milliwatts
- I have a mixed mode Wifi net. b/g/n devices are active
- microwave ovens, wireless phones,wireless keyboard, bluetooth etc.

So I have a few electronic gizmo's that could all interfere with the signal. I'm kind of stuck with what I have from a wireless perspective and still notice video pausing. tcpdump captures confirm TCP resets, there is no 802.11g packet drops though so it's down to buffering, over the air corruption causing my issue. So 54mbps get's me 6.75MB per second thruput in theory, reality is probably less than half this around 3-4MB per second. If you press the 'triangle' button when streaming a video on the PS3 the top bar will show the stream rate. It's handy because it will give you a rough indication of the bursty data that is likely causing delays/pauses.

I saw lots of pauses/drops with TVersity none transcoded camera video ( m-jpeg ) ~35mbps rates.

I saw less pauses but still a few with divx encoded files that burst from 4-16mbps

I saw practically none when transcoding and enforcing bit rates to keep it below 6mbps.
audio rate= 192k
bit rate=4096k

Regardless of the root cause of these issues, there is a pattern the higher the bit rate, the increase in pausing and connection drops occur. The issues disappear when I enforce the transcoding. I tested streams on the laptop running XMBC this allows you to eliminate problems with PS3 and server ( it was also pausing ... ) but in general I found XBMC slightly better as a client.

There is also likely some performance issues with my setup so first lets get rid of the obvious issues like file access times, transmit delays e.g. buffer sizes ...


Kernel Tweaking using sysctl.

To modify the scheduling we'll have to rebuild the kernel, we'll do this later but it's not the bottleneck or problem for my wireless packet issues. We can use a server edition of Linux or compile the kernel for server mode. First lets do some hacking of the TCP stack and file system just to try and get some performance boost at the cost of time stamping, memory consumption etc.


TCP read/write buffering is 4k by default in Linux and the max TCP out of order counts is 3. So lets beef up my TCP buffers and allow a few more out of order conditions to persist before a TCP reset occurs ... Do a Google search on this to get a rough idea of what is being modified, then come back and randomly hack away at your setup just for fun ... test video's and other services to ensure you haven't bust anything... So you have some kernel parameters and values to changes lets head to the file /etc/sysctl.conf and change the read/write buffers for TCP


net.ipv4.tcp_rmem = 8192 87380 16777216
net.ipv4.tcp_wmem = 8192 65536 16777216
net.ip4v.tcp_reordering = 6

I also want to reduce the overall level of 'swapping' to disk. swappiness default is 60 in Linux 2.6. To truly test this, you'd have to run some heaving execution over time. Also don't modify it if you have less than 256mb probably pointless ...

vm.swappiness = 40

Not required but you can change the default TCP algorithm from 'reno' to others that offer superior TCP stack behaviour. It's not an issue I don't think unless your handling thousands of TCP connections and want to maximize performance but you can change the TCP algorithm:

net.ip4v.tcp_congestion_control = cubic

Filesystem tweaking

I also could do with tuning up my filesystem so access times are faster, rather than the default mount settings. The biggest change that everybody insists you should do , is to remove the access time stamping on the filesystem. This is easy, you basically add the option 'noatime' to your mount and voila you should see a big boost in performance of the disk I/O. So in your /etc/fstab file you can pick your mount you'd like to tweak e.g.

$ umount /data
/dev/sda2 /data ext3 noatime,nouser,exec,suid,errors=remount-ro 0 2
$ mount /data


Optimize directory structure, indexing ...


man e2fsck and look at the -d and -f options for details. These options will order your disk directory indexes more efficiently and it's a quick and dirty method of getting some bang for buck performance ...
$ umount /data
e2fsck -d -f /dev/sda2
$ mount /data


Recompile your kernel and optimize for server mode operations


This will get you a few boost points. First we need to check what board/cpu and card configuration we have so we can enable all the associated drivers by default ( faster boot/initialization ). We then turn on some options that should make it run a little faster than a standard distro for server use at least. I'm still using the AS scheduler but there are some 'server' options you can set, enable all board drivers etc. The only thing I noticed after kernel recompile was server data transfer rates increased significantly, torrentflux downloads where pretty fast with barely any CPU utilization, VLC reading over Samba I was getting 7.5mb fairly constant read rates and demuxing at 2.5mb didn't try HD but you get the idea. There's lots of articles on how to do this:

https://help.ubuntu.com/community/Kernel/Compile


Kernel Compiling: What' devices are sitting on my bus, what processor do I have ?

# lspci
# cat /proc/cpuinfo

You've probably got SATA drives attached. They'll be mounted as /dev/sda ... /dev/sdb etc. To tune the access performance of this we can use 'sdparm'. Don't use 'hdparm' you'll likely see IOCTL errors ( errors accessing the kernel resources ). Your SATA drive should probably be DMA mode 6 or some other high value. Again do some reading but in short sdparm is likely the tool you want if it's a new system... if you have old IDE drives then hdparm is your tool.


Kernel Compile: know your board,cpu,drive options and intended use of setup...
I have a Via C7 Esther processor VIA supporting chipset. So I'd like to enable 'y' to the VIA associated flags. I probably could make the SATA,PATA support embedded but it's fine as a module for me ... cat /boot/config will show the current kernel compile options. For me I see ...

CONFIG_MVIAC7=y
plus a bunch more ...

My kernel will compile optimized for the C7 chipset. Other options we'll want is the scheduler tuned not for pre-emption but for dumb processing, we want threads to hog the CPU since we'd like our video transcoding, UPNP serving to be atomic and not sliced up for other processes... we need greedy thread execution.

Post Options




Sunday, November 23, 2008

Linux DVD creation

A quick procedure for converting a video, say a .wmv file from Windows to MPEG NTSC-DVD compatible stream then burned to disc. There are tutorials and many tools that can do this just search the net for details... For Ubuntu I tried a few tools out: Tovid, Keno, QDVDAuthor, mencoder, ffmpeg, DVDStyler. All have their uses and caveats and Keno is actually more suited to DV capture and linear editing rather than conversion and burning but mentioned here for completeness. Most DVD authoring/creation tools tend to go through dvdauthor and most video convertors tend to use ffmpeg. If you have Ubuntu or other Debian like system you can install all these tools easily on the command line or through the GUI. the article is about converting video files and creating a menu driven DVD for playback on any compliant DVD player. If your looking for backup of DVD's search for software like DVDRip,AcidRip, dvd-rip ...


apt-cache search qdvdauthor
apt-cache search ffmpeg
apt-cache search tovid
apt-cache search mencoder
apt-cache search transcode


sudo apt-get install ffmpeg qdvdauthor mencoder transcode

So lets start with a problem; I generated a video using Picassa3 on Windows ( slideshow with music ). I could have done something similar within Linux but I like Picassa3 and well that's it :0

Problem: I have a video file format that I need to convert and burn to DVD

Answer: There's a couple of methods ...


>ffmpeg -i

Tuesday, November 11, 2008

Hellanzb automation with Hellavcr on Ubuntu

As a customer of a shitty ISP my bittorrent is throttled. The natural option was to move to a usenet based service. By combining the following software and services, you'll have a slick web accessible frontend for automatic downloading of your favorite TV shows. All you favourite shows will be automatically downloaded and come up on your XBMC media center.

I used an ubuntu based server for the backend, but almost any linux distro should work. It took a bit of tweaking but now I have fully automatic downloading of my favorite TV shows with zero user interaction.

Software / Services Used
-
XBMC (the ultimate media center front end)
- Giganews (or other usenet provider)
- Newzbin (for usenet searching and nzb downloading)
- Hellanzb (client for downloading usenet binaries)
- Hellavcr (php frontend for hellanzb)


1) Install hellanzb

sudo apt-get install hellanzb par2 unrar


2) configure hellanzb

edit /usr/etc/hellanzb.conf with your favourite editor
Update the config file, here are the important fields you'll want to update

hosts = [ 'news.giganews.com:119' ]
username = 'your username'
passwork = 'your password'
antiIdle = 0
Hellanzb.PREFIX_DIR = '/your hellanzb dir'
Hellanzb.NEWZBIN_USERNAME = ' your un'
Hellanzb.NEWZBIN_PASSWORD = 'your pw'
Hellanzb.XMLRPC_PASSWORD = 'set your pass'

3) Install Hellavcr
- Get dependencies
sudo apt-get install php5-curl php5-xmlrpc

- Restart apache
sudo /etc/init.d/apache2 restart


-download and unzip hellavcr
http://code.google.com/p/hellavcr/


-unzip hellavcr to a web accessible directory (eg. /var/www/hellavcr/)

- Update file permissions

- edit hellavcr.config.php in an editor
- change the path of tv.xml to be an absolute path (eg. /var/www/hellavcr/tv.xml)
- add your newzbin login info
- change the hellanzb rpc password to the one you entered when configuring hellanzb
- disable mail and twitter if you don't use them

- hellavcr should now be web accessible

- you will need a cron job to run hellanzb.php periodically, this will check for new show releases and queue them in hellanzb. Add the following entry into your /etc/crontab to make it happen every 5 minutes

*/5 * * * * /usr/bin/php /var/www/hellavcr/hellavcr.php >> /var/log/hellavcr.log


- Go to your webserver and start searching for some shows



- The hellavcr cron job will search newzbin for the latest episodes and queue them in hellanzb

- I setup a simple script to copy the tv shows to the share that XBMC accesses, (as well as delete any sample files which came down with the video). It runs via a cron job as well

find . -printf '"%p"\n' | egrep -i sample | xargs -i rm {}
find . -printf '"%p"\n' | egrep -i chuck | egrep -i 'avi|mp4|mkv|mov|m2v' | xargs -i mv {} /fatty/video/TV\ Shows/Chuck/
find . -printf '"%p"\n' | egrep -i dexter | egrep -i 'avi|mp4|mkv|mov|m2v' | xargs -i mv {} /fatty/video/TV\ Shows/Dexter/
- On my any of my XBMC clients I update the database and the new shows appear and show up as unwatched (for easy tracking of which shows are new).




-