OpenSCAD and STL files for camp store knob

Yet another OpenSCAD model. This time its a replacement knob for a camp stove.

Camp stove knob

Read the rest of this entry »

OpenSCAD design for power meter enclosure

I recently bought a AC Power meter module from eBay,  (if the item is no longer listed on eBay, try searching on eBay for “AC264V30A”), but the module is designed to be panel mounted and doesn’t have a back, hence live (mains voltage) wires are exposed.

AC264V30A

 

So I designed a box so it could be used stand alone

Read the rest of this entry »

Adjustable angle lamp bracket for IKEA TERTIAL lamp

Just thought I’d share the STL and OpenSCAD files for an adjustable angle, lamp bracket for the IKEA Tertial lamp, that I designed and 3D printed for use on a angled drawing board.

lamp_clamp

 

Lamp Clamp SCAD file

Lamp Clamp STL with arm moved for printing

LTSpice Model of AC mains zero crossing detector

As part of an Arduino based AC mains dimmer controller, I’ve been investigating and modelling various zero crossing detectors, and I created an LT Spice model of this circuit which I found here

Zero crossing schematic

Read the rest of this entry »

Comments disabled due to massive amounts of spam

Apologies to anyone who legitimately wants to comment on any of my postings, but I have been swamped by spam comments postings over the last week and the only solution has been to disable comments for a while.

I’ll try finding a solution to this, but I don’t even think that Captcha works very well of this sort of spam, as I think they have real people posting just pasting in the comments and then filling out the captcha as necessary :-(

Setup MK808 (Android 4.2) for development on Windows 7 (also probably works on XP)

Just thought I’d post how I managed to setup my Android MK808 for development.

  • Downloaded and installed latest ADK from Google
  • Downloaded and installed latest JRE
  • On MK808In settings

    In Developer options select “USB debugging” (note this setting will be remembered even after a reboot)
    In USB, select “Connect to PC” (Note this setting doesn’t get remembered after a reboot so need to be set each time the MK808 is power cycled etc)

  • On the PC, the USB device for the MK808 should be recognised however Windows won’t be able to find a matching driver and the generic drivers supplied as part of the ADT don’t get recognised as valid drivers if you manually browse to them.The trick is to add the USB ID’s of the MK808 into the inf file for the generic USB drivers (provided by Google)
  • First you need to get the USB ID’s by opening the device manager, selecting the MK808, then under Properties then  Details , select Hardware ID’s and copy the 2 lines.

    e.g.
    USB\VID_2207&PID_0001&REV_0222
    USB\VID_2207&PID_0001

  • In the ADK folder, naviagte to sdk\extras\google\usb_driver

    Then open android_winusb.inf and find the block of text that starts with [Google.NTx86] and add 2 new lines at the beginning (actually you can put this anywhere in this section for the MK808 as shown below
    [Google.NTx86]

    ;mk808
    %SingleAdbInterface%        = USB_Install, USB\VID_2207&PID_0006
    %CompositeAdbInterface%     = USB_Install, USB\VID_2207&PID_0006&REV_0222

    Note. If youe VID’s etc are not the same as mine, use the VID’s etc that you copied from your MK808

    Also update the 64bit section of the file (This may not be necessary if you are using 32 bit system)
    e.g.

    [Google.NTamd64]

    ;mk808
    %SingleAdbInterface%        = USB_Install, USB\VID_2207&PID_0006
    %CompositeAdbInterface%     = USB_Install, USB\VID_2207&PID_0006&REV_0222

    Save the file ;-)

  • Update the hidden adb_usb.ini
    Open the command line and type

    echo 0×2207 >> “%USERPROFILE%\.android\adb_usb.ini”

    (You can edit this file and add the device ID to the file, however the .android folder will normally be hidden, so the command line option is probably simpler)

  • In the device manager, select Update Driver for the MK808 and browser to the the ADK folder which contains the driver, and press OK.

    Windows should now tell you that it can install the driver but its not signed (or words to that effect). Press the button to accept and the driver should be installed.

You can check whether ADB has recognised the MK808 by using the command prompt (CMD), and CD to the ADK  \sdk\platform-tools, and run

adb devices

This should start the deamon and show the device ID

If no devices are shown, double check that USB debugging is enabled on the MK808 (in settings Developer options)

In Eclipse, if you Run a project, it should immediately deploy and run the app to the MK808

13 Princes Street, Port Melbourne, VIC 3207

Updating firmware on USBASP bought from eBay

I bought a cheap USBASP clone Atmel programmer from eBay a few weeks ago, to use with the Arduino IDE. (see images below)

The board worked ok, but kept giving errors

avrdude: warning: cannot set sck period. please check for usbasp firmware update

and I was unable to program an ATTiny85 on a breadboard when running at 3.3v (it worked fine at 5V), so I decided to bite the bullet and attempt to update the firmware on the USBASP using one of my Arduino boards as the programmer.

There appears to be a lot of misleading and confusing information on the web about how to do this, so I thought I’d document what worked for me.

  1. NOTE. Attempting to reprogram your USBASP may damage or erase it. Only follow the process described below if you are willing to take this risk ;-)
  2. Program an Arduino UNO as an ISP.
    This is a fairly simple process.
    Plug in your Arduino.
    From the Examples (on the File menu). Select “Arduino ISP”
    Select “Upload” and confirm that the new firmware has been uploaded.

    Note down the Comm port that the Arduino board is connected via i.e from the Tools->Serial port menu

  3. Download the lastest version of the USBASP firmware from http://www.fischl.de/usbasp
    I used usbasp.2011-05-28.tar.gz
    unzip the file and note the full path of the  the bin/firmware directory for the firmware you have just downloaded and unzipped
  4. Open a command prompt (windows cmd ), and Cd to your Arduino program folder and then into the hardware\tools\avr\bin folder
    This folder should contain the avrdude.exe that will be used to flash the new firmware.
  5. Link the Self Program jumper on the USBASP – on my board this was labeled J2, some other boards are different.
    I had to solder the pins onto the PCB as they were missing, and used a jump link, but any way to reliably connect the Self Program pins should work fine.
  6. Connect the Arduino to the programming pins of the USBASP
    Make sure you disconnect the USBASP from your computers USB

    My connections were
    Arduino    USBASP

    5V ———– 2
    GND ——– 10
    13 ———— 7
    12  ———-  9 (MISO)
    11 ———-   1 (MOSI)
    10 ———    5 (RESET)

    usbasp_and_arduino

  7. Check that avrdude can connect to the USBASP

    In the windows command window, type

    avrdude -C ../etc/avrdude.conf -c avrisp -P COM3 -b 19200 -p m8 -v

    Note if your Arduino is not on COM3 you need to change this to whatever your Arduino IDE used.

    If everything is connected correctly you should see a load of information about the USBASP board that you are about to program, like this

    Using Port                    : COM3
    Using Programmer              : avrisp
    Overriding Baud Rate          : 19200
    AVR Part                      : ATMEGA8
    Chip Erase delay              : 10000 us
    PAGEL                         : PD7
    BS2                           : PC2
    RESET disposition             : dedicated
    RETRY pulse                   : SCK
    serial program mode           : yes
    parallel program mode         : yes
    Timeout                       : 200
    StabDelay                     : 100
    CmdexeDelay                   : 25
    SyncLoops                     : 32
    ByteDelay                     : 0
    PollIndex                     : 3
    PollValue                     : 0×53
    Memory Detail                 :

    Block Poll               Page                       Polled
    Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
    ———– —- —– —– —- —— —— —- —— —– —– ———
    eeprom         4    20   128    0 no        512    4      0  9000  9000 0xff 0xff
    flash         33    10    64    0 yes      8192   64    128  4500  4500 0xff 0×00
    lfuse          0     0     0    0 no          1    0      0  2000  2000 0×00 0×00
    hfuse          0     0     0    0 no          1    0      0  2000  2000 0×00 0×00
    lock           0     0     0    0 no          1    0      0  2000  2000 0×00 0×00
    calibration    0     0     0    0 no          4    0      0     0     0 0×00 0×00
    signature      0     0     0    0 no          3    0      0     0     0 0×00 0×00

    Programmer Type : STK500
    Description     : Atmel AVR ISP
    Hardware Version: 2
    Firmware Version: 1.18
    Topcard         : Unknown
    Vtarget         : 0.0 V
    Varef           : 0.0 V
    Oscillator      : Off
    SCK period      : 0.1 us

    avrdude: AVR device initialized and ready to accept instructions

  8. If you get an error message about invalid signature, your board is may not use an ATMega8, and you will need to change the -p option on the AVRDUDE command to match you board. If you omit the -p option, AVRDUDE will display a list of compatible devices and their codes which you can use to select the correct device.

    If you have the correct device, but still get a signature error, check that you are using -c avrisp and NOT -c arduino.
    Using -c arduino tells AVRDUDE that you want to program the Arduino board and not the USBASP

    If you can’t connect at all, check your wiring, as its possible that some boards don’t have the same pinout as my board.

  9. Assuming that AVRDUDE can connect to the USBASP, you can backup the original firmware using the command

    avrdude -C ../etc/avrdude.conf -c avrisp -P COM3 -b 19200 -p m8 -U flash:r:original_firmware.bin:r

    This should read the firmware and save it to a file called original_firmware.bin (in the same folder as avrdude.exe)

  10. As a double check you can attempt to write the original firmware back to the device, I’m not sure if this is a foolproof way of testing whether you can flash the USBASP but I did it as a test, as previously I’d had issues writing / flashing the device but was able to read it OK.

    avrdude -C ../etc/avrdude.conf -c avrisp -P COM3 -b 19200 -p m8 -U flash:w:original_firmware.bin

    If this appears to work and AVRDUDE verifies OK, then its probably safe to attempt to burn the new firmware.

    In my case the new firmware was in c:\usbasp so the command was

    avrdude -C ../etc/avrdude.conf -c avrisp -P COM3 -b 19200 -p m8 -U flash:w:c:\usbasp.atmega8.2011-05-28.hex

    Note. If the chip on your USBASP is not a MEGA8, you need to use the correct / matching file e.g.

    avrdude -C ../etc/avrdude.conf -c avrisp -P COM3 -b 19200 -p m8 -U flash:w:c:\usbasp.atmega88.2011-05-28.hex

  11. If the process worked ok and AVDRUDE verified the new firmware, you can disconnect the USBASP from the Arduino and connect it via USB to the PC and attempt to program your target device (using the Arduino IDE or AVRDUDE).

 

 

usbasp programmer uspasp bottom view

Visual Studio 2012 C# x86 console application

Just a quick post to help anyone else in the same situation…

I needed to write a simple console application in C# (to receive serial data and save it to a file), but found that when I copied the application to the Windows XP (SP2) target machine, that it didn’t run and I got the “Not a valid Win32 Application” error message.

Searching on the web I found numerous postings about how Visual Studio 2012 could no longer target XP, but that VS2012 Update 1 had a fix for this, in the project configurations. But these config’s are not present on a C# build and seem to be specific to C++.

Anyway, the actual solution was to change the CPU type from “Any” to X86 (my target machine is X86), and this changed the error on the XP machine to an error for not having .Net 4.5 installed.

But .Net 4.5 was not available for XP at the time of writing, and the machine already had .Net 4.0 installed.

However switching the VS project to use .Net 4 didn’t immediately appear to fix the problem, until I realised that it was necessary to completely quit VS and restart it, in order for the settings changes to the project to be registered. (VS closes and re-opens the project when you change .Net versions, but this doesn’t seem to reset everything in VS2012 (update 2)).

Anyway, I finally got the app working on target machine.

Initial impressions of Adobe’s “CreateJS Toolkit”

I spent several hours today looking at Adobe’s new Flash -> HTML5 converter called “CreateJS Toolkit” (see http://www.adobe.com/au/products/flash/flash-to-html5.html )

The premise is that Flash content, (graphics, animation and sound) can be exported for use with the CreateJS suite of open-source frameworks ( https://github.com/CreateJS ).

The “Toolkit” its self is a Flash extension. Its only compatible with Flash CS6, however I suspect this is purely a marketing limitation, as Flash CS5 can save to XFL so I doubt that the plugin uses any new functionality in CS6.

I have attempted to “Publish” several of existing FLA files  to HTML using the tool and they have all failed.

Read the rest of this entry »

Solar Position Explorer app now available in the App Store

Solar Position Explorer app now available in the App Store.

See https://itunes.apple.com/au/app/sun-position-explorer/id600320388?mt=8

Sun Position Explorer