07.31.08

Ubuntu Radeon 9800 Pro Installation

Posted in Linux Ubuntu at 4:52 pm by philwinder

I tried to get the open-source drivers working, but it just messed things up.  So I used this guide to install the propriatey drivers.

Pic Development on Ubuntu

Posted in PIC at 11:31 am by philwinder

I am about to try PikLab with SDCC (Both available via Synaptic Package Manager) and an ICD2.  To install the IDC2 I followed this tutorial.  It’s supposed to be for the Pic Kit 2, but its just about the same for the ICD2.  SDCC also requires GPUtils, so install that too.

One problem so far is that you cannot have spaces in the path of the project being used.  Complication will fail and report:

Segmentation fault
+ "/usr/bin/gplink" -I"/usr/bin/../share/sdcc/lib/pic16" -I"/usr/share/sdcc/lib/pic16" -c -m -w -r -o xxxxxxxxxxxxxx
*** Exited with status: 1 ***

07.29.08

Ralink RT25xx Driver install

Posted in Linux Ubuntu at 9:28 am by philwinder

Background:

I am using a Buffalo WLI-U2-KG54 USB wireless device and the default linux USB driver (the rt2500usb) would not support WPA encryption and it would not work at all.  After days of searching through other drivers including the ndiswrapper route/hack I found that USB devices based upon the rt25xx chip should use the rt2570 driver.  Note that this guide should also work with the real rt2500 driver and its varients.  Just replace filenames and identifiers where nessecary.

Assumptions:

A Fresh Install of Ubuntu 8.04.1 (Hardy Heron)
No Local internet access (but access from another computer)
Using WPA TKIP encryption.  For any other type of encryption you will have to make some changes.  But what they are I dont know.

Lets Go!

  1. After a clean install boot up and insert the installation CD
  2. Go to System -> Administration -> Synaptic Package Manager
  3. Go to Settings -> Repositories and Uncheck all checks and check the CDROM.  This removes the internet and adds the cd as a source of files.
  4. Now search for “Build-Essential”.  Right click on Build-Essential and click “Mark for Installation”.  If it asks say yes to installing its dependancies too. Click Apply and install. Close.
  5. Get on the internet and download “http://rt2×00.serialmonkey.com/rt2570-cvs-daily.tar.gz“. These are the drivers that we are going to install.  Save them onto a flash disk or something and go back to the ubuntu PC.
  6. Open up your flash disk and open up /home/.  Copy the tar.gz file accross to your home folder.
  7. Right click on the tar.gz file in the home folder and click “Extract here”.
  8. Now right click and rename the folder to something nice like “rt2570″
  9. Open Applications->Accessories->Terminal.
  10. Now cd to that directory with “cd /home/<yourname>/rt2570
  11. And cd to the Module directory with “cd Module/”
  12. Type “Make” to compile the driver
  13. Type “Make Install” to install the driver
  14. Type “cd ../../” to get out of the folders and type “rm -r rt2570″. This removes the folder we just had.
  15. Now we need to get rid of the old drivers. Type “rmmod rt2500usb”,  “rmmod rt2×00usb”, “rmmod rt2×00lib”, “rmmod mac80211″
  16. Use “lsmod” to find any more drivers that your specific card might be using (for example if you are not using the rt2500usb driver).  Then rmmod them.
  17. Start the correct module with “modprobe rt2570″
  18. Now for the moment of truth.  To test type “ifconfig -a” and see if your wireless adapter is at the bottom.  It will be called rausb0 or ra0 depending if it is a usb device or not.
  19. Turn the device on with “ifconfig rausb0 up”.  (replace rausb0 with your version from now on)
  20. And look for some networks! “iwlist rausb0 scan”.  Now if you find some networks, happy days its all working.  Remember the SSID of that network.  If it isnt, then either your router is wrong, you have the wrong driver or you have made a mistake.
  21. Now we need to stop the old drivers restarting next time we boot so there are two options.  First is delete the files or second is this.  type “gedit /etc/modprobe.d/blacklist”.
  22. At the bottom of the file add “blacklist rt2500usb”, “blacklist rt2×00usb”, “blacklist rt2×00lib”, “blacklist mac80211″.  All on seperate lines.  This blocks attempts to start the old driver.  Save and Close.
  23. Now open “gedit /etc/network/interfaces”.
  24. This is an important bit, so I will do it in a code box.  After the auto lo and iface lo inet loopback lines enter this:


auto rausb0 # place your card name instead of all rausb0's
iface rausb0 inet dhcp
pre-up ifconfig rausb0 up
pre-up ifconfig rausb0 down
pre-up ifconfig rausb0 up
pre-up sudo iwconfig rausb0 mode Managed
pre-up sudo iwpriv rausb0 auth 3
pre-up sudo iwpriv rausb0 enc 3
pre-up sudo iwconfig rausb0 essid "<your ssid from before>"
pre-up sudo iwpriv rausb0 wpapsk <your wpa password>
pre-up sudo iwconfig rausb0 essid
"<your ssid from before>"
Note the quotes around the ssid.  The reason why you have to put the ssid twice is so that the wpapsk key can be generated properly.  I think that all of my problems were because of this.  I was only doing it once for ages.  The up down stuff at the start seems to make it more stable.  The auth 3 means wpa and the enc 3 means TKIP.  If yours is different then take a look at the iwpriv-readme in the driver folder.

Now restart and that should be it.  Next time it reboots the dhclient should find you an address!! yay.  Note that running “/etc/init.d/networking restart” also restarts the network, but doesnt always work.  The first time it seems to, but after that I dont get any DHCP offers.  Dont know why, restart and it should be ok.

Hope that helps.  Ive spent 3 whole days doing that.  And I mean whole days.

07.18.08

Voltage Amplifiers Vs. Charge Amplifiers for Hydrophones

Posted in Electronics, PhD An Acoustic Disdrometer at 2:03 pm by philwinder

I have come to the conclusion that voltage amplifiers are better than charge amplifiers.  Equations state that the gain should be the capacitance of the hydrophone divided by the capacitance of the integrating capacitor.  When creating two circuits with (about) the same gain, the voltage amplifier always outperforms the charge amplifier.

This could be because of a few things.  Firstly, the capacitance of the hydrophone stated in the datasheet may not be true, or the capacitance undesirably alters with frequency.  Or secondly, it could be because the hydrophone, as a model, is a better voltage source than it is a charge source, however this is implicitly the same thing.  I.e. When the structure of the ceramic changes, a charge is formed via electrons jumping into non-stable spaces.  This forms a potential between the terminals on either side of the ceramic and when one side is connected to ground and the other to a load, a current flows.

So, in reality, for hydrophones at least, the two circuits are attempting to accomplish the same thing.  However, I would be worried that the integration in the charge amplifier would cause the signal to be altered from the delta like pulse to some sinc wave; single-handedly demolishing the drop size-impact pulse relationship.

Feel free to correct me if I am wrong, and here are some images of the results.  The charge amplifier simply didnt have enough gain to get the required results.

Charge Amplifier ResultsVoltage AmplifierVoltage Amplifier Zoomed

Incidently, a differential configuration did not work very well at all.  I thought a differential amplifier would remove a lot of the mains noise, but it didn’t.  Most of the mains must be picked up in the actual circuit, rather than the wire.  To remove the noise I would have to use a DC servo, adding complexity and possibly more capacitors in the path of the signal.

07.08.08

Phased array V0.1 Finished :D Doesnt Work :(

Posted in Projects, Electronics, PIC at 9:45 am by philwinder

I have implemented a new microcontroller that has simultaneous sampling and a slightly higher sampling rate. I could then interpolate the data with pretty good results using a simple padding + band pass filtering technique. The higher the SNR the better it worked.
However, I have hit a great big wall. It all boils down to the fact that I have used 2 rows of transducers to make the spacing 1 wavelength.

For the following results, Consider the situation where x is the horizontal plane, y is the vertical plane and z is the distance between the source and the target. If the target is slightly elevated in the y plane, the top and bottommost transducers would receive an echo at different times. Furthermore, due to multipath dispersion I am also receiving further echoes from different y directions. So to counteract this, I would have to scan not only in the x plane, but in the y plane too, and this was accomplished by summing all of the results in the y direction to produce a plot of the targets in the x plane. However, by delaying the signals in the y plane, the x plane in some situations became erroneous. It looks like I am getting some sort of aliasing in the x plane. I think that this is because of instead of having a beam pattern from 4 transducers, I am getting 2 x 2 transducer patterns, so not only do I now have a very very wide beam width, I will have some nasty sidelobes too (since if you just consider the 2 transducers, the spacing is 2 x wavelength.)

On the up side, the hardware works great!

So all around, this was pretty much a disaster, and I am not looking forward to remaking all of the hardware. So for beta 2 I will need:

  • to source some smaller transducers so that I can get 1/2 x wavelength spacing in a linear fashion. Possibly go higher in frequency to get a better z resolution.
  • use a dedicated ADC with 8 transducers, rather than 4. Get something with a faster sampling rate too.
  • remake the hardware :(
  • The hardest thing I see is sourcing the peizoceramics from somewhere. Does anyone know of where I can get any cheaply online? Self enclosed transducers would be ideal, but I would be willing to mess with the naked ceramics myself if I had too…

    05.15.08

    DAQmxReadAnalogF64 Intermittent Warning of 1

    Posted in Electronics, PhD An Acoustic Disdrometer, Programming, Qt at 8:12 pm by philwinder

    I’ve had a very serious problem recently regarding the long term stability of the NI-4462.

    Problem:
    Everything works fine for about 20-inf secs but then all of a suddent the DAQmxReadAnalogF64 function returns a 1 rather than a 0.

    Solution:
    The errors were buffer overrun errors (annoying that the 4462 almost always returns 1 as an error. Not very informative!). This, I eventually figured out, seemed to be happening every time my cpu hit 100% load. Then the DAQ would stop acquiring, post an error of 1 and quit. To fix this I manually set the sampsPerChanToAcquire setting in the DAQmxCfgSampClkTiming function.
    Just a bit of background, I am using continuous acquiring, so the sampsPerChan… variable set the hardware buffer size. I am also interrupting every 50000 samples. So setting this value to 200000 or above (i.e. 4x your interrupt generation) seems to get rid of all my intermittent problems!! Woo!

    Hope this helps someone in the future…

    05.07.08

    Acoustic Reflection Testing

    Posted in PhD An Acoustic Disdrometer at 10:18 am by philwinder

    I’ve been working on decomposing the different parts of the signal received, trying to figure out what each bit is and how to get rid of it.
    The main conclusions of which are that bottom->surface reflections are the most predominant in the signal.
    The attached two graphs of experiments where I was comparing the signals in a bucket to the signals in the tank, and in the tank at different heights.

    The first test shows that side reflections constitute a fair amount of the signal but after the primary reflections have passed the main residing component is the reflections from the surface.  (Although they can still be seen in the signal - just).  The bottom->surface reflections have slightly different path lengths due to the odd shape of the bottom of the bucket and that the hydrophone protrudes by a few cm’s.  These two paths constructively and destructively interfere to produce the remaining oscillatory signal.

    The second experiment was to make sure that the remaining signal was produced by surface reflections and not by some resonance in the hydrophone itself.  It can be seen that the cycles following the initial spike occur at a different time depending on the depth.  The deeper the water, the longer it takes the reflection to return back to the hydrophone.  This can be roughly seen but is shrouded by the different path lengths of the other reflections (because the drop wasnt directly over the hydrophone).

    This seems to indicate that if we were to dampen the bottom->surface reflections using a lining then a lot of this type of “noise” could be removed.

    I also noted that the oil used for this experiment was left in the tank a few days.  It looked like the cooking oil had started to coagulate, and did not behave as intended. (the semi-solid pieces were not recombining quick enough to “heal” the patch where the drop had just landed.)

    This also helps to answer another question: How thick does it need to be?
    Well this roughly depends on how quick/much it is raining.  If there is a thin film (about 2mm) then when a drop hits the surface it forces the oil away from the impact site.  If another drop was to hit the same place then there would be no oil to stop the bubble noise.  If the film is 2cm deep then the drop doesn’t have enough energy to break through the oil into the water, so if another drop did land in its place, there would still be enough oil left to inhibit bubble noise.  So the only worse case scenario is when one drop hits and another drop at practically the same time hits exactly the same place in the same orientation.  If this happened then a collision between the new drop and the old drop could occur and probably create some strange results.

    Having a thicker film also helps to stop the oil coagulating.  So basically, the thicker the better.  BUT we have to make sure that we dont make it too big because reflections will occur on the boundary of the water and the oil and the speed of sound will be different, affecting the TDOA’s.

     Oil in a Tank vs. Oil in a BucketSurface Reflections

    05.06.08

    Another Qt Error

    Posted in Qt at 10:58 am by philwinder

    If you ever get the error:

    In file included from c:/Qt/4.3.4/include/QtCore/qcoreevent.h:1,
    from c:/Qt/4.3.4/include/QtCore/../../src/corelib/kernel/qcoreapplication.h:48,
    from c:/Qt/4.3.4/include/QtCore/qcoreapplication.h:1,
    from c:/Qt/4.3.4/include/QtCore/QCoreApplication:1,
    from src\qpnwsettings.cpp:3:
    c:/Qt/4.3.4/include/QtCore/../../src/corelib/kernel/qcoreevent.h:52: error: `QtValidLicenseForCoreModule’ does not name a type
    mingw32-make[1]: *** [build/qpnwsettings.o] Error 1
    mingw32-make: *** [release] Error 2

    This is due to a semicolon not being present at the end of a class definition in a header file when #ifdef and #endif statements are used. So for example:

    #ifndef __FOO_H__
    class foo
    {

    };
    #endif

    works fine (note the semicolon after the last bracket).

    05.02.08

    Phased Array Data

    Posted in Projects, Electronics, PIC at 11:13 pm by philwinder

    Got the first incarnation of the Phased array working now. Had a few hiccups along the way, but managed to get most of them sorted. Main problems included not having enough RAM to store a significant amount of data, so I fixed that using a simple compression technique (I say simple, took me ages to get it working!) and using a circular buffer.

    The main problem is that the PIC30F’s can only acquire data sequentially, i.e. not simultaneously. This means that each acquire takes 1Tad to sample, therefore 4 sequential acquires takes 4Tad. This means that the actual sampling speed is Fad/4=50ksps max! Rubbish. So Ive ordered some PIC33f’s to try because they are simultaneous and work up to 1Msps!

    Also need to desolder the power lead for the transmits because they should have their own separate power supply. Not the on board one.

    Finally, some data!

    4 Outputs!Accross TableRoof!

    Errata: Slight cock up, in the second image the pulse labeled reverbaration is not reverbaration.  I think it was a reflection from something about 45 degrees out.  This poses an interesting question, how do I stop signals that are out of phase by exactly 1 cycle adding up to a large number? I will have to consult the literature to figure this one out!

    04.25.08

    Phased Array PCB V0.1 Finished

    Posted in Electronics, Robotics, Future Project Ideas, ZBot at 3:23 pm by philwinder

    Not tested yet, but here are some images of the finished PCB!

    Image 1 img_0002.JPG Image 3 Image 4

    « Previous entries