Electronomous: Electronics, Arduino and Food For Thought
Monday, June 4, 2012
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
- 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.
- A single RGB module is far too weak to produce enough light to fill a room. More will need to be added.
- 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.
- 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.
To CASIO, I bow deeply and respectfully.
Saturday, April 7, 2012
Introducing Sandy Lloyd (and project( Mayhem))...
- 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 |
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.
Labels:
Arduino Uno R3,
continuous rotation,
Horns,
LED's,
robot,
servo,
Wheels
Location:
Cocoa Beach, FL, USA
Easter Weekend Project: Mood Touch Lamp
Touchy Colours
The project uses:
- an Arduino (which I’ll later convert into a standalone board)
- a shiftbrite (or similar) module, and
- an old touch lamp
Nordic Vibe
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.
Labels:
_projectMoodyTouch,
arduino,
CapSense,
shiftbrite,
touch sensor
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:- It reads its current angle
- 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
- 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] |
- It reads
its current anglethe 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. - As above
- 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!
Subscribe to:
Posts (Atom)