Monday, June 4, 2012

RGBshow() - Super Smooth Full Color LED Fading


I was working on putting together OSCars lighting system and of course I had to get my RGB led set up first. Several months back I was looking online for a better method to fade an LED. I cant remember where I found this or I would happily give the creator credit for it.



Monday, May 28, 2012

Meet OSCar

"Hello World!"
Allow me to introduce O.S.C.A.R. - Open Sound Control Advanced Recon Robot. Oscar is a differential drive robot running on dc motors- providing fast speed capabilities and tight maneuvering. The control system has been built around the OSC protocol. This allows custom / flexible control interfaces that can also display live sensor data sent from the bot.
-


And me, the creator.

Wednesday, May 23, 2012

New Shop Search

[check out the bottom right of the blog...]

I've been flat out at work lately and haven't really had much time to play or do much in the way of fun stuff. If you follow my posts on G+, you'll see the odd tinkering here and there (not worthy of a blog post).

Anyhow...

I was looking for a quick way to find any electronic part I needed (Google! I hear you say... well, wait...) from a subset of all the suppliers on earth and I stumbled across Google Custom Search. It's an awesome little tool that allows you to list the sites that you want to search and then save the search in a chunk of code for your website.

Long story short, I've made a custom search for all of my preferred suppliers and attached it to the right panel of this blog (in pages on the right). Some of the suppliers are Australia-based. Some aren't. I'll probably adjust this in future, and it's mainly for my own personal benefit but everyone is free to use and abuse it.

-Adam

Sunday, April 15, 2012

Mood Lamp Touch Version 1.0



Horse of a different colour

The finishing touches on this touchy project ended up taking longer than I expected, leaving me with much less time (and patience) to blog about it.



Alterations

Since the last post on it, I modified the touch lamp code to change colours on tap-and-hold. It was a little less error-prone and far more intuitive than detecting fingers at a distance from the touch area.


[ I hate vero board... yes, I still hate it... ]

Frustrations

Moving it to the vero board was relatively painless. What really caused me headaches was the reassembly of the lamp itself. When using capacitive detection, all wires must be very well insulated and accounted for.

Version Cutoff

After having to assemble, test, disassemble, solder, un-solder, assemble, ad-nauseum for a few hours I gave up on trying to fix all of the bugs or not-so-great features of it and called it “Version 1.0”. Eventually the state of it will bug me enough to make version 2. Until then, at least I have my fancy mood lamp touch with colour therapy to relax with.

Alpha Bugs/Shortcomings

  1. The emitter is far too high in the lamp diffuser, creating a bright band of light in the middle of the lamp instead of at the base.
  2. A single RGB module is far too weak to produce enough light to fill a room. More will need to be added.
  3. Occasionally, due to either the vero board wiring or the internal wire arrangement or some other variable in the sensitivity of the code, the lamp will turn itself off instead of change colours when touched and held. It’s not too frequent so it should be ok for now.
  4. The project severely underuses the Atmega328P. Don’t know what I can do about this one, really. Smaller chips could be bought and used but it’s more effort and time (hence more cost). I optimised a bunch of the HSV to RGB code to produce a hex file that was about half the size that it started at… If you’re interested in recreating this, it’s worth mentioning that the hex is under 8K and would easily fit on an ATtiny85 (slightly less wasteful).

Code

Should you want to make this project yourself, here’s the sketch for it. It was thrown together pretty quickly so I apologise for the many ragged edges. You’ll first need to install the CapSense library by Paul Badger.

Note: Because it was easier on the vero, I changed D4 and D5 to D6 and D7. Be sure to change it back if you follow the schematic to the letter.

#include <CapSense.h>

/* colours */

const long cRed     = 0xFF0000;
const long cGreen   = 0x00FF00;
const long cBlue    = 0x0000FF;

const long cYellow  = cRed | cGreen;
const long cCyan    = cGreen | cBlue;
const long cMagenta = cRed | cBlue;

/* shifts */

const short cRedShift   = 16;
const short cGreenShift = 8;
const short cBlueShift  = 0;

int CKI = 2;
int SDI = 3;

boolean touchPresent = false;

boolean isOn = true;

long toggledFromTouchAtTime = 1L;

long touchesBeganAtTime = 1L;
long currentTouchHoldTime = 1L;
long lastTouchHoldTime = 1L;

CapSense   cs_4_5 = CapSense(6,7); 

#define STRIP_LENGTH 1 // Number of RGBLED modules connected
long currentColor = 0L;
long lastColor = 0L;

void setup() {
  pinMode(SDI, OUTPUT);
  pinMode(CKI, OUTPUT);
  cs_4_5.set_CS_AutocaL_Millis(0xFFFFFFFF);
}

void touchesDidBegin()
{
  touchPresent = true;
  touchesBeganAtTime = millis();
  currentTouchHoldTime = 0;
}

void touchesDidContinue()
{
  currentTouchHoldTime = millis() - touchesBeganAtTime;
}

void touchesDidEnd()
{
  touchPresent = false;
  lastTouchHoldTime = millis() - touchesBeganAtTime;
  currentTouchHoldTime = 0;
}

long highestVal = 0;
long red = 0x00;
long green = 0xFF;
long blue = 0x00;
long *modColor = NULL;
boolean addColor;

void updateCurrentColor()
{
  currentColor = (red << cRedShift) + (green << cGreenShift) + (blue << cBlueShift);
}

void changeColor()
{
  switch(currentColor){

      case cRed:
        // add green
        modColor = &green;
        addColor = true;
      break;

      case cYellow:
        // subtract red
        modColor = &red;
        addColor = false;
      break;

      case cGreen:
        // add blue
        modColor = &blue;
        addColor = true;
      break;

      case cCyan:
        // subtract green
        modColor = &green;
        addColor = false;
      break;

      case cBlue:
        // add red
        modColor = &red;
        addColor = true;
      break;

      case cMagenta:
        // subtract blue
        modColor = &blue;
        addColor = false;
      break;

      default:
      break;
    }

    // modify the colour
    if (addColor){
      *modColor = *modColor + 1;
    } else {
      *modColor = *modColor - 1;
    }

    updateCurrentColor();
}

void loop() {

  long total1 =  cs_4_5.capSense(30);

  // calibrate

  if (highestVal == 0){
    for (int i = 0; i < 100; i++){
      if (highestVal < total1){
        highestVal = total1;
      }
      total1 = cs_4_5.capSense(30);
      delay(10);
    }
  }

  // touch recognition

  if (total1 >= highestVal + 30){
    if (!touchPresent){
      touchesDidBegin();
    } else {
      touchesDidContinue();
    }
  } else if (touchPresent){
    touchesDidEnd();
  }

  // and the colour bit

  if (isOn && currentTouchHoldTime > 500){
    changeColor();
  } else if ((!isOn || (!touchPresent && lastTouchHoldTime < 500)) && (touchesBeganAtTime > toggledFromTouchAtTime + 200)) {
    toggledFromTouchAtTime = touchesBeganAtTime;
    isOn = !isOn;
  }

  if (isOn) {
    updateCurrentColor();
  } else {
    currentColor = 0;
  }

  if (currentColor != lastColor) {
    post_frame(currentColor);
    lastColor = currentColor;
  }

  delay(50);
}

void post_frame (long led_color) {
  for(int LED_number = 0; LED_number < STRIP_LENGTH; LED_number++)
  {
    long this_led_color = led_color; //24 bits of color data

    for(byte color_bit = 23 ; color_bit != 255 ; color_bit--) {
      //Feed color bit 23 first (red data MSB)

      digitalWrite(CKI, LOW); //Only change data when clock is low

      long mask = 1L << color_bit;
      //The 1'L' forces the 1 to start as a 32 bit number, otherwise it defaults to 16-bit.

      if(this_led_color & mask) 
        digitalWrite(SDI, HIGH);
      else
        digitalWrite(SDI, LOW);

      digitalWrite(CKI, HIGH); //Data is latched when clock goes high
    }
  }

  //Pull clock low to put strip into reset/post mode
  digitalWrite(CKI, LOW);
  delayMicroseconds(500); //Wait for 500us to go into reset
}

Tuesday, April 10, 2012

Retro Product Love: CASIO fx-82SX



Going on strong

I’ve had this calculator for maybe 15 years. There’s just something I admire about efficient design - especially power efficient design.


The power consumption is listed on the back of the calculator as 0.0004W. This calculator has followed me through high school and university and every assignment, exam and study session along the way. It has not lead an idle life.


I snapped these pics because it needed a little internal tightening (I thought it could be low on battery, but WOW… no). I was very surprised to find that under load, the original batteries were still reading above 3V.

To CASIO, I bow deeply and respectfully.

Saturday, April 7, 2012

Introducing Sandy Lloyd (and project( Mayhem))...

This is Sandy Lloyd's first post on Electronomous so give him a warm welcome! I've been chatting with Sandy on G+ for a few months now and he's definitely got the maker's spirit. Currently residing in Cocoa Beach, Florida, he's keen to fill you all in on his latest project.
- Adam.

As long as I can remember I have been fascinated with robotics and tech.

I have always dreamed of building a robot. You know, the big Mech kind. The kind ya see in the movies. You know - climb in and battle til' the death (of the bot).

Well, over the years my dreams got more and more "realistic" until I arrived here, where I am now. This was before I knew about Arduino, or the entire DIY robotics scene. About two years ago I found out that there were people that actually got to build their own robots.

Unfortunately, things happened and I sort of lost interest. About three or four months ago I was reading an article about this little gizmo called an Arduino. It was a microcontroller that helped you learn programming and helped you figure out how to build your own circuits.

I thought to myself, "That is exactly what I want to do."

With a little research I found sparkfun.com, and pololu.com. At their websites I saw that there were a plethora of MCUs (MicroController Units), LED's (Light Emitting Diodes) and every sensor you could think of - so I placed an order.
Not fully understanding what I was getting into I ordered:

  • a Pololu Baby Orangutan
  • an AVRISP II programmer
  • a Shiftbrite
  • a couple of push buttons, and
  • a geared motor

At that point I didn't know just how complicated programming could be. I messed around with it for about a month, maybe a bit longer. But I quickly realized that I had jumped in too far. So, I went back to sparkfun.com and ordered an Arduino Uno R3, some resistors and a couple of other things. That was the ticket - just what I needed. Within days I had written my first bit of code and I was hooked.

Now that I am armed with a much more robust arsenal of parts, an Arduino, a tad bit more knowledge and some very intelligent friends (both of whom are authors on this blog) I am off to build my first "real" robot!

First things first - I am going to post some pictures of some my parts for the robot. The robot, as of yet, has no name. So lets get to some pictures. 

Large 1 watt LED's
The smaller LED in the middle is a
RGB LED
http://arduino.cc/
Arduino Uno R3

On/Off switch, two bumper
 switches, Piezo speaker

Accelerometer
QTR-1RC Reflectance
 Sensor



Wheels And Servo horns
Servos
Solar Panels, LDR , and a Thermistor 



Starting at the very top from left to right we have:

  • Arduino Uno R3, the brains of my bot.
  • Two, large 1 watt ultra bright LED's, they are the head lights. A RGB (Red, Green, Blue) LED, for status indication.
  • Snap action switches for tactile feedback so my bot knows when it has ran into something, an On/Off switch for killing power from the batteries, and a piezo speaker for alerting me if it has fallen over or someone has picked it up.
  • QTR-1RC sensors for edge detection and line following. so when I am letting it drive around on the table it wont drive or back over the ledge.
  • Accelerometer it detects motion on three different axis, it will set off the piezo speaker in case it falls over or the kids pick it up.
  • Wheels and servo horns for mounting the wheels to the servos.
  • Servos for spinning the wheels, that small Servo is for a Sharp infrared proximity sensor (not pictured).
  • Last but not least is a Thermistor for temperature sensing, a LDR (Light Dependent Resistor) for finding the brightest part of a room when the batteries get low, and Solar Panels for charging the batteries.
Those parts are all for the build. There are more parts but I'm not nearly as organized as I should be for a build of this magnitude. Remember, this is my first actual robot build. I will post more pictures of the actual build once I get to that point. Right now I am cutting brackets for the servos and stuff like that. I really do not have a design, this is all coming from my head. After all parts are cut I will update everyone.


Easter Weekend Project: Mood Touch Lamp



Touchy Colours


Here’s a quick video of my Easter weekend project (well, one of them). There’s absolutely no guarentee I’ll finish it this weekend but the majority of the guts are done.

The project uses:
  • an Arduino (which I’ll later convert into a standalone board)
  • a shiftbrite (or similar) module, and
  • an old touch lamp
I ditched the 240V touch circuitry in favour of the CapSense library by Paul Badger. My sketch is hacky as a pile of hackysacks right now so if/when I’m done with the final version, I’ll post it.

Nordic Vibe


The inspiration for this project came from Sweden. My girl was watching me play with the shiftbrite module and said it reminded her of the mood rooms at the Nordic Light Hotel in Stockholm, Sweden.

I’ve noticed that certain colours make me feel better at different times of the day so I thought I might build this and experiment.

Saturday, March 31, 2012

ABE Accessibility Mod: Continuous Drive Servo Configuration Windows



["What the hell happened to my feet???]

What’s the deal with drilling holes in your drive servos?

Continuous rotation servos are made by taking normal servos and replacing the feedback pot with a static pot and/or some extra resistors. In essence, when you tell a regular servo motor to move itself to a specific angle, here’s what happens:
  1. It reads its current angle
  2. It sets the direction of the motor in such a way that the difference between the current angle and the one that you’ve requested will be reduced
  3. If the difference is large, the speed of the motor will be set high. If small, it will be set low
[pre-mod: notice the pot onboard and where it should line up to roughly once reinserted]
In a continuous rotation servo:
  1. It reads its current angle the angle given by the static pot (usually inside the enclosure). The static pot is usually set such that it reports back about 90°, which is the zero-point of most standard servos.
  2. As above
  3. As above
[a completed accessibility mod - I see a pot dial!]

So, why are you drilling holes again?

Well, in the not-so-wonderfully-made servos, there is a tendency for the servos to (over time or perhaps with vibration/delivery) have the pot move or the impedence in some way change itself. That means that when you want a continuous rotation servo to STOP, it will often be just moving instead.

Now, this can be fixed by telling the servo to go to the 90° angle and adjusting the pot until the servo stops moving. Doing this is a finnicky operation as the four screws that hold a servo together usually release all the gears, the circuit board and the motor at once. Getting it back together is a pain in my arse.

SO! One simple hole later and we have a feature that some servo makers are charging extra for: Accessible tuning pot. Done!

Saturday, March 24, 2012

Sneak peek: Upcoming project...



A pic from my upcoming project. A Cheyne-Stokes detector (experimental) of my own design. Project requirements: Mum to remind me how to use her sewing machine so I could go all stitch-bitch on this thing. :)

Friday, March 23, 2012

Bang! Narrowly-avoided Disaster

What the hell was that?

Not smart, I know. I was goofing around with an old transformer and I decided to hook it up to my WRPC to save on batteries whilst under development (replacing batteries gives me the shits). Anyhow, I wasn’t careful enough when connecting the leads (I forgot that 9V leads to 9V terminals invert) that I pumped a high-current 12V directly into the fuseless voltage regulator backwards (I seem to have a thing for backwards lately don’t I?).

The poor little bugger didn’t just burn out in the usual cloud of blue smoke. It went BANG!! and scared the crap out of me.

I was 70% confident that I’d only destroyed the regulator and it turned out I was right (thankfully). Swapping the regulator out with a new one (I keep these in handy supply) brought the WRPC right back to fully working order, however, it wasn’t without its twists and turns.


Track repair

Yep. Ahhh shit. Pulling out the dead regulator had some circuitwise side-effects. The traces attached to two of its legs didn’t like being disturbed and tore up away from the board.
Normally at this stage, the board is toast but if you read the previous post on how long it took me to make this damned board, I wasn’t about to give up on it.


Enter superglue

Superglue proved to be extremely useful in this case (sans the fumes when I re-soldered). It stuck the tracks back down and held them whilst soldering. I used one of the newly snipped pins of the replacement regulator as a jumper on the ground pin and it was as good as new.


Moral of the story

If you’re going to hook a transformer up to your ordinarily battery-powered project:

DO
  • TEST the transformer with something that isn’t your current life’s work
  • Use a multimeter and double check the polarity
  • Use an inline fuse that will blow if you screw up
DON’T
  • Be lazy
  • Guess at the polarity
  • Just hook it up and hope
I was fortunate that everything turned out okay and the WRPC was back up and running in under half an hour. It might not have been so chirpy though so I’m going to be a lot more careful next time.

Tuesday, March 20, 2012

ABE Signage

Randomly spotted this* whilst out and about.


It's just begging to be defaced. Not as clever as "rave outside the guard's compartment naked with a blue light", but meh. :)

*Those of you who know me well enough know that I rave about CamScanner+ for iPhone. This was a sign on a wall that I took a photograph of on an angle. App love!

Wednesday, March 7, 2012

First look at WRPC with ABE



This is a pre-pre-pre alpha look at the basics of communication between WRPC and ABE. Spot the bug at the end of the clip :)

Monday, March 5, 2012

Dual Battery Monitor Adapter

This is a design I sketched up tonight for a compact in-line dual battery monitor adapter for Arduino. Those of you who have looked into battery monitoring for Arduino will know that the maximum voltage that the Arduino's ADC pins can handle is 5v.

Here's a simple design (5 solder points) that will take your servo battery (~6v) and your Arduino battery (~9v) and reduce the voltage from them to safely measurable levels. I wouldn't push this design past measuring two 9v sources as it gets a bit close to the maximum.


Assuming you are using the voltages specified, the power usage is 58.5 microWatts. If you use 10M resistors instead, you can reduce that by a factor of 10 (und so weiter...).

I will be making one of these for ABE and a half-one for the WRPC so that they can monitor their own battery levels.

Tuesday, February 28, 2012

Wireless Reprogrammable PS2 Controller (Part III)

(or how I came to ditch veroboard)

img1s

Okay…

So, in the last post, I was about to build a vero-board model of the WRPC, having successfully demonstrated proof of concept on breadboard.

The reasons I chose veroboard for the next phase was that:

  1. There are a lot of pins on microcontrollers and my drill press isn’t compatible with the 0.8mm bit.
    (read that as: I don’t wanna hand-drill a billion holes)

  2. Less effort than a custom PCB

Point B became more than arguable over the course of development, as you’ll soon read about. For those of you either not on Google+ or just not reading what I post (fine, then!), here’s how the progress reports went:

Drama - Act 1, Scene 1

One fine day on Google+…
Later…
Finally…

Why did it fail?

The veroboard approach failed because either:

  1. I somehow made the tiniest little melt or jumper or something but because of how immensely complicated the back of the board became (because I wanted it to look nice), diagnosing it became impossible (but I still tried).

    OR

  2. Nothing was wrong with the veroboard, even though diagnosis was impossible. There was a mistake in the breadboard to veroboard conversion.

img2s

As it turns out…

When I finally caved and rebuilt the breadboard circuit with new parts (I will desolder and harvest the veroboard later), it did have an error. It didn’t make much sense to me at the time (and at time of writing, I’m just accepting it for now) but somehow connecting the second ground pin on the Atmega when pin 8 was already grounded caused an issue with reprogramming the board with the Wixel. If you’re interested, compare the schematic from the original post with the one below.

img3s

What I learned (VERO == UGLY)

Only use veroboard for circuits that will be out of sight or those that you don’t care how they look. If you try to get clever and reverse-wire a vero, it will only come back and bite you in the arse.

img5s

Onwards and Upwards

Once I threw out the vero idea, rebuilt the breadboard (and spent hours tracing down the source of the error), I was ready to arrange the PCB. After a few hours of rework, here’s the completed design courtesy of Fritzing:

img6s

Smaller than the vero model and much sexier.

I have included a full set of breakout header traces for both microprocessors and space for two stabilizing capacitors on the regulator, should I desire to add them.

Press-n-Peel

img7s

Now, the main reason I wanted to avoid a custom PCB for a prototype in the first place was because of all the dicking around with transferring a design to the board itself.

To that end (and because UV boards are bloody expensive), I bought some Press-n-Peel film from techniks.com. I have tried several different ways of PCB transfer, but I will have to say that provided you’re willing to do a bit of trial and error (like any method) with your printer settings, iron heat and method, Press-n-Peel film will give you the best PCB-making experience for your buck.

It took me 5 attempts to work out the correct combination of printer setting, iron heat and method but after those five attempts, I had this:

img8s

You’ll notice some minor touch ups because for this one (funnily enough) I used an imperfect piece of film. Murphy can eat my shorts as usual. Anyhow, it was only a short, soft scrub from that to this (custom type/art was added post-Fritzing in Inkscape, but more on that later):

img9s

And after all the etching and glazing…

img10s

…and all the drilling work (which I’m not that good at by hand) I realised…

img11s

…that I’d printed the bloody thing out BACKWARDS.

img12s

Well! Isn’t this just a full-on bag of …. F…un ….

Nevermind.

While it did massively increase the complexity of the soldering job (I soldered the microcontrollers on the reverse side) and changed the overall look of the finished board, I still managed to pull it off without losing it (somehow). I even held it together when my soldering iron died in the middle of it (I fixed it again).

The final (hardware) product

After this very very long and dramatic journey, with more twists and turns than I could even be bothered writing about (yes, there were more), here it is - the finished hardware:

img13s img14s img15s img16s img17s

Afterthoughts

I have written myself a reminder to do this, so I’ll get to it when I can spare another moment… I am going to post the settings that worked best for me with the Press-n-Peel film because I didn’t find that many articles that were very helpful about it online.

Until then…