url stringlengths 37 208 | title stringlengths 4 148 | author stringclasses 173
values | publish_date stringclasses 1
value | categories listlengths 0 12 | tags listlengths 0 27 | featured_image stringlengths 0 272 | content stringlengths 0 56.1k | comments_count int64 0 900 | scraped_comments_count int64 0 50 | comments listlengths 0 50 | scraped_at float64 1.76B 1.76B |
|---|---|---|---|---|---|---|---|---|---|---|---|
https://hackaday.com/2010/11/10/android-talks-pulsewave/ | Android Talks Pulsewave | Joseph Thibodeau | [
"Android Hacks",
"digital audio hacks",
"Portable Audio Hacks"
] | [
"android",
"dac",
"rs232",
"serial"
] | Serial communications are a mainstay of digital computing. They don’t require much physical infrastructure and they exist in variations to fit almost any application. The behaviour of serial communications lines, varying from high to low voltage in a timed pattern, is analogous to a 1-bit DAC.
Using a whole DAC for serial communication
would be a waste in most cases, but the [
RobotsEverywhere
] team found an exception which you may have
encountered already
.
Since the audio output of the Android is accessible and addressable, [
RobotsEverywhere
] wrote source code to use the left and right channels as separate serial communication lines. This circumvents the need to bust into the device and muck about with the hardware which is great if you want a no-risk hack that allows communications to an RS232 port. Any hardware on which you can write to the DAC (and control the sampling rate) is a potential target.
There are some external electronics required to convert the audio signal to TTL, but it’s not very complicated–a couple of comparators and change. You can see it in action after the break.
As a bonus, when you’re done for the day you can plug in your headphones and listen to the
soothing poetry of pulse waves
all night long.
[youtube=http://www.youtube.com/watch?v=PfSSPTtacnk] | 41 | 40 | [
{
"comment_id": "210389",
"author": "elektrophreak",
"timestamp": "2010-11-10T13:36:51",
"content": "hey this is very cool!",
"parent_id": null,
"depth": 1,
"replies": []
},
{
"comment_id": "210391",
"author": "Owen",
"timestamp": "2010-11-10T13:43:24",
"content": "I’... | 1,760,377,339.650338 | ||
https://hackaday.com/2010/11/09/beginner-concepts-leds-and-laws/ | Beginner Concepts: LEDs And Laws | Devlin Thyne | [
"hardware",
"LED Hacks",
"Parts"
] | [
"adafruit",
"beginner concepts",
"led"
] | Adafruit has a
new LED tutorial
for people wanting to get started with electronics. It is full of useful diagrams, pictures, and quizzes to help make sure you are understanding the concepts. This is the real basic stuff here: LEDs, resistors, and the laws from Kirchhoff, and Ohm. It starts out explaining the parts of an LED. Then variations of LEDs: illumination versus indication, clear versus diffused, brightness, color, and size. The mass of the tutorial covers how and why an LED’s brightness can be changed by a resistor and why a resistor is needed to keep an LED from burning out. Such as how Kirchhoff’s Voltage Law works with Ohm’s Law to help you determine the proper resistor for an LED. If you found useful the other beginner concepts posts about
Analog Circuits
and
Electronics basics from the Giz
, you should find this tutorial to be useful. | 19 | 19 | [
{
"comment_id": "210219",
"author": "nizon",
"timestamp": "2010-11-10T01:20:49",
"content": "The positive side is longer, should you ever feel the need to bend it into a + sign :)",
"parent_id": null,
"depth": 1,
"replies": []
},
{
"comment_id": "210231",
"author": "jamieridd... | 1,760,377,340.17264 | ||
https://hackaday.com/2010/11/09/propeller-and-machine-gun-timing/ | Propeller And Machine Gun Timing | Mike Szczys | [
"Microcontrollers"
] | [
"airsoft",
"gun",
"interrupter gear",
"pellet",
"propeller",
"synchronize"
] | [Matt] was looking for a challenge. Inspired by the machine gun setups on World War I planes he wanted to make
a gun that can shoot between the blades of a spinning propeller
. The original guns used
an interrupter gear
that synchronized machine gun firing with the engine mechanically. [Matt] set out to do this using a microcontroller.
To make this work there are two important pieces of information; how fast is the propeller spinning right now, and how long does it take for the pellet to pass the blade? [Matt] used an oscilloscope and some infrared sensors to establish the firing delay at about 20-22ms. Another sensor shows the propeller is spinning at 500 RPMs, with some simple calculations showing that there is indeed a big enough window of time to fire between the blades. After testing with a visible LED and then building out the rest of the circuitry he accomplished his goal. He even added a test function that purposely hits the blades just to see how accurate the system was. We hope this shows up in a Red Baron RC replica, or
other flying arsenal
.
[via
Hacked Gadgets
] | 13 | 13 | [
{
"comment_id": "210211",
"author": "biozz",
"timestamp": "2010-11-10T00:35:50",
"content": "i thought some guy 60 years ago make a simple gar for this? XDbut yeah i love the concept XD",
"parent_id": null,
"depth": 1,
"replies": []
},
{
"comment_id": "210214",
"author": "Myt... | 1,760,377,340.013049 | ||
https://hackaday.com/2010/11/09/solderless-drawdio-terminally-implemented/ | Solderless Drawdio Terminally Implemented | Joseph Thibodeau | [
"digital audio hacks",
"Portable Audio Hacks"
] | [
"drawdio",
"music",
"pencil",
"synth",
"toys"
] | So you’re stuck in a boring class and you can’t fight off the urge to hack something, even your pencil, to pass the time. Maybe you are performing a live electronics show and you drop your synth down a flight of stairs and all that you are left with is a handful of components, a screw terminal block and a pencil. There are thousands, perhaps millions of these kinds of situations and for each one the answer is the
solderless drawdio clone
by [Martin].
You may have seen the original
Drawdio
here before, a fun piece of technology that is
simple enough to recreate
. This latest approach would make an excellent introductory project for a hacking workshop seeing as the guide is straightforward and the lack of soldering would make logistics so much easier. The results are very similar to the original–check the video after the break.
[youtube=http://www.youtube.com/watch?v=ooOPQ4h2pq0] | 5 | 5 | [
{
"comment_id": "210178",
"author": "Eirinn",
"timestamp": "2010-11-09T23:09:33",
"content": "Y’know, if they modded it to follow a scale; Say the pentatonic one – it would also sound good :)",
"parent_id": null,
"depth": 1,
"replies": []
},
{
"comment_id": "210266",
"author"... | 1,760,377,339.768943 | ||
https://hackaday.com/2010/11/09/ros-turns-three/ | ROS Turns Three | Chris Nelson | [
"Robots Hacks"
] | [
"library",
"os",
"robot"
] | Since its first debut three years ago,
ROS
has been gaining some
popularity
with the robotics folks. It’s behind the scenes of those impressive
quadcopters
you may remember from a while back. ROS helps abstract the lower level functions of a robot by supplying lots of code for commonly used components (
wiimote
for example). Being an “operating system” it comes with lots of nice features you would expect, like a package manager. It’s open source and many of their projects are well
documented
making it easy get started.
Check out the video after the break to see it in action
[youtube=http://www.youtube.com/watch?v=7cslPMzklVo] | 4 | 4 | [
{
"comment_id": "210169",
"author": "Hirudinea",
"timestamp": "2010-11-09T22:23:15",
"content": "Those turtles are so CUTE!",
"parent_id": null,
"depth": 1,
"replies": []
},
{
"comment_id": "210176",
"author": "Eirinn",
"timestamp": "2010-11-09T23:08:04",
"content": "... | 1,760,377,340.266786 | ||
https://hackaday.com/2010/11/09/debounce-code-one-post-to-rule-them-all/ | Debounce Code – One Post To Rule Them All | Mike Szczys | [
"Microcontrollers"
] | [
"button",
"code",
"debounce"
] | Last month
we asked you to send in your debounce code
. You didn’t disappoint and it’s time to share the code received. There were some guideline for sending in code so if you don’t see yours here, it probably didn’t follow the rules, sorry. We also tried to weed out code that using delay loops for debounce. These tend to be a poor way to handle inputs because they monopolize the processor.
We wanted to add upvote/downvote buttons to each set of code to give some idea of a group consensus on code quality but there’s no good system available for multiple up/down vote widgets on one wordpress page. This results in a huge code dump for any one person to go through. If you’ve got any ideas on how to better organize this let us know:
debounce@hackaday.com
.
We make no guarantees that this code is safe to use, or that it even works. Test it carefully before using for important tasks.
Join us after the break for a whirlwind of code examples.
Ned’s Debounce Code
Ned sent in a package of debounce code that monitors multiple buttons, debounces them, and detects button hold and release.
Main.c:
/*****************************************************************************************
* Project: Button Code
* Version: V1.0
* Client: ProTechNZ
* Date Created: 22/07/2010
* Date Modified: 23/07/2010
* Author: Neil van Geffen
* Company: ProTech NZ
* Micro: ATMega128
* Speed: 8MHz
* Clock Source: Internal
*****************************************************************************************/
/************************* Defines *******************************************************/
#include <io.h>
#include <stdlib.h>
#include <string.h>
#include <delay.h>
#include "NedsStandardHeader.h"
#include "C Files\buttons.h"
#define BTN_UP 0x01
#define BTN_DOWN 0x02
#define BTN_ENTER 0x04
#define BTN_CLEAR 0x08
/************************* Structs and Enums *********************************************/
/************************* Function Prototypes *******************************************/
unsigned char TimeYet(unsigned int time);
unsigned int TimeDiff(unsigned int past, unsigned int future);
void USART0SendByte(unsigned char byteToSend);
void USART1SendByte(unsigned char byteToSend);
void USART0SendArray(unsigned char *array, unsigned char noOfBytes);
void USART0SendString(unsigned char *string);
void USART0SendStringF(flash unsigned char *string);
/************************* Global Variables***********************************************/
unsigned char tempByte;
unsigned int tempWord;
unsigned char pA, pB, pC, pD;
unsigned char releaseCounter;
volatile unsigned int isrTime;
unsigned int currentTime;
unsigned int timeButtons;
unsigned int clearPressed;
/************************* Setup Code ****************************************************/
void SetupPorts (void) {
PORTA = 0x00;
PORTB = 0x00;
PORTC = 0x00;
PORTD = 0x04; // RXD1 (2)
PORTE = 0x01; // RXD0 (0)
PORTF = 0x00;
DDRA = 0xF0;
DDRB = 0xFF;
DDRC = 0xFF;
DDRD = 0xFF; // TXD1 (3)
DDRE = 0x02; // TXD0 (1)
DDRF = 0xFF;
}
// 1mS timer
void SetupTimers (void) {
TCCR0 = (0 << FOC0) | (0 << WGM00) | (0 << COM01) | (0 << COM00) | (1 << WGM01) | (1 << CS02) | (0 << CS01) | (0 << CS00); // CTC 8e6/64/125 = 1KHz
OCR0 = 124;
TIMSK |= (1 << OCIE0);
}
/************************* Main Code *****************************************************/
void main(void) {
SetupPorts();
SetupTimers();
SREG.7 = 1;
while (1)
{
SREG.7 = 0; // Atomic Time Keeping
currentTime = isrTime;
SREG.7 = 1;
pC &= 0x07; // keep pC to a max of 7
pD &= 0x07; // keep pD to a max of 7
PORTB = btnStatus.lastCount; // output number of buttons pressed to LEDs on PortB
PORTC = (0x80 >> pC); // output a counter to PortC
PORTD = (0x80 >> pD); // output a counter to PortD
if (TimeYet(timeButtons)) { // Time to run this bit of code yet
timeButtons += 5; // Set the next time to 5mS away (can be any value really)
UpdateButtons(currentTime); // Update the buttons
}
if (buttons.held) { // If any button is held
PORTF &= 0x0F; // clear the high nibble off PortF
PORTF |= (buttons.held << 4); // and output the buttons held to PortF high nibble
clearPressed = currentTime + 20; // set the clearPressed time to 20ms (used to clear the LEDs after 20ms)
switch (buttons.held) { // do something depending on what buttons are held (can do a "case BTN_UP | BTN_DOWN:" if you wanted to as well)
case BTN_UP: pD++; break;
case BTN_DOWN: pD--; break;
case BTN_ENTER: pC++; break;
case BTN_CLEAR: pC--; break;
default: pB++;
}
buttons.held = 0; // Clear the buttons held flags
}
if (buttons.pressed) { // if a button is pressed
PORTF &= 0xF0; // clear the low nibble
PORTF |= buttons.pressed; // and set the current puttons held to the low nibble
clearPressed = currentTime + 200; // set the clearPressed time to 200ms to get it to clear the LEDs after 200ms
switch (buttons.pressed) { // do something depending on what buttons are pressed
case BTN_UP: pD++; break;
case BTN_DOWN: pD--; break;
case BTN_ENTER: pC++; break;
case BTN_CLEAR: pC--; break;
default: pB++;
}
buttons.pressed = 0; // clear the buttons pressed flags
}
if (buttons.released) { // if any buttons are released
releaseCounter++; // increment the release counter
PORTF = 0x00; // clear PortF LEDs
PORTA &= 0x0F; // clear the PortA high nibble
PORTA |= (releaseCounter << 4); // and set what buttons were released to tht PortA LEDs
switch (buttons.released) { // do something on a button release
case BTN_UP: pD = 0; break;
case BTN_DOWN: pD = 7; break;
case BTN_ENTER: pC = 0; break;
case BTN_CLEAR: pC = 7; break;
default: pB++;
}
buttons.released = 0; // clear the button released flags
}
if (TimeYet(clearPressed)) { // if we should clear the LEDs
clearPressed = currentTime; // stop the time from wrapping-over
PORTF = 0x00; // clear the LEDs
}
}
}
/************************* Functions *****************************************************/
unsigned char TimeYet(unsigned int time) {
if (((time - 1) - currentTime) > 0xF000) { // if the time has passed (will roll around when not serviced for 4095 counts)
return 1; // the time has passed
}
else return 0; // or else it has not yet passed
}
/************************* Interrupts ****************************************************/
interrupt [TIM0_COMP] void TimerZeroCompare (void) {
isrTime++; // Keep Time
}
Buttons.h:
/************************************* START OF LIBRARY COMMENTS *******************************
* Library Name: Neds Button Code
* Version: V1.0
* Created: 22/07/10
* Last Mod: 23/07/10
* CV Version: 2.04.8a
* Author: Neil van Geffen
* Company: ProTechNZ
* Purpose: Read 4 buttons and return button presses, helds and releases.
************************************************************************************************/
/************************************* KNOWN BUGS **********************************************
*
************************************************************************************************/
/************************************* NOTES ***************************************************
* The code will decode the button presses into presses, holds and releases.
* A press is a press AND release before a hold is registered
* A hold is a press held long enough to register as a hold.
* A hold will automatically repeat itself at an increasing rate
************************************************************************************************/
#define BUTTONS (PINA & 0x0F) // Make the buttons the lower nibble active high (use ~ to get active low buttons to appear as active high)
#define REPEAT_MAX 250 // The start value of repeat debouncing when first pressing a button
#define REPEAT_MIN 25 // The lowest value of repeat debouncing when first holding a button
#define SPEED_SHIFT 3 // The repeat value decreases by the current repeat value >> by this value (aka 4 means it decreases by 1/16th every time)
#define DEBOUNCE_PRESS 25 // The debounce for a single press
#define DEBOUNCE_HOLD 600 // The debounce for a button hold
struct {
unsigned int pressed:4; // holds which buttons have been pressed and released
unsigned int held:4; // holds which buttons have been held for more than DEBOUNCE_HOLD
unsigned int released:4; // holds which buttons have been released after a button was held
} buttons;
#pragma used+
/***** UpdateButtons
* Read 4 buttons (defined as BUTTONS above)
* and save them to the buttons struct.
* Best if called on a regulat basis like every 10mS.
* Calling more often will give better resolution on button presses.
----------
* @param - curretTime, the current time to compare the last press too to calculate debounce and press held length
*****/
void UpdateButtons(unsigned int currentTime);
#pragma used-
#include "buttons.c"
Buttons.c:
/************************************* START OF LIBRARY COMMENTS *******************************
* Library Name: Neds Button Code
* Version: V1.0
* Created: 22/07/10
* Last Mod: 23/07/10
* CV Version: 2.04.8a
* Author: Neil van Geffen
* Company: ProTechNZ
* Purpose: Read 4 buttons and return button presses, helds and releases.
************************************************************************************************/
/************************************* KNOWN BUGS **********************************************
*
************************************************************************************************/
/************************************* NOTES ***************************************************
*
************************************************************************************************/
#define BUTTON_COUNT ((BUTTONS && (BUTTONS & (1 << 0))) + (BUTTONS && (BUTTONS & (1 << 1))) + (BUTTONS && (BUTTONS & (1 << 2))) + (BUTTONS && (BUTTONS & (1 << 3))))
#warning By compiling Neds button code, you acknowledge he is the man!
struct {
unsigned char heldFlag:1; // used by neds code, never change
unsigned char decreaseFlag:1; // used by neds code, never change
unsigned char lastStatus:4; // used by neds code, never change. The last valid combination of buttons pressed
unsigned char lastCount:4; // used by neds code, never change. The number of buttons held at one time
unsigned int time; // used by neds code, never change. The time the button press was changed
unsigned int repeat; // used by neds code, never change. The time between button held repeats
} btnStatus;
unsigned int TimeDiff(unsigned int past, unsigned int future) {
if (((future - 1) - past) > 0xF000) return 0;
else return future - past;
}
void UpdateButtons(unsigned int currentTime) {
if (TimeDiff(btnStatus.time, currentTime) >= DEBOUNCE_HOLD) { // If a button has been held
if (btnStatus.decreaseFlag) { // if the button count was lowered earlier but they have remained the same for the length of a hold time
btnStatus.decreaseFlag = FALSE; // clear the flag that states it was lowered
btnStatus.lastStatus = BUTTONS; // and set the button status to the currently pressed buttons
}
buttons.held = btnStatus.lastStatus; // Set what buttons were held
btnStatus.time += btnStatus.repeat; // and set the time to repeat the next press
btnStatus.repeat = MAX(REPEAT_MIN, btnStatus.repeat - MAX(1,(btnStatus.repeat >> SPEED_SHIFT))); // and lower the repeat value to increase the button held repeat rate
btnStatus.heldFlag = TRUE; // and set the flag that states a button was held
}
if (!BUTTONS) {
if (btnStatus.heldFlag) { // If the buttons were previously held
btnStatus.heldFlag = FALSE; // Clear the flag so it doesnt set buttons pressed continously
buttons.released = btnStatus.lastStatus; // Set what buttons were pressed previously
}
else if (TimeDiff(btnStatus.time, currentTime) >= DEBOUNCE_PRESS) { // but if the buttons werent held, but pressed for long enough to pass as a debounce
buttons.pressed = btnStatus.lastStatus; // Set what buttons were pressed
}
btnStatus.lastCount = 0; // Clear the last count
btnStatus.lastStatus = 0; // Clear the last Status
btnStatus.time = currentTime; // clear the last press time
}
else if (BUTTON_COUNT > btnStatus.lastCount) { // if the number of buttons pressed has changed
btnStatus.lastCount = BUTTON_COUNT; // save it for next time.
btnStatus.lastStatus = BUTTONS; // and save what buttons were pressed.
btnStatus.decreaseFlag = FALSE; // clear the flag that says the button presses just decreased.
btnStatus.time = currentTime; // reset the time of last button presses.
btnStatus.repeat = REPEAT_MAX; // and reset the time between held repeats.
}
else if (BUTTON_COUNT && (BUTTON_COUNT < btnStatus.lastCount)) { // Or if the button count deceased but a button is still pressed
btnStatus.lastCount = BUTTON_COUNT; // save the count for next time
btnStatus.decreaseFlag = TRUE; // set the flag to say this happened
btnStatus.time = currentTime; // reset the time of last button presses.
btnStatus.repeat = REPEAT_MAX; // and reset the time between held repeats.
}
else if (!btnStatus.decreaseFlag && (BUTTONS != btnStatus.lastStatus)) { // If someone changed button presses but not the count
btnStatus.lastCount = 0; // Force the count to change next time around so the code to set times etc isnt in 2 places.
} // This is a fairly useless bit of code if the service time is less than 10mS and even if its more, it won't be all that usefull.
}
S1axter’s Debounce Code
Developed for PIC24 chips, this code repeatedly calls a function to check a pin state.
pin_io.h:
//////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Pin I/O control module - Header
//
// Language: Microchip C30
//
// File: pin_io.h
// Author: MyBitBox.com/Geeksinside.com
// Created: 08/23/09
//
//////////////////////////////////////////////////////////////////////////////////////////////////////
#ifndef __PIN_IO_H__
#define __PIN_IO_H__
void pin_io_init(void);
void pin_input_check(void);
#endif
pin_io.c:
//////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Pin I/O control module
//
// Language: Microchip C30
//
// File: pin_io.c
// Author: MyBitBox.com/Geeksinside.com
// Created: 08/23/09
//
//////////////////////////////////////////////////////////////////////////////////////////////////////
typedef struct{
uint16 mask;
uint16 last_state;
uint8 changed;
}pin_check_struct;
pin_check_struct inputA, inputB;
//====================================================================================
// Set up the pins
//====================================================================================
void pin_io_init(void)
{
inputA.changed = FALSE;
inputA.last_state = FALSE;
inputA.mask = BMASK(2); // look at PORTB2
inputB.changed = FALSE;
inputB.last_state = FALSE;
inputB.mask = BMASK(4); // look at PORTB4
return;
}
//====================================================================================
// This is the debounce routine. When this is called it checks for consistant pin states
//====================================================================================
void pin_input_check(void)
{
uint16 portb_snapshot = PORTB;
// This is for the XXXXX input
// ------------------------------------------------------
if(inputA.changed == TRUE)
{
if(!((portb_snapshot ^ inputA.last_state)&inputA.mask))
{
// If the line was changed last time, and it is the same state as last
// time, then we need to lock it in here (If the bits are not the same then this routine
// will be called again and the correct value will be locked in)
if(portb_snapshot & inputA.mask)
{
// Do this when the line goes high
SYS_STATUS.FLAG_XXXXX_LINE = TRUE;
}else{
// Do this when the line goes low
SYS_STATUS.FLAG_XXXXX_LINE = FALSE;
}
// Clear the changed flag
inputA.changed = FALSE;
}
}
// Mask out any changed input pins
inputA.changed = ((inputA.last_state ^ (portb_snapshot & inputA.mask))>0); // XOR with last last_state to find changed pins
inputA.last_state = portb_snapshot & inputA.mask;
// This is for the YYYYY input
// ------------------------------------------------------
if(inputB.changed == TRUE)
{
if(!((portb_snapshot ^ inputB.last_state)&inputB.mask))
{
// If the line was changed last time, and it is the same state as last
// time, then we need to lock it in here (If the bits are not the same then this routine
// will be called again and the correct value will be locked in)
if(portb_snapshot & inputB.mask)
{
// Do this when the line goes high
SYS_STATUS.FLAG_YYYYY_LINE = TRUE;
}else{
// Do this when the line goes low
SYS_STATUS.FLAG_YYYYY_LINE = FALSE;
}
// Clear the changed flag
inputB.changed = FALSE;
}
}
// Mask out any changed input pins
inputB.changed = ((inputB.last_state ^ (portb_snapshot & inputB.mask))>0); // XOR with last last_state to find changed pins
inputB.last_state = portb_snapshot & inputB.mask;
return;
}
//end
Aaron Keith’s Debounce Code
This code is tailored for an 8051 processor.
Button_debounce_8051.c:
/*--------------------------------------------------------------------------
10/14/2010: Button debounce code by Aaron Keith
This code detects and debounces button presses. It is tailored for use with
8051 micro controllers. Complied on the RIDE 51 Complier
The interrupt service routine (ISR) runs 3600 times per second. If the
button is pressed (the pin is connected to GND) Key_Hit is incremented to the
maximum 255. When the button is released Key_Hit will decremented to 0.
Long_Key_Hit will increment more slowly and is used to detect the button
being help down.
--------------------------------------------------------------------------*/
#include<reg51.h>
#define TRUE 1
#define FALSE 0
//define pins used by buttons
at 0x97 sbit P1_7 ;
#define BUTTON P1_7 //Button on Port 1.7
//De bounce variables
unsigned char Key_Hit;
unsigned char Long_Key_Hit;
/*--------------------------------------------------------------------------
Prototypes
--------------------------------------------------------------------------*/
void init_timers(void);
/*--------------------------------------------------------------------------
FUNC: - Sets and starts a system timer
PARAMS: NONE
RETURNS: NONE
--------------------------------------------------------------------------*/
void init_timers(void) // using a 11.0592 Mhz Clock
{
TMOD = 0x02; //T0 mode 2 8 bit reload
// Timer 0 is system tick
TH0 = 0x00; // Reload = 256, giving 921600/256=3600
TL0 = 0x00;
ET0 = TRUE; // Enable interrupt on timer 0
TR0 = TRUE; // Start timer 0;
EA = TRUE;
}
/*--------------------------------------------------------------------------
FUNC: - Main
--------------------------------------------------------------------------*/
void main(void)
{
init_timers(); //start the timer
for (;;) //loop forever
{
if (Key_Hit == 0xff)
{
//Key press detected. Do something here
}
if (Key_Hit == 0x00)
{
//Key release detected. Do something here
}
if (Long_Key_Hit == 0xff)
{
//Key press and help down. Do something here
}
}
}
/*--------------------------------------------------------------------------
INTERRUPT: // The procedure runs 3600 times per second
--------------------------------------------------------------------------*/
void Timer0_interrupt(void) interrupt 1
{
static unsigned char Div18Counter = 0;
if (BUTTON)
{ // Button up (Pin is connected to VCC)
if (Key_Hit != 0) // Will never go below zero
{
Key_Hit--;
}
}
else
{ // Button down (Pin is connected to GND)
if (Key_Hit != 0xff) // Will never go above 255
{
Key_Hit++;
}
}
if (++Div18Counter >= 18) // run ever 5 mSec
{
Div18Counter = 0;
if (Key_Hit == 0xff)
{
if (Long_Key_Hit != 0xff)
Long_Key_Hit++;
}
else if (Key_Hit == 0x00) // No delay when detecting key release.
Long_Key_Hit = 0x00;
}
}
Thomas Flayols’ Debounce Code
This code creates a software-based low-pass filter by taking a moving average of the pin value.
// Hi, to prevent contact bounce, my solution is to create software low pass filter by using a moving average...(no delay solution) see the jpg to see what's happen
// INPUT is the button input pin(0if not pressed, 1 if pressed)
main(void)
{
unsigned char button = 0;
while(1)
{
// your code here...
button=(button * 9+INPUT * 10)/10; // do a moving average of the digital input... result button between 0 and 10
if (button > 5)
{
//the button is ON
}
else
{
//the button is OFF
}
}
}
Ganesh Krishna’s Debounce Code
Can be scaled to any number of buttons, sample rate is configurable, and this aims to use as little RAM as possible
dbounce.c:
#include <htc.h>
/* Scalable software debounce for buttons
*
* This is quick implementation of software debounce with as little RAM as possible.
* stress is given to scalability of number of buttons
* and scalability of number of samples per debounce cycle.
*
* While this file is written for PIC Microcontroller and Hi-tech compiler,
* the debounce function itself is just C, and not hardware dependant.
*
* Use the functions at your own risk
* Author: ganesh.ksm@gmail.com
*
* Assume BSD like license.
* Acknowledge with an email if it works for you.
*
*/
/*Number of buttons in the system*/
#define MAX_BUTTONS 4
/* MAJORITY_VOTE Number of samples for which the button must remain in pressed state
* to consider that the button is pressed.
* */
#define MAJORITY_VOTE 5
/* STABILITY_BITS is the number of final samples (last few samples at the end of debounce)
* after which we consider the input stable
* */
#define STABILITY_BITS 2
/* Convert Stability bits to a bit mask, i.e STABILITY_MASK has STABILITY_BITS bits set in its LSB
* */
#define STABILITY_MASK ((1<<STABILITY_BITS) - 1)
/*This variable contains the debounced status of all buttons
at any point of time
*/
volatile unsigned int debounced_buttons;
/* Reads port pins and returns 1 if button is active (assumed active low)
* returns 0 if inactive. Microchip PIC18 specific.
* */
unsigned char Read_Portbit(int button)
{
switch(button)
{
case 0: return !RA0;
case 1: return !RA1;
case 2: return !RA2;
case 3: return !RA3;
}
}
/* Function: button_is_pressed()
* Argument: Takes the button number as argument, an index into the array of buttons.
* Returns: non zero if the button of interest is pressed for majority time of polling
* returns zero if not pressed, debouncing not complete,
* button bouced back to unpressed state
*
* Calling rate: This function will return positive only after MAJORITY_VOTE is achieved
* times with same button argument for debounce of one button.
* where X is the number of samples per debounce,
*
* Depends on: Read_Portbit(button) which returns 1 if the pin of button of interest is active and 0 if not.
*/
char button_is_pressed( unsigned char button)
{
unsigned int bit_count=0, temp;
/* button_bits[] is an array to hold the previous states of the port pin value
* Each element holds the previous samples of teh button read.
* We need as many elements as there are buttons.
* Make this an integer array if more than 8 samples are needed for debounce determination.
* if less samples are needed adjust the MAJORITY_VOTE and STABILITY_BITS to a smaller number
* */
volatile static unsigned char button_bits[MAX_BUTTONS];
/* Shift the latest read button status into the que
* we should have the latest sample in LSB and older samples
* higher up.*/
button_bits[button]=button_bits[button]<<1 | (Read_Portbit(button) & 0x01);
temp = button_bits[button];
/*Check if the input is stable in the last STABILITY_BITS samples*/
if ((temp & STABILITY_MASK) == STABILITY_MASK)
{
/* Count the number of bits set in temp, we need more than the majority
* straight out of the book of K&R, check it :-)*/
while(temp = temp&(temp-1))
bit_count++;
bit_count++; // we are off by one
/*Check if the required number of samples were favourable */
if (bit_count>=MAJORITY_VOTE)
{
button_bits[button] = 0;
return 1;
}
else
return 0;
}
else
{
return 0;
}
}
/* Call at a rate about 8 times higher than the rate at which input detection is required
* actual frequency depends on the number of samples required per debounce.
*/
void Service_user_Input(void)
{
int i;
for (i=0;i<MAX_BUTTONS;i++)
{
if (button_is_pressed(i))
debounced_buttons = debounced_buttons | 0x01<<i;
}
}
void main (void)
{
/*PIC18 specific intialization of timer interrupt*/
GIE=1;
PEIE=1;
TMR0IE=1;
T0CON= 0X48; //16 bit timer without Prescaler for interrupts
TMR0L=0xFA;
TMR0H=0xFF;
TMR0ON=1;
TRISA = 0xFF; // PORTA is input.
/*Application code starts here*/
while(1)
{
/*Do something usefull with debounced_buttons*/
}
}
void interrupt User_Input()
{
TMR0L=0x00; /*Not really needed, but lets be explicit*/
TMR0H=0x00;
TMR0ON=1;
Service_user_Input(); /*you may choose to call this in an timed function in the main thread too*/
}
Kenneth Kuhn’s Debounce Code
[Chad] has been using a modified version of
[Kenneth Kuhn’s] debounce code
for some time now. Small, fast, and well commented, it uses an integrator algorithm.
debounce.c:
/******************************************************************************
debounce.c
written by Kenneth A. Kuhn
version 1.00
This is an algorithm that debounces or removes random or spurious
transistions of a digital signal read as an input by a computer. This is
particularly applicable when the input is from a mechanical contact. An
integrator is used to perform a time hysterisis so that the signal must
persistantly be in a logical state (0 or 1) in order for the output to change
to that state. Random transitions of the input will not affect the output
except in the rare case where statistical clustering is longer than the
specified integration time.
The following example illustrates how this algorithm works. The sequence
labeled, real signal, represents the real intended signal with no noise. The
sequence labeled, corrupted, has significant random transitions added to the
real signal. The sequence labled, integrator, represents the algorithm
integrator which is constrained to be between 0 and 3. The sequence labeled,
output, only makes a transition when the integrator reaches either 0 or 3.
Note that the output signal lags the input signal by the integration time but
is free of spurious transitions.
real signal 0000111111110000000111111100000000011111111110000000000111111100000
corrupted 0100111011011001000011011010001001011100101111000100010111011100010
integrator 0100123233233212100012123232101001012321212333210100010123233321010
output 0000001111111111100000001111100000000111111111110000000001111111000
I have been using this algorithm for years and I show it here as a code
fragment in C. The algorithm has been around for many years but does not seem
to be widely known. Once in a rare while it is published in a tech note. It
is notable that the algorithm uses integration as opposed to edge logic
(differentiation). It is the integration that makes this algorithm so robust
in the presence of noise.
******************************************************************************/
/* The following parameters tune the algorithm to fit the particular
application. The example numbers are for a case where a computer samples a
mechanical contact 10 times a second and a half-second integration time is
used to remove bounce. Note: DEBOUNCE_TIME is in seconds and SAMPLE_FREQUENCY
is in Hertz */
#define DEBOUNCE_TIME 0.3
#define SAMPLE_FREQUENCY 10
#define MAXIMUM (DEBOUNCE_TIME * SAMPLE_FREQUENCY)
/* These are the variables used */
unsigned int input; /* 0 or 1 depending on the input signal */
unsigned int integrator; /* Will range from 0 to the specified MAXIMUM */
unsigned int output; /* Cleaned-up version of the input signal */
/* Step 1: Update the integrator based on the input signal. Note that the
integrator follows the input, decreasing or increasing towards the limits as
determined by the input state (0 or 1). */
if (input == 0)
{
if (integrator > 0)
integrator--;
}
else if (integrator < MAXIMUM)
integrator++;
/* Step 2: Update the output state based on the integrator. Note that the
output will only change states if the integrator has reached a limit, either
0 or MAXIMUM. */
if (integrator == 0)
output = 0;
else if (integrator >= MAXIMUM)
{
output = 1;
integrator = MAXIMUM; /* defensive code if integrator got corrupted */
}
/********************************************************* End of debounce.c */
Ubi de Feo’s Debounce Code
Arduino sketch to debounce pins from an array.
#define ARRAY_SIZE 8
// array of pins to be debounced
short pinsToDebounce[]={
2,3,4,5,6,7,8,9
};
// array of pin state
int swStates[]={
0,0,0,0,0,0,0,0};
// array of previous pin state
int swPrevStates[]={
0,0,0,0,0,0,0,0};
// array to store the actual state during debounce
int swDebouncedStates[]={
0,0,0,0,0,0,0,0};
// array to store the previous state during debounce
int swPrevDebounceStates[]={0,0,0,0,0,0,0,0};
// time to debounce
int debounceDelay=100;
// array of previous times the pin has been checked
long prevTimes[]={
0,0,0,0,0,0,0,0};
void setup(){
Serial.begin(9600);
initSwitches();
}
void loop(){
readSwitches();
}
void initSwitches(){
for(int i=0;i<ARRAY_SIZE;i++){
pinMode(pinsToDebounce[i],INPUT);
}
}
void readSwitches(){
// Serial.print("active switch set ");
// Serial.println((int)activeSwitchSet);
for(short sw=0;sw<ARRAY_SIZE;sw++){
volatile int pin=pinsToDebounce[sw];
volatile int mpPin=pin;
volatile int pinPosition=sw;
swStates[pinPosition]=digitalRead(pin);
}
debouncePins();
checkStateChange();
}
void debouncePins(){
volatile long _millis=millis();
for(short sw=0;sw<ARRAY_SIZE;sw++){
if(swStates[sw]!=swPrevStates[sw]){
prevTimes[sw]=_millis;
}
if(_millis-prevTimes[sw]>debounceDelay){
prevTimes[sw]=_millis;
swDebouncedStates[sw]=swStates[sw];
/*
Serial.print("button ");
Serial.print(sw);
Serial.print(" is ");
Serial.println(swDebouncedStates[sw]);
*/
}
swPrevStates[sw]=swStates[sw];
}
}
void checkStateChange(){
for(short sw=0;sw<5;sw++){
if(swPrevDebounceStates[sw]!=swDebouncedStates[sw]){
/*
Serial.println("");
Serial.print("button ");
Serial.print(sw);
Serial.print(" ");
Serial.println(swDebouncedStates[sw]);
*/
if(swDebouncedStates[sw]==1){
pinActive(sw);
}
if(swDebouncedStates[sw]==0){
pinInactive(sw);
}
}
swPrevDebounceStates[sw]=swDebouncedStates[sw];
}
}
void printDebStates(){
Serial.println("%%%%%%%%%%%%%%%%%%%%%%%%");
for(int i=0;i<ARRAY_SIZE;i++){
Serial.print(swDebouncedStates[i]);
Serial.print('*');
}
Serial.println("");
}
void pinActive(int _id){
Serial.print("active pin ");
Serial.println(pinsToDebounce[_id]);
}
void pinInactive(int _id){
Serial.print("inactive pin ");
Serial.println(pinsToDebounce[_id]);
}
Christoph Gommel’s Debounce Code
Debouncing and scanning a keyboard matrix with an STM32 ARM processor.
/*
keyboard.c
Used on an STM32F103 in a wireless remote control
(C) 2010 Christoph Gommel <chg@contronix.de>
Contronix GmbH, Nizzastr. 6, 01445 Radebeul, Germany
Tags: matrix, keyboard, stm32, stm32f103, debounce, hackaday
*/
#include "stm32f10x.h"
#include "keyboard.h"
#include "fifo.h"
#define KEYBOARD_GPIO (GPIOA)
// Cols and rows are intentionally placed in the right order enabling the bit shifting trick used.
#define COL1 (GPIO_Pin_1)
#define COL2 (GPIO_Pin_2)
#define COL3 (GPIO_Pin_3)
#define COLS (COL1|COL2|COL3)
#define ROW1 (GPIO_Pin_4)
#define ROW2 (GPIO_Pin_5)
#define ROW3 (GPIO_Pin_6)
#define ROW4 (GPIO_Pin_7)
#define ROW5 (GPIO_Pin_8)
#define ROWS (ROW1|ROW2|ROW3|ROW4|ROW5)
//#define ROWS_B (ROW5)
#define ColNum (3)
#define RowNum (5)
#define ColStart (1)
#define RowStart (4)
//Very useful macro to increment and modulo in one instruction
#define incmod(n,m); n=((n+1)%m);
// Yes, we have a shift key too
#define SHIFT (GPIO_Pin_0)
GPIO_InitTypeDef GPIO_InitStructure;
#define KeyBufferSize (20)
//volatile unsigned char keypad_queue_buffer[KeyBufferSize];
static char keypad_queue_buffer[KeyBufferSize];
fifo_t keyfifo;
void keyboard_init(void)
{
//Initialize a self made fifo system
fifo_init(&keyfifo, keypad_queue_buffer, KeyBufferSize);
//Give clock to the GPIO
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);
//Initialize the rows as push-pull-output
GPIO_InitStructure.GPIO_Pin = ROWS;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_Init(KEYBOARD_GPIO, &GPIO_InitStructure);
//The cols ar input with pull-up
GPIO_InitStructure.GPIO_Pin = COLS | SHIFT;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPU;
GPIO_Init(KEYBOARD_GPIO, &GPIO_InitStructure);
GPIO_SetBits(KEYBOARD_GPIO, ROWS);
}
volatile unsigned int CurrentRow = 0;
volatile unsigned int lastScan = 0;
volatile unsigned int thisScan = 0;
volatile unsigned int debounceCnt;
volatile unsigned int numberOfKeys;
volatile unsigned int thisScancode;
volatile unsigned int lastScancode;
//Adapt this to you wishes
#define debounceMax (10)
//The following piece of code will be called every 10 ms from a systick interrupt
void keyboard_scan(void)
{
unsigned int scan;
scan = ((~GPIO_ReadInputData(KEYBOARD_GPIO)) & COLS) >> ColStart;
//this is the really interesting core of my matrix scanning algorithm.
//each key of the matrix is represented in one bit of a 16 bit unsigned short ;)
thisScan = (thisScan | (scan << (ColNum * RowNum))) >> ColNum;
//Release Current Row
GPIO_SetBits(KEYBOARD_GPIO, 1 << (CurrentRow + RowStart));
incmod(CurrentRow,RowNum);
//prepare next Row
GPIO_ResetBits(KEYBOARD_GPIO, 1 << (CurrentRow + RowStart));
if (0 == CurrentRow)
{
//Something changed, let's reset the debounce counter
if (thisScan != lastScan)
{
debounceCnt = 0;
}
//...or increase if nothing changed
else if (debounceCnt < debounceMax)
{
debounceCnt++;
}
//... if the threshold is reached
if (debounceCnt == debounceMax)
{
numberOfKeys = 0;
int i;
//count the number of keys pressed and mark the position of the set bit in "thisScancode"
for (i = 0; i < (ColNum * RowNum); i++)
if (thisScan & (1 << i))
{
numberOfKeys++;
thisScancode = i + 1;
}
//ignore multiple key presses...
if (1 != numberOfKeys)
thisScancode = 0;
else
{
//.. except the shift key which is NOT part of the matrix
if (keyboard_getshift())
thisScancode |= KEYBOARD_SHIFT;
if (thisScancode != lastScancode)
{
//printf("Scan: %d\r\n",thisScancode);
fifo_put(&keyfifo, thisScancode);
//this is typematic. to generate multiple keystrokes on one single looooooooooong press
#ifdef ENABLE_TYPEMATIC
typematicCnt=0;
#endif
}
#ifdef ENABLE_TYPEMATIC
else
{
typematicCnt++;
if ((typematicThreshold+typematicSpeed)<=typematicCnt)
typematicCnt=typematicThreshold;
if (typematicThreshold==typematicCnt)
{
fifo_put(&keyfifo, thisScancode);
}
}
#endif
}
lastScancode = thisScancode;
//Now we have to do the processing because we get some freshly debounced situation, baby!
//currentKey=((thisScan^oldScan)&thisScan);
//oldScan=thisScan;
}
lastScan = thisScan;
thisScan = 0;
}
}
//that's it, folks ;)
Dean Hall’s Debounce Code
Debouncing a pin interrupt on AVR microcontrollers
/*
* Sample debouncing code
*
* Copyright 2010 Dean Hall.
* This code snippet is offered under the MIT license:
* http://www.opensource.org/licenses/mit-license.html
*/
/*
* The hardware is an AVR with a switch connected to the INT0 input.
* The firmware uses:
*
* - AVR Libc: http://www.nongnu.org/avr-libc/
* - The AvrX microkernel: http://www.barello.net/avrx/
*
* This sample code performs debouncing on the INT0 input.
* Here is the expected sequence of actions:
*
* - The AVR can be doing anything (awake or asleep) when the button is pressed
* - The button press produces a low-going signal and bounces for a time
* - The low-going signal activates the INT0 interrupt
* - The INT0 service routine:
* - Disables the INT0 interrupt so bouncing doesn't cause multiple IRQs
* - Puts an AvrX message in the event queue of the inputs task
* - The event in the queue causes the inputs_task to be scheduled, which:
* - Performs the action that the INT0 button is supposed to invoke
* - Starts an AvrX delay timer to allow for the button to stop bouncing
* During this delay, other AvrX tasks may run.
* - After the delay, the INT0 interrupt is re-enabled for the next input.
*
* In this design, the delay is especially long (1s) due to a very cheap button
* and no need to respond to fast button presses.
*
* The downside of this software design is that no other input events are
* processed while a button is debounced, although their press-messages are
* queued up and handled after the debounce period. This behavior was
* acceptable for this immediate design, but may not be for all situations.
*/
#include <avr/interrupt.h>
#include "avrx.h"
#define DEBOUNCE_DELAY (uint16_t)(1000 / MILLISECONDS_PER_TIC)
static MessageControlBlock remote_ctrl_pressed_msg;
/* Remote Control button press interrupt service routine */
AVRX_SIGINT(INT0_vect)
{
IntProlog();
/* Disable INT0/RemoteCtrl interrupt */
GICR &= ~_BV(INT0);
AvrXIntSendMessage(&inputs_msg_queue, &remote_ctrl_pressed_msg);
Epilog();
}
AVRX_GCC_TASKDEF(inputs_task, TASK_STACK_SIZE, 3)
{
TimerControlBlock debounce_timer;
MessageControlBlock *pmsg;
/* Set INT0/RemoteCtrl and INT1/OpTest to trigger on falling edge */
GICR &= ~(_BV(INT0) | _BV(INT1));
MCUCR &= ~(_BV(ISC00) | _BV(ISC10));
MCUCR |= (_BV(ISC01) | _BV(ISC11));
GICR |= (_BV(INT0) | _BV(INT1));
/* ... other initialization stuff removed */
for (;;)
{
/* Wait for a message that an input was pressed or timer expired */
pmsg = AvrXWaitMessage(&inputs_msg_queue);
/* ... removed if-cases for other unrelated input messages */
else if (pmsg == &remote_ctrl_pressed_msg)
{
DEBUG_PRINT(VERBOSITY_LOW, "RmtCtrl pressed.\n");
/* ... removed code that performs the action the button invokes */
/* Debounce delay for RemoteCtrl button; lets other threads run */
AvrXDelay(&debounce_timer, DEBOUNCE_DELAY);
/* Clear flag and enable interrupt */
GIFR |= _BV(INTF0);
GICR |= _BV(INT0);
}
}
}
Brad Basler’s Debounce Code
Debounce synchronously or asynchronously using an ISR. Usage is discussed in
this thread
.
debounce.h:
#ifndef __DEBOUNCE_H__
#define __DEBOUNCE_H__
#include <avr/interrupt.h>
//Optimized for 20 millisecond period on a 1Mhz clock
#define DBNC_TIMR0_PRESCALER _BV(CS02)
#define DBNC_TIMR0_BASEVAL 178
//Defines the size of the debouncer handler arrays (i.e. 4 for a maximum of four)
#define DBNC_NUM_DEBOUNCERS 8
//Defines the number of timer ticks before a value is considered legitimate
//This will define a maximum debounce time of approx 100 milliseconds @ 5
//The minimum debounce time will be approx 80 milliseconds
#define DBNC_COUNTER_TOP 3
#define _BITSHIFTBY(bit,num) ((bit)<<(num))
typedef void(*debounceHandler)(uint8_t,uint8_t);
typedef struct
{
//A pointer to a volatile port (I/O or otherwise)
volatile uint8_t *port;
//A pointer to a debounceHandler function
debounceHandler handler;
//This is the decremental counter which determines
//if the button has been debounced
uint8_t counter;
/*
Bits 0-3: bit index to check against (0-7)
Bits 4-5: unused
Bit 5: Last known sate
Bit 6: Signaled
Bit 7: Asynchronous
*/
uint8_t bitmap;
} DBNC_ITEM;
typedef struct
{
//An array of debouncer units
DBNC_ITEM dbUnits[DBNC_NUM_DEBOUNCERS];
//This is set to 1 when any signal in the dbncSignaled array has been set
uint8_t signalReady;
} DBNC_GLOBAL;
/*
Forward Declarations
*/
//ISR for timer0 overflow interrupt
ISR(TIMER0_OVF_vect);
void callSignaledHandlers(void);
void registerDebouncer(volatile uint8_t *port,uint8_t bit,uint8_t index,uint8_t Asynchronous,debounceHandler handler);
void signalChangedState(uint8_t index,uint8_t counterTop);
void initializeDebouncerTimer();
#endif
debounce.c:
#include <avr/io.h>
#include <avr/interrupt.h>
#include <util/delay.h>
#include "debounce.h"
volatile DBNC_GLOBAL db;
//ISR for timer0 overflow interrupt
ISR(TIMER0_OVF_vect)
{
uint8_t i;
uint8_t temp;
uint8_t workDone = 0;
//Cycle through all debounced items
for (i=0;i<DBNC_NUM_DEBOUNCERS;i++)
{
//Skip items that have been idle
if (db.dbUnits[i].counter == 0)
continue;
workDone = 1;
//If debounce period has elapsed
if (--db.dbUnits[i].counter == 0)
{
//Grab current logical bit state of the port (1 or 0)
temp = (((*(db.dbUnits[i].port)) & _BV((db.dbUnits[i].bitmap & 0b111))) != 0);
//If current state != last state
//store change
if (temp != ((db.dbUnits[i].bitmap & _BV(5)) >> 5))
{
//Flip last state bit
db.dbUnits[i].bitmap ^= _BV(5);
//If this debouncer item is synchronous
//Then signal it
if (!(db.dbUnits[i].bitmap & _BV(7))) {
//Signal this debouncer item
db.dbUnits[i].bitmap |= _BV(6);
//Signaling options
db.signalReady = 1;
}
//Otherwise it's asynchronous,
//call immediately
else
//Call Handler
(*db.dbUnits[i].handler)(i,temp);
}
}
}
//If all counters were already 0, disable the timer
if (!workDone)
TCCR0B = 0;
TCNT0 = DBNC_TIMR0_BASEVAL;
}
//Call any signaled handlers (to be executed in main program loop)
void callSignaledHandlers(void)
{
int i;
if (!db.signalReady) return;
for (i=0;i<DBNC_NUM_DEBOUNCERS;i++)
{
//Check if this item is signaled
if (db.dbUnits[i].bitmap & _BV(6)) {
//If so, reset its signal
db.dbUnits[i].bitmap &= ~_BV(6);
//Call item and pass on last known state
(*db.dbUnits[i].handler)(i,(db.dbUnits[i].bitmap & _BV(5))>>5);
}
}
//Reset signal
db.signalReady = 0;
}
void registerDebouncer(volatile uint8_t *port,uint8_t bit,uint8_t index,uint8_t Asynchronous,debounceHandler handler)
{
//Store port pointer
//Store handler pointer
//Reset counter to 0
//Store bitmap of bit offset/asynchronous state
//Set signaled to 0
db.dbUnits[index].port = port;
db.dbUnits[index].handler = handler;
db.dbUnits[index].counter = 0;
db.dbUnits[index].bitmap = _BITSHIFTBY((Asynchronous != 0),7)|
_BITSHIFTBY((((*port) & _BV(bit)) != 0),5)|
bit;
}
void signalChangedState(uint8_t index,uint8_t counterTop)
{
if (!counterTop)
db.dbUnits[index].counter = DBNC_COUNTER_TOP;
else
db.dbUnits[index].counter = counterTop;
if (!TCCR0B)
TCCR0B = DBNC_TIMR0_PRESCALER;
}
void initializeDebouncerTimer()
{
//Note: doesn't start timer
TCCR0A = 0x00;
TCCR0B = 0x00;
TCNT0 = DBNC_TIMR0_BASEVAL;
TIMSK0 = _BV(TOIE0);
}
test.c:
#include <avr/io.h>
#include <util/delay.h>
#include "debounce.h"
volatile uint8_t lastState;
void ButtonClicker(uint8_t index,uint8_t state);
/*
Pin-change interrupt 0
Detects pin changes on PCINT0-7 (all masked on), i.e. PB0-7 on Atmega2560
It compares these values to the last known state and signals a change
on any pins that have changed state.
*/
ISR(PCINT0_vect)
{
uint8_t temp = lastState^PINB;
lastState = PINB;
if ((temp & _BV(0)))
signalChangedState(0,2);
if ((temp & _BV(1)))
signalChangedState(1,3);
if ((temp & _BV(2)))
signalChangedState(2,4);
if ((temp & _BV(3)))
signalChangedState(3,5);
if ((temp & _BV(4)))
signalChangedState(4,20);
if ((temp & _BV(5)))
signalChangedState(5,50);
if ((temp & _BV(6)))
signalChangedState(6,200);
if ((temp & _BV(7)))
signalChangedState(7,200);
}
int main(void)
{
//Initialize PORTB as all inputs, no internal pull-ups
DDRB = 0x00;
PORTB = 0x00;
//Initialize PORTD as all outputs, all HIGH (LEDs off)
DDRD = 0xFF;
PORTD = 0xFF;
//Initial timer setup (does not start timer)
initializeDebouncerTimer();
lastState = PINB;
//Fills in details regarding
registerDebouncer(&PINB,PB0,0,1,&ButtonClicker);
registerDebouncer(&PINB,PB1,1,1,&ButtonClicker);
registerDebouncer(&PINB,PB2,2,1,&ButtonClicker);
registerDebouncer(&PINB,PB3,3,1,&ButtonClicker);
registerDebouncer(&PINB,PB4,4,0,&ButtonClicker);
registerDebouncer(&PINB,PB5,5,0,&ButtonClicker);
registerDebouncer(&PINB,PB6,6,0,&ButtonClicker);
registerDebouncer(&PINB,PB7,7,0,&ButtonClicker);
//Enable pin-change interrupt & mask
PCICR = _BV(PCIE0);
PCMSK0 = 0xFF;
//Enable interrupts
sei();
while(1)
{
//This will loop through any signaled debouncer items and
//call their handlers (doesn't apply to asynchronous)
callSignaledHandlers();
_delay_ms(5);
}
return 0;
}
void ButtonClicker(uint8_t index,uint8_t state)
{
if (state == 0)
{
PORTD ^= _BV(index);
}
}
William Dillon’s Debounce Code
Uses rising and falling edge detection in software to create a digital filter.
/* uint8_t doDebounce(uint8_t *state, volatile uint8_t *port, uint8_t pin)
*
* This function implements the logic for detecting button transitions for
* arbitrary ports and bits. The return value is the debounced value the the
* given pin.
*
* The implementation of this function is inspired by the digital filter
* presented in ECE573 at Oregon State University. It is different because
* I'm using the single 8-bit variable to store all of the state, rather than a
* 8 bit accumulator and 8 bit flag. We're using the range from 0x00 -> 0x7F
* and bit 7 (0x80) as the flag.
*
* The user of this function must provide a static state variable. This
* value encodes the state and history of the pin Failure to maintain the state
* would cause erratic behavior. The port can be any of the PINn
* memory-mapped input buffers. Pin must be between 0 and 7.
*
* Because these buttons pull to ground, we'll invert the meaning of the edges
* in software, 1 = yes is much more natural.
*/
uint8_t doDebounce(uint8_t *state, volatile uint8_t *port, uint8_t pin) {
uint8_t old = *state & 0x7F;
uint8_t flag = (*state & 0x80)? 1 : 0;
// Digital filter part, value = (old * .75) + (new * .25)
old -= (old >> 2); // 1 - (1/4) = .75
old += ((*port) & (1 << pin))? 0x1F : 0x00; // if bit set, add .25
// Software schmitt trigger
// Newly detected rising edge
if ( (flag == 1) && (old > 0x70) ) {
flag = 0;
}
// Newly detected falling edge
else if ( (flag == 0) && (old < 0x07) ){
flag = 1;
}
// Update the state variable
*state = (old & 0x7F) | ((flag & 0x01) << 7);
// Return only the pin state
return flag;
}
Mike Szczys’ Debounce Code
I fell in love with the Danni Debounce code early on. Here’s my retouched version of it.
/*--------------------------------------------------------------------------
10/13/2010: Button debounce code by Mike Szczys
based on "danni debounce" code by Peter Dannegger:
http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&p=189356#189356
This code detects and debounces button presses. It is tailored for use with
AVR microcontrollers but I've adapted it for other architectures easily and
successfully. It can be modified to use all eight bits on the same port
for up to eight buttons.
The interrupt service routine (ISR) at the bottom uses binary counter
variables (ct0 and ct1) to check the buttons once every 10ms until 40ms has
passed. If the button registeres the first and last times it reads it as
a keypress. There is no functionality in this code for detecting a held
button.
--------------------------------------------------------------------------*/
// F_CPU used by debounce to calculate 10ms interrupts
#define F_CPU 1200000
#include <avr/io.h>
#include <avr/interrupt.h>
//define pins used by buttons
#define KEY_DDR DDRB
#define KEY_PORT PORTB
#define KEY_PIN PINB
#define KEY0 1 //Button on PB1
#define KEY1 2 //Button on PB2
//Debounce variables
unsigned char debounce_cnt = 0;
volatile unsigned char key_press;
unsigned char key_state;
/*--------------------------------------------------------------------------
Prototypes
--------------------------------------------------------------------------*/
unsigned char get_key_press( unsigned char key_mask );
void init_timers(void);
void init_io(void);
/*--------------------------------------------------------------------------
FUNC: 10/13/10 - Used to read debounced button presses
PARAMS: A keymask corresponding to the pin for the button you with to poll
RETURNS: A keymask where any high bits represent a button press
--------------------------------------------------------------------------*/
unsigned char get_key_press( unsigned char key_mask )
{
cli(); // read and clear atomic !
key_mask &= key_press; // read key(s)
key_press ^= key_mask; // clear key(s)
sei(); // enable interrupts
return key_mask;
}
/*--------------------------------------------------------------------------
FUNC: 10/13/10 - Sets and starts a system timer
PARAMS: NONE
RETURNS: NONE
--------------------------------------------------------------------------*/
void init_timers(void)
{
cli(); // read and clear atomic !
//Timer0 for buttons
TCCR0B |= 1<<CS02 | 1<<CS00; //Divide by 1024
TIMSK0 |= 1<<TOIE0; //enable timer overflow interrupt
sei(); // enable interrupts
}
/*--------------------------------------------------------------------------
FUNC: 10/13/10 - Initialize input and output registers
PARAMS: NONE
RETURNS: NONE
--------------------------------------------------------------------------*/
void init_io(void)
{
//Setup Buttons
KEY_DDR &= ~((1<<KEY0) | (1<<KEY1)); //Set pins as input
KEY_PORT |= (1<<KEY0) | (1<<KEY1); //enable pull-up resistors
}
/*--------------------------------------------------------------------------
FUNC: 10/13/10 - Main
--------------------------------------------------------------------------*/
int main(void)
{
init_timers(); //start the timer
init_io(); //setup the buttons
for (;;) //loop forever
{
if( get_key_press( 1<<KEY0 ))
{
//KEY0 press detected. Do something here
}
if (get_key_press( 1<<KEY1 ))
{
//KEY1 press detected. Do something here
}
}
}
//--------------------------------------------------------------------------
ISR(TIM0_OVF_vect) // interrupt every 10ms
{
static unsigned char ct0, ct1;
unsigned char i;
//TCNT0 is where TIMER0 starts counting. This calculates a value based on
//the system clock speed that will cause the timer to reach an overflow
//after exactly 10ms
TCNT0 = (unsigned char)(signed short)-(((F_CPU / 1024) * .01) + 0.5); // preload for 10ms interrupts
i = key_state ^ ~KEY_PIN; // key changed ?
ct0 = ~( ct0 & i ); // reset or count ct0
ct1 = ct0 ^ (ct1 & i); // reset or count ct1
i &= ct0 & ct1; // count until roll over ?
key_state ^= i; // then toggle debounced state
key_press |= key_state & i; // 0->1: key press detect
}
Links to other code
Some folks just sent us links to code. Here they are:
[Pieter Conradie’s]
matrix scanning code
.
[Hernandi F. Krammes’]
debounce code for PIC
.
[Dave] uses [Jack Ganssle’s] debounce code; Listing 2 of
this page
.
[Photo credit:
Jack Ganssle
] | 39 | 36 | [
{
"comment_id": "210124",
"author": "guess",
"timestamp": "2010-11-09T20:47:40",
"content": "Putting a tens of lines of code into a RSS header – splendid!",
"parent_id": null,
"depth": 1,
"replies": []
},
{
"comment_id": "210129",
"author": "Guy",
"timestamp": "2010-11-09... | 1,760,377,339.726769 | ||
https://hackaday.com/2010/11/09/android-on-iphone-new-treats/ | Android On IPhone: New Treats | James Munns | [
"Android Hacks",
"iphone hacks"
] | [
"2g",
"3g",
"android",
"apple",
"froyo",
"idroid",
"iphone",
"openiboot"
] | It seems that the iPhone 2g and 3g are the
newest phones
to get Android 2.2, codenamed Froyo. The process for installing Froyo if you have a
jailbroken
device seems to get even easier every time, with this revision being as simple as adding a repository, downloading Froyo, and pressing go. Follow the link for a wonderful step by step guide, complete with screenshots to take out all of the guess work. Android on iPhone sure has come a long way since
the first time
we covered it.
[via
reddit
] | 44 | 43 | [
{
"comment_id": "210081",
"author": "Mi6",
"timestamp": "2010-11-09T19:44:42",
"content": "Good news, but considering the price and ep!c ghayness related to the manufacturer one could just run down the street and get a brand new huge screen Dell Streak or HTC even?",
"parent_id": null,
"dept... | 1,760,377,339.851082 | ||
https://hackaday.com/2010/11/09/avr-controlled-rgb-led-matrix-plays-tetris/ | AVR Controlled RGB LED Matrix Plays Tetris | Mike Szczys | [
"LED Hacks",
"Microcontrollers"
] | [
"ATmega168",
"led",
"matrix",
"rgb",
"tetris"
] | [Stan] built this
LED matrix using a 16×16 grid
of RGB LEDs. He built the hardware and wrote some subroutines to randomize the colors. He’s not using PWM because frame buffering is not feasible for the 1k SRAM limit of the ATmega168 he used. Instead, shift registers drive the lights which can be mixed to achieve eight different colors (including off for black) reducing the framebuffer size to just 96 bytes. After he got done with the build he realized this is sized well for a game of Tetris. We’ve seen
AVR tetris
,
PIC Tetris
, and
Tetris using composite video
but it’s always a pleasure to see a new display build.
After the break we’ve embedded [Stan’s] demo video, several pictures, and a schematic. He’s using many of the same principles outlined in our
How to Design an LED matrix tutorial
.
[youtube=http://www.youtube.com/watch?v=ugub6d65b2A] | 9 | 9 | [
{
"comment_id": "210071",
"author": "Sprite_tm",
"timestamp": "2010-11-09T19:11:50",
"content": "Why would PWM not be feasible? I understand you don’t want to do 24bit color with it, but surely 8bit (3r 3g 2b) should be doable? It’d take 3/4 of the sram, but in the worst case you could put the game ... | 1,760,377,340.115805 | ||
https://hackaday.com/2010/11/09/home-automation-without-pulling-wires/ | Home Automation Without Pulling Wires | Mike Szczys | [
"home hacks"
] | [
"arduino",
"ATmega88",
"home automation",
"openwrt",
"remote control",
"RF",
"router",
"switched outlet"
] | Here’s a bit of simple home automation using hacks with which we’re become pretty familiar. [Mrx23] combined OpenWRT, a microcontroller, and a set of RF controlled outlet switches to
add automation to his plug-in devices
. An RF remote that controls the switched outlets has been connected to an Arduino. The router communicates with the Arduino via a serial connection. And the router is controlled by a web interface which means you can use a smartphone or other web device to control the outlets.
The best thing about this system is the power that the router wields. Since it has an underlying Linux kernel you have the option of setting CRON jobs to turn lighting on and off, and group settings can be established to set up a room’s lighting level for watching movies, hosting guests, etc. Combine this with the fact that OpenWRT can use port forwarding for Internet control and the possibilities really start to open up.
[Thanks Arpad] | 14 | 14 | [
{
"comment_id": "210030",
"author": "John",
"timestamp": "2010-11-09T18:15:35",
"content": "Nice hack but isn’t this a little round about way of setting up an x10 setup. I have 15 devices in my house and a modified wrt Linksys to connect to the usb x10 interface. The wrt already runs a webserver but... | 1,760,377,340.06846 | ||
https://hackaday.com/2010/11/09/machine-your-own-ring-light/ | Machine Your Own Ring Light | James Munns | [
"digital cameras hacks",
"LED Hacks"
] | [
"lathe",
"led",
"lexan",
"light",
"microscope",
"ring"
] | [Alan] acquired a stereo microscope from eBay, and decided to save some more money by designing, machining, and assembling his own
arc reactor
ring light
to go along. After finding an LED driver board sitting around as well as ordering some surface mount LEDs, he set about using a lathe to cut away a block of lexan, making sure to include slots for the lights as well as the microscope mount point. Follow the link to see the detailed build photos, as well as some comparison shots with and without the ring light.
A month or two earlier though, and [Alan] would have had a fantastic start to an Iron Man costume. | 18 | 18 | [
{
"comment_id": "209966",
"author": "dkavanagh",
"timestamp": "2010-11-09T15:37:37",
"content": "Are you sure he isn’t building an ironman suit?",
"parent_id": null,
"depth": 1,
"replies": []
},
{
"comment_id": "209967",
"author": "Colecago",
"timestamp": "2010-11-09T15:3... | 1,760,377,340.227617 | ||
https://hackaday.com/2010/11/08/swapping-speedometer-needle-for-leds/ | Swapping Speedometer Needle For LEDs | Mike Szczys | [
"Transportation Hacks"
] | [
"car",
"display",
"driver",
"led",
"lm3914",
"speedometer"
] | [Ah2002] didn’t like the shaky needle in his car’s speedometer so
he replaced it with a ring of LEDs
. The old speedometer had a cable which rotated along with the gearbox for mechanical speed measurement. By connecting the stepper motor from a printer instead of this cable, a voltage is generated that fluctuates with the speed of the car. The fluctuation is linear so a given voltage measurement can be directly associated with one particular speed. By using a trimpot to calibrate the input voltage, [Ah2002] connected the signal to an LM3914 dot/bar display driver. These can be chained together, lighting a string of outputs based on the single voltage input. The result is the board seen above, which was covered with a printed paper graph in the final assembly.
Judging from the video after the break, we’d bet there was some distracted driving during the calibration process. The driver appears to be holding the video recorder, and since a cellphone GPS was used during calibration we wonder if [Ah2002] was adjusting the trimpot, looking at the GPS, and driving all at once. It’s a fairly awesome hack, but do be careful when you’re working on something like this.
[youtube=http://www.youtube.com/watch?v=wAUQjoejmOM] | 44 | 43 | [
{
"comment_id": "209602",
"author": "Darkrocker",
"timestamp": "2010-11-09T00:15:25",
"content": "Definitely like it, although I think I;’d go with red. Looks better (imo) and better for your night vision. When you want to give your car a more custom look doing a mod like this is a great alternative... | 1,760,377,340.345457 | ||
https://hackaday.com/2010/11/08/build-a-confetti-cannon-for-your-next-party/ | Build A Confetti Cannon For Your Next Party | Mike Szczys | [
"Misc Hacks"
] | [
"cannon",
"confetti",
"fire extinguisher",
"pneumatic",
"solenoid",
"valve"
] | [Scott]
built a confetti canon
to spice up the party. It’s pneumatic and re-purposes a fire extinguisher as the air tank. He had a refillable extinguisher that used water instead of chemical retardant. After emptying the water and ensuring all of the pressure had been release he swapped the hose and nozzle for a sprinkler solenoid valve. Securing the extinguisher’s actuator lever with a pipe clamp holds the internal valve open, leaving the solenoid to control the pressure release. This way the canon can be fired electronically, or manually.
This type of solenoid valve is
a popular choice with pneumatic canons
. We suppose you could even adapt this for use as a
T-shirt cannon
.
[Thanks BoBeR182] | 11 | 11 | [
{
"comment_id": "209595",
"author": "Peter",
"timestamp": "2010-11-08T23:38:25",
"content": "I wouldnt have thought this kind of solenoid valve would be the best pick given the reaction time delay between trigger and the valve fully opening. This valve works by triggering on a pressure differencial ... | 1,760,377,340.804044 | ||
https://hackaday.com/2010/11/08/czech-discovery-ressurects-ps2-keyboard/ | Czech Discovery Ressurects PS/2 Keyboard | Joseph Thibodeau | [
"Microcontrollers",
"Peripherals Hacks"
] | [
"contest",
"discovery",
"keyboard",
"ps2",
"stm32"
] | Like us, you probably have piles of old PS/2 keyboards occupying strategic positions in your house and causing all sorts of trouble with the neighbours. As luck would have it, there is a way to put those lazy peripherals to work!
Our friends in the Czech Republic have successfully interfaced a
PS/2 keyboard to an STM32 Discovery board
(
translated
), and not a moment too soon—just in time for you to integrate their work into your entries for those juicy contests we told you about (the
European one
and the
North American one
).
The project page contains an in-depth walkthrough of how the PS/2 connection talks to the keyboard hardware along with source code and links, more than enough information to get started with a PS/2 keyboard hack on your Discovery application. And why stop at keyboards? Give your old PS/2 mouse a new lease on life, or even hook up your
custom game controller
to spice up the experience. | 17 | 17 | [
{
"comment_id": "209570",
"author": "Merried Seinor Comic",
"timestamp": "2010-11-08T22:39:10",
"content": "Fiends? It’s not like they can help they’re from the Czech Republic.",
"parent_id": null,
"depth": 1,
"replies": []
},
{
"comment_id": "209573",
"author": "guest",
... | 1,760,377,340.700026 | ||
https://hackaday.com/2010/11/07/water-use-feedback-changes-behavior/ | Water Use Feedback Changes Behavior | Mike Szczys | [
"green hacks",
"home hacks"
] | [
"arduino",
"koolance",
"meter",
"usage",
"water",
"wifi"
] | How much water do you use when showering, or washing your hands, or washing the dishes? Not how much does the average person use, but how much to
you
use? That’s what the team over at Teague Labs set out to find with this
water usage feedback system
. The sensor used is a Koolance flow meter which is intended to measure coolant flow in PC liquid cooling systems. At $20, it makes a nice low-cost sensor which was paired with a WiFi enabled Arduino. In the image above they’re using an iPad as a screen so that you can see how much water you’re using (or wasting) as you wash your hands. This resulted in saving 1/2 gallon of water every time someone washed their hands.
The project code, schematic, and board files are all available for download. Along with the hardware build there’s some nice server-side software that gathers and graphs the data over time. We’ve seen a lot of
power-meter hacks
, but it’s nice to have the option to track water usage, even if this is tailored to just one tap at a time. | 26 | 26 | [
{
"comment_id": "209094",
"author": "theodore",
"timestamp": "2010-11-07T20:20:13",
"content": "why can’t you plumb it to the main line coming off the pump? Then you would have the total water usage for the house. it would take me less than 20 min’s to install. not very hard to do at all.",
"par... | 1,760,377,340.980852 | ||
https://hackaday.com/2010/11/07/exploit-bait-and-switch/ | Exploit Bait And Switch | James Munns | [
"Security Hacks"
] | [
"EFTPS",
"hack",
"malware",
"virus",
"Zeus"
] | When a new virus or other piece of malware is identified, security researchers attempt to get a hold of the infection toolkit used by malicious users, and then apply this infection into a specially controlled environment in order to study how the virus spreads and communicates. Normally, these toolkits also include some sort of management console commonly used to evaluate successfulness of infection and other factors of the malware application. In the case of the
EFTPS Malware
campaign however, the admin console had a special trick.
This console was actually a fake, accepting a number of generic passwords and user accounts, and provide fake statistics to whoever looked in to it. All the while, the console would “call home” with as much data about the researcher as possible. By tricking the researchers in this way, the crooks would be able to stay one step ahead of anti-virus tools that would limit the effectiveness of any exploit. Thankfully though, the researchers managed to come out on top this time.
[via
boingboing
] | 31 | 31 | [
{
"comment_id": "209056",
"author": "pwnr",
"timestamp": "2010-11-07T19:17:27",
"content": "Though evil virus writers suck, I vote they put more emphasis and focus on OSX for a couple years ;-)",
"parent_id": null,
"depth": 1,
"replies": []
},
{
"comment_id": "209065",
"autho... | 1,760,377,340.874839 | ||
https://hackaday.com/2010/11/07/your-mobile-phone-now-with-100-more-rfid/ | Your Mobile Phone, Now With 100% More RFID | James Munns | [
"Wireless Hacks"
] | [
"pass",
"phone",
"rfid",
"subway",
"tag"
] | More and more today, it is becoming harder to avoid having some sort of RFID tag in your wallet. [bunnie], of
bunnie:studios
decided to ease the clutter (and wireless interference) in his wallet by transplanting the RFID chip from one of his subway cards into his mobile phone. Rather than the tedious and possibly impossible task of yanking out the whole antenna, he instead pulled the antenna of a much more accessible wristband with an RFID chip of similar frequency instead. Nothing too technical in this hack, just a great idea and some steady handiwork. We recommend you try this out on a card you haven’t filled yet, just in case. | 15 | 14 | [
{
"comment_id": "208973",
"author": "Squirrel",
"timestamp": "2010-11-07T17:07:26",
"content": "Awesome!!Now madison just needs to build a subway system so that I can do this",
"parent_id": null,
"depth": 1,
"replies": []
},
{
"comment_id": "209016",
"author": "Gdogg",
"t... | 1,760,377,340.754436 | ||
https://hackaday.com/2010/11/07/the-transistor-takes-on-the-machine/ | The Transistor Takes On The Machine | Jakob Griffith | [
"Arduino Hacks"
] | [
"Arduion",
"competition",
"hackerspace",
"imac g3",
"laser",
"racecar",
"scion",
"take on the machine",
"xbee",
"zombie"
] | It only took 4 hackerspaces, but we finally get to see a zombie movie inspired project; hackerspace
The Transistor Takes on the Machine
with a Dawn/Shawn of the Dead movie theme. Race cars disguised as zombies swarm toward the players, who then use laser tag like guns to “shoot” down the approaching undead. The whole thing is a mess of Arduinos communicating with xBees to a central iMac G3, but it all comes together rather well and is promised to be released open source.
Now all that’s left is deciding which hackerspace
wins the competition
. Who do you have your money on?
[Thanks Deven] | 3 | 3 | [
{
"comment_id": "208949",
"author": "Pix3l the B1t",
"timestamp": "2010-11-07T14:48:29",
"content": "Cool! I assume that the zombies would have proximity sensing or something of the like so they wouldn’t collide. I think that these would be awesome if they had good swarm AI, i.e. flanking abilities ... | 1,760,377,340.918634 | ||
https://hackaday.com/2010/11/06/hacking-together-a-sous-vide-cooker/ | Hacking Together A Sous Vide Cooker | Caleb Kraft | [
"home hacks"
] | [
"cook",
"food"
] | Those amongst you that are cooks won’t need this explanation, for the rest of us, lets just get this out of the way.
Sous Vide
is when you cook things at a temperature lower than normal, for a period of time longer than normal to attain specific results in texture. A chef can tell you more intricate details about it, but what we care about is how to impress our friends with a cheap hack and a tasty meal.
This video shows how to hack your slow cooker
for precise temperature control. Well, it really shows how to splice a temperature controller into an extension cord, so we guess it could be used for a ton of things, non Sous Vide related.
[via
Lifehacker
] | 40 | 40 | [
{
"comment_id": "208584",
"author": "pwnr",
"timestamp": "2010-11-06T17:48:02",
"content": "Nice hack – prime rib is a good example of food cooked sous vide!",
"parent_id": null,
"depth": 1,
"replies": []
},
{
"comment_id": "208596",
"author": "nanomonkey",
"timestamp": "... | 1,760,377,341.098749 | ||
https://hackaday.com/2010/11/06/step-by-step-antique-radio-repair-and-upgrade/ | Step By Step Antique Radio Repair And Upgrade | Caleb Kraft | [
"home entertainment hacks",
"Repair Hacks"
] | [
"radio",
"retro",
"tube"
] | [M3talhead] takes us through a very informative repair of an
old tube radio
. In this case, his radio was from the late 30s. He was able to find the original data from
Radiomuseum.org
. He painstakingly dismantles the radio components and the cabinet. Instead of completely modernizing the internals, he replaces the bad parts and brings it back to functionality. He wanted to do an MP3 upgrade, but rather than wire directly into the radio, he built an AM transmitter for his mp3 player. | 20 | 20 | [
{
"comment_id": "208526",
"author": "wouter",
"timestamp": "2010-11-06T15:15:12",
"content": "I’m going to mod my brAun 199 (1975) so it will be sort of like a squeezebox.. but the restoration is taking far more time than I thought..",
"parent_id": null,
"depth": 1,
"replies": []
},
... | 1,760,377,341.23662 | ||
https://hackaday.com/2010/11/06/some-weekend-robot-goodness/ | Some Weekend Robot Goodness In Link Form | Caleb Kraft | [
"Hackaday links"
] | [
"books",
"robots"
] | PBS Newshour
did a piece on robots
. They talked about NASA’s bot pictured above, Asimo, Big Dog, PR2, Robbie the robot and a few others. We didn’t see anything new, but we really do like the coverage getting out there. We also never need an excuse to watch that guy kick big dog around for a while. We know it’ll only be a matter of time before the tables are turned.
Willow Garage, the folks behind PR2, are
conducting a survey
to see what your favorite robot is. Their list is pretty short, but they did leave a spot for you to add a name. The picture above, is not from willow garage though. This is the picture I got from
BotJunkie
(we love this site) where I found this story. They didn’t attribute the artist, but I feel they need credit, it is an awesome shirt.
It turns out that it is a t-shirt design available at the
chopshopstore
. You can see that their eyes are done in glow-in-the-dark material. On a side note, the
hackaday store
just got glow in the dark material yesterday(as well as a re-design) and will be announcing several new designs in the near future.
I personally inherited several huge boxes full of sci-fi pulp. The robots I’ve seen in these are amazing, ranging from amazingly ridiculous to amazingly awesome. I’ve only just begun scanning in the covers, and plan to
post at least one a day
. You know what would be awesome though? If I had
one of these
. | 7 | 7 | [
{
"comment_id": "208515",
"author": "daniel_reetz",
"timestamp": "2010-11-06T14:19:46",
"content": "Oh man, yeah, you really DO need a DIY Book Scanner. Those instructions are pretty outdated… be sure to check out some of the one-camera designs or our “new standard scanner” on the forums. A lot has ... | 1,760,377,341.025757 | ||
https://hackaday.com/2010/11/08/the-v4z80p-the-8-bit-laptop/ | V4Z80P: The 8-bit Laptop | James Munns | [
"laptops hacks"
] | [
"cpld",
"fpga",
"laptop",
"Spartan",
"xilinx",
"z80",
"zilog"
] | [Phil] over at Retroleum has cobbled together a clean, well put together
laptop
based entirely around a
Zilog Z80
microprocessor and a pair of Spartan II FPGAs. These FPGAs allow him to reduce the number of devices on his board, and therefore cut his production cost as well as device size. He even managed to integrate a salvaged PSOne screen. The laptop comes complete with [Phil]’s own Homebrew OS as well as a great graphical vector based demo.
Sure he’s updated the project in recent years to shrink the board, speeding up the Z80, and increasing the peripheral speed and functionality, but we’re suckers here for a
total package
hack. Seriously though, check out the
newest version
of the device as well as the backlog that shows the project growing over time.
Thanks to [Steth] for the heads up. | 14 | 14 | [
{
"comment_id": "209543",
"author": "javajunkie",
"timestamp": "2010-11-08T21:24:53",
"content": "Reminds me of my first laptop.",
"parent_id": null,
"depth": 1,
"replies": []
},
{
"comment_id": "209546",
"author": "Richard",
"timestamp": "2010-11-08T21:27:18",
"conte... | 1,760,377,341.290972 | ||
https://hackaday.com/2010/11/08/swiveling-arms-replace-laptop-lcd-hinges/ | Swiveling Arms Replace Laptop LCD Hinges | Mike Szczys | [
"computer hacks"
] | [
"ben heck",
"laptop",
"lcd",
"notebook",
"screen",
"swivel"
] | This swivel arm LCD screen
is [Ben Heck’s] latest hack. It replaces the hinges that normally only allow one point of rotation on the screen. You can still use the laptop like normal, but when space is at a premium a second adjustment, both in rotation and linear position, has been added using the slots and screw knobs seen above. Ostensibly this is to use on an airplane, where there may not be enough space to fully open your laptop. We’ll let you decide if it’s wise to try to get your own hacks past airport security. Historically, the
TSA hasn’t been impressed with hardware hackers
. We like how this came out and could see ourselves using these techniques to make a convertible tablet notebook by reworking the cable routing.
We’ve embedded [Ben’s] quick demo of the finished product after the break. If you want to see the whole build process it is the subject of
Episode 5 of the Ben Heck Show
.
[youtube=http://www.youtube.com/watch?v=4Iz-81VIsyg]
[Thanks Geoffrey via
Engadget
] | 24 | 24 | [
{
"comment_id": "209523",
"author": "24601",
"timestamp": "2010-11-08T20:33:26",
"content": "Is this video another one of those where he starts one project, then in the middle switches to a different project for most of the video, before finally finishing the first project? If so, PASS.",
"pare... | 1,760,377,341.351527 | ||
https://hackaday.com/2010/11/08/cnc-machine-from-pc-parts/ | CNC Machine From PC Parts | Mike Szczys | [
"cnc hacks"
] | [
"floppy drive",
"mill",
"optical drive",
"parts",
"pc",
"pcb",
"plotter",
"stepper"
] | [Mike Rankin] built
a small CNC machine using some PC parts
. He repurposed two optical drives and a floppy drive to create the plotter seen drawing the Hackaday logo above. The X and Y axes use the stepper motor controlled read heads from two optical drives. The Z axis is built using the read head hardware from a floppy drive. A 3-axis controller module from eBay drives the little machine, keeping the cost quite low at around $45.
As you can see in the video after the break it does a great job as a plotter. [Mike] doesn’t think there’s enough power in the hardware to be used as a mill. We’d still like to try adding a flexible shaft rotary tool and see if this could mill some rudimentary PCBs, but maybe you need to
shell out just a little bit more for that functionality
. It might also be possible to use an etchant resist marker instead of toner transfer or photo-resist.
[youtube=http://www.youtube.com/watch?v=8U-TBf-mzkU] | 28 | 28 | [
{
"comment_id": "209501",
"author": "Necromant",
"timestamp": "2010-11-08T19:19:45",
"content": "Awesome… Looks like my next weekend project.",
"parent_id": null,
"depth": 1,
"replies": []
},
{
"comment_id": "209502",
"author": "Necromant",
"timestamp": "2010-11-08T19:22:... | 1,760,377,341.511988 | ||
https://hackaday.com/2010/11/08/win-big-american-design-style/ | Win Big: American Design Style | James Munns | [
"contests"
] | [
"contest",
"design",
"stm",
"STMicroelectronics"
] | Last week we announced a Germany based design contest only accepting applicants from Europe, the Middle East, and Asia. Unfortunately, this left out one of the larger segments of our readers. After doing some scrounging around (and a helpful tip from [Flash Gordon]), we managed to find a similar contest
run by STMicroelectronics
, the makers of the Discovery board. This contest sounds familiar, with free Discovery Board for all approved applicants, and
prizes
for the most interesting and creative projects.
Right now the official rules page seems to be missing, so you technically legally should probably wait to enter, but we can’t stop you.
It looks like the official rules page is
located here
. Thanks to [Andee] for pointing that out. Also, it looks like if you live in Puerto Rico or Quebec, you are also out of this contest as well.
If you are from the EMEA area and missed the
last contest
, be sure to go back and check it out for your chance to win! Also, we love covering contests (especially ones that give out free kits to all contestants), are there any readers out there that know of a developer other than STM that is offering this kind of deal? We would love to
hear from you
! | 20 | 20 | [
{
"comment_id": "209466",
"author": "Andee",
"timestamp": "2010-11-08T17:30:12",
"content": "Rules:http://stm32challenge.net/official-rules",
"parent_id": null,
"depth": 1,
"replies": []
},
{
"comment_id": "209486",
"author": "TheBadWolf",
"timestamp": "2010-11-08T18:30:0... | 1,760,377,341.446532 | ||
https://hackaday.com/2010/11/08/make-a-knitting-machine-print-pixel-art/ | Make A Knitting Machine Print Pixel Art | Mike Szczys | [
"home hacks"
] | [
"art",
"floppy",
"ftdi",
"knitting machine",
"pixel",
"tandy"
] | [Becky Stern] shows how to take an old
electronic knitting machine and interface it with a computer
. After seeing the Brother KH-930E knitting machine in the video after the break it looks like the controls function quite like a CNC milling machine. Patterns can be programmed in and stored on a floppy disk. Since we don’t want to use those anymore (unless they’re
hacked as an SD card carriage
) it is nice to see that this is how the machine is connected to a computer. Using an altered FTDI cable and a floppy-drive emulator written in Python a blank design file can be saved on the knitting machine, manipulated in the computer to add your own pixel art, then loaded back onto the machine for production. At the very least, it’s interesting to watch the knitting happen, but fans of knitted apparel and geek paraphernalia must be salivating by now.
We’ve never given up our dream to
transition from Hack-A-Day to Craft-A-Day
, this just fuels the fire for that cause.
[youtube=http://www.youtube.com/watch?v=GhnTSWMMtdU] | 16 | 16 | [
{
"comment_id": "209477",
"author": "redbeard",
"timestamp": "2010-11-08T18:15:57",
"content": "Also, for the crib notes, check out Limor & I’s github accounts where we put together some of the code for this:https://github.com/brianredbeard/knitting_machinehttps://github.com/adafruit/knitting_machin... | 1,760,377,341.560162 | ||
https://hackaday.com/2010/11/07/project-enclosures-the-right-way/ | Project Enclosures The Right Way | Mike Szczys | [
"cnc hacks"
] | [
"box",
"case",
"enclosure",
"mill",
"project",
"sparkfun"
] | [Stephen Eaton] created an enclosure and shared his process in
a pair
of
blog post
. We thought is was amusing that he remarks on how rarely his projects get the to point that you’d want to make an enclosure for them. We’ve certainly got a lot of bare-PCB creations lying around. But when it does come time, we think his fabrication method is a good way to go.
First of all, he didn’t start from scratch. He already had a SparkFun project case sitting around. The problem is figuring how to make it work for your situation. We’ve used a drill, a Dremel, and a file in the past and that yields passable results but nothing that would be mistaken for anything other than a carefully mangled project box. [Stephen] decided to mill the openings he needed from the box, which yielded professional looking results. He started by emailing SparkFun and asking if they could give him a 3D model of the project box and the obliged. He then modeled the LCD screen, LED light pipes, button, USB port, and SD socket. From there it was off to the mill with a custom jig and a few tricks we think you’ll appreciate. The end result is just another reason to build the CNC mill you’ve had on your mind for so long. | 11 | 11 | [
{
"comment_id": "209159",
"author": "Avaviel",
"timestamp": "2010-11-07T22:53:40",
"content": "[corrections]Change“project box and the obliged.”add [y] to end of [the].“project box and the obliged.”(For some reason, it cleared the text of my previous post. Whoops.)",
"parent_id": null,
"dept... | 1,760,377,341.655616 | ||
https://hackaday.com/2010/11/07/im-me-plays-music-in-preparation-for-gaming/ | IM-ME Plays Music In Preparation For Gaming | Mike Szczys | [
"Microcontrollers"
] | [
"frequency",
"game",
"im-me",
"music",
"piezo",
"tetris"
] | [Emmanuel Roussel] is coding a version of
Tetris for the IM-ME
. Before you get too excited, he hasn’t actually written the game yet, but instead started with the familiar theme music. The IM-ME has a piezo speak on board so it’s just a question of frequency and duration. [Emmanuel] developed an Open Office spread sheet that calculates each note’s frequency and the timer value needed to produce it. He then created a data type that stores a note and its duration and used an array of those structures to store the song. If you’ve ever wondered how to cleanly code music this is a wonderful example to learn from because right now the code doesn’t have anything other than that code to get in the way.
The ground work for this
was established in the other hacks we’ve seen. Now we’re left wondering who will finish coding their game first. Will it be [Emmanuel’s] Tetris or
[Travis’] Zombie Gotcha
? | 6 | 6 | [
{
"comment_id": "209127",
"author": "Mr_Bishop",
"timestamp": "2010-11-07T21:36:12",
"content": "ok this is slightly off topic, but I saw a post having to due with using one of these to monitor a spectrum, my question, is there any way to record(packet sniff?) analog and digital waves on the 2.4GHz ... | 1,760,377,341.609555 | ||
https://hackaday.com/2010/11/04/kilobuck-open-kinect-project-prize/ | Kilobuck Open Kinect Project Prize | Devlin Thyne | [
"contests",
"News",
"Xbox Hacks"
] | [
"adafruit",
"Kinect",
"Open Kinect",
"open source",
"prize",
"xbox"
] | Full of video and audio sensors, the newly released
Kinect
is Microsoft’s answer to Nintendo’s Wii MotionPlus and Sony’s PlayStation Move. Now there is money up for grabs to hack it. Adafruit is offering up a
one thousand dollar prize
to open source the driver for the Kinect. What do they want this driver to do? They want RGB and distance values. We’re excited to see the hacks that will come around because of this product, and now that prize money is involved, everything has been turned up a notch.
Update:
The bounty has been raised to $2000 after a Microsoft response to
CNET
:
But Microsoft isn’t taking kindly to the bounty offer. “Microsoft does not condone the modification of its products,” a company spokesperson told CNET. “With Kinect, Microsoft built in numerous hardware and software safeguards designed to reduce the chances of product tampering. Microsoft will continue to make advances in these types of safeguards and work closely with law enforcement and product safety groups to keep Kinect tamper-resistant.”
Update:
Progress toward a driver
Update:
Winner of the Open Source Kinect contest | 83 | 50 | [
{
"comment_id": "207795",
"author": "biozz",
"timestamp": "2010-11-04T22:18:21",
"content": "i got to play with one and its not all its hyped up to bei prefer the playstation move XD",
"parent_id": null,
"depth": 1,
"replies": []
},
{
"comment_id": "207799",
"author": "Patric... | 1,760,377,341.983554 | ||
https://hackaday.com/2010/11/04/apple-studio-display-connector-ports/ | Apple Studio Display Connector Ports | Mike Szczys | [
"Mac Hacks"
] | [
"apple",
"dvi",
"lcd",
"monitor",
"power",
"studio display",
"usb"
] | [Warrior_Rocker] pulled off his own
Apple Studio Display hack by removing the cable and adding ports
. As we saw in
Wednesday’s post
, these displays use a cable with a proprietary connector that combines DVI, USB and Power. Instead of altering the cable, [Warrior_Rocker] removed it completely. By wiring up a standard barrel jack for power, a USB type-B socket, and a DVI port, he can now use standard video, power, and USB cables to connect to the monitor.
This project was actually submitted to us on May 25th and we missed it. It’s sad that sometimes tips fall through the cracks, and we’re sorry that we missed this particularly well-executed hack. [Warrior_Rocker] wrote in asking why his project didn’t qualify after seeing the similar post on Wednesday. So please don’t take it personally if your project doesn’t get posted. If you think it fits right in here at Hackaday and haven’t heard anything after two weeks or so, consider
sending to us
again. | 10 | 10 | [
{
"comment_id": "207762",
"author": "Me",
"timestamp": "2010-11-04T21:17:28",
"content": "That is very well done, kudos to you for it.But it also shows how proprietary Apple is, and which lengths users will have to go to in order to enjoy a simple bit of standard connectivity.I don’t mean to bash Ap... | 1,760,377,341.89473 | ||
https://hackaday.com/2010/11/04/mac-se-reborn-as-a-server-and-mac-emulator/ | Mac SE Reborn As A Server And Mac Emulator | Mike Szczys | [
"Mac Hacks"
] | [
"arm",
"AVR",
"dockstar",
"emulator",
"floppy",
"seagate",
"usb"
] | [Sprite_TM] cooked up an amazing hack by
resurrecting a Mac SE using a Dockstar and ARM processor
. The retro hardware had a bad mainboard thanks to the corrosive properties of a failed backup-battery. He had been wanting to do something with
the Seagate Dockstar
and decided it would find a nice home in the Mac. But what fun is a dead machine housing a headless server? To add to the fun he included an ARM processor running a Mac emulator, along with all the bits to make the screen, keyboard, and peripherals work. When the Mac is off the Dockstar still runs as a server.
But one of the best parts is the floppy drive. It still takes floppies, but there’s no magnetic media inside of them anymore. Instead, he’s added an SD card slot and some protoboard in the space for the read head. The drive itself has had the read head transplanted for some pogo pins (hey,
we saw those earlier today
). When you insert the floppy, the pogo-pins raise up and contact the protoboard, connecting the SD card to a Teensy microcontroller.
There’s so much going on with this project we just can’t cover it all here. Things like a chemical cleaning to return the original color of the classic case, and building a converter so that the peripherals are USB compatible are just some of the pleasures awaiting you in [Sprite_TM’s] post. He’s also filmed a demo video that we’ve embedded after the break.
[youtube=http://www.youtube.com/watch?v=nvWY7wD8XEg] | 27 | 27 | [
{
"comment_id": "207751",
"author": "wouter",
"timestamp": "2010-11-04T20:25:06",
"content": "now that kicks ass big time xDit’s cool he’s reusing it as a computer to, but I doubt he’s going to use the emulator for anything else then getting the dockstar back online..BTW: is the emulator running fro... | 1,760,377,342.091149 | ||
https://hackaday.com/2010/11/04/snes-controller-dock-for-dell-streak/ | SNES Controller Dock For Dell Streak | Mike Szczys | [
"Android Hacks"
] | [
"cable",
"controller",
"dell",
"emulator",
"pdmi",
"snes",
"streak",
"sync"
] | The Dell Streak is an Android tablet. [Collin Meyer] wanted to use an original SNES controller to play emulated games on the device. What he came up with is
a controller that is a dock for he handheld
.
Several things have to come together to make this happen. The Streak uses a standard PDMI dock that connects to a computer via a USB connection. [Collin] repurposed a sync cable by connecting a couple of pins on the dock connector which forces the device to use USB host mode. From there he used a Teensy microcontroller to convert the SNES controller into a USB device (very similar to
this hack
). The Teensy and shortened sync cable find a new home inside the SNES controller body and, in the video after the break, it looks like he used
something like sugru
to add a bit of support for the Streak.
[youtube=http://www.youtube.com/watch?v=FbFpMTAxuMs] | 9 | 9 | [
{
"comment_id": "207734",
"author": "Nair",
"timestamp": "2010-11-04T19:39:04",
"content": "Why not for N900, I just installed mario with emu on it. It’s a pain in the ass playing it with the normal cursor.",
"parent_id": null,
"depth": 1,
"replies": []
},
{
"comment_id": "207737... | 1,760,377,342.031001 | ||
https://hackaday.com/2010/11/04/quick-and-easy-street-view-treadmill/ | Quick And Easy Street View Treadmill | Mike Szczys | [
"home hacks"
] | [
"google",
"stealth switch",
"street view",
"treadmill"
] | This is [Thomas Clauser’s]
Google Street View enabled treadmill
. He points out that most of the
Street View hacks
use a measurement of rotational movement to interface with a computer. He respects that but didn’t want to take the time to make it work with his treadmill. Instead, he used a stealth switch propped up on a book below the treadmill frame, but any switch can be used as long as you know how to connect it to the computer. When you stand on the treadmill the frame flexes and almost clicks the button, but when you start running it moves the rest of the ways and closes the switch. From there an
autohotkey
script is used to advance Street View. | 11 | 11 | [
{
"comment_id": "207698",
"author": "Bill",
"timestamp": "2010-11-04T17:38:36",
"content": "Wouldn’t a piece of tape of the tread and a reflective light sensor be even ‘easier’ then lifting a treadmill and trying to get the switch positioned just right? Would also work at lower speeds as well, and a... | 1,760,377,342.213735 | ||
https://hackaday.com/2010/11/04/win-a-harley-in-this-design-contest/ | Win A Harley In This Design Contest | James Munns | [
"contests"
] | [
"contest",
"discovery",
"EBV",
"Elektronik",
"HarleyHarley",
"stm32"
] | EBVElectronik of Germany is hosting a
design contest
based around the STM32F microcontroller. They are inviting engineers and inventors to come up with the best general purpose design ideas, with prizes including a Harley Davidson Motorcycle and a 1000 euro Apple voucher. Even better, they are offering a free
STM32 Discovery Kit
to anyone who enters, just to get them started. Sound too good to be true? Well, there is one catch. As of right now, entrants are limited to:
Any individual or group of individuals, age 18 and over as of the date of entry and located in EMEA (Europe and Middle East and Africa)
Sorry USA. We have to save some love for the international crowd. Do us a favor and
let us know
what you are planning to build, or if you win any of the prizes! | 38 | 38 | [
{
"comment_id": "207669",
"author": "Troll_Dragon",
"timestamp": "2010-11-04T16:07:58",
"content": "The board is only $10 anyway…",
"parent_id": null,
"depth": 1,
"replies": []
},
{
"comment_id": "207673",
"author": "Julien",
"timestamp": "2010-11-04T16:23:18",
"conte... | 1,760,377,342.166295 | ||
https://hackaday.com/2010/11/04/diy-coffee/ | DIY Coffee Gripper | James Munns | [
"Robots Hacks"
] | [
"coffee",
"egg",
"grounds",
"hand",
"vacuum"
] | Here at Hackaday, we love it when people make home brew versions of elaborate, expensive, and technical equipment. By gathering up some coffee grounds, a balloon, some plastic tubing, and his lungs, [Carlos] has provided a
good how-to
on making your own coffee grounds robotic hand. Inspired by the U. Chicago, Cornell, and iRobot Collaboration we
previously covered
, he is one robot and a vacuum pump away from having their setup. Check out his blog for a list of components as well as a couple hints to help the build go smoothly. Be sure to check out the video after the break.
[via
Make
]
[youtube=http://www.youtube.com/watch?v=q-gHLYIWrrs] | 20 | 20 | [
{
"comment_id": "207651",
"author": "wouter",
"timestamp": "2010-11-04T15:05:48",
"content": "CHECK xDWant want want!btw: who’s making the robot?",
"parent_id": null,
"depth": 1,
"replies": []
},
{
"comment_id": "207660",
"author": "Nathan Zadoks",
"timestamp": "2010-11-0... | 1,760,377,342.351009 | ||
https://hackaday.com/2010/11/04/test-beds-and-jigs-with-pogo-pins/ | Test Beds And Jigs With Pogo Pins | Devlin Thyne | [
"Arduino Hacks",
"hardware",
"Microcontrollers",
"Tool Hacks"
] | [
"Pogo pin",
"production hacks",
"Test bed",
"Test jig"
] | Pogo pins – spring-loaded pin contacts are pretty fun to play with and even cooler when they get used in electronic devices like Adafruit and SparkFun’s test jigs. Check after the break for how these two companies have created their own production hacks.
At
Adafruit
, they build up from an Arduino with a proto shield. An unpopulated board is loaded with pogo test pins and then connected to the proto shield. The board rests on and is aligned with standoffs. The latest Adafruit test jig needs to have an extended test, so instead of mashing a finger against the test board for an extended period of time, they use “ears” to hold the board in place during testing.
At
SparkFun
, they used to do something similar to what Adafruit is doing now. Now with
BatchPCB
as the prototyping arm of the company, they make one-off boards for their test beds. For each test bed, three boards are made, all made based on the Eagle files of the board the bed will be testing. The bottom board keeps all of the test pads from the original board and enlarges the holes for the pogo pins, and then adds circuitry needed for the board test. The middle board has enlarged holes for the tips of the pogo pins to just barely stick through and is what the board under test rests on. The top board is just for alignment.
We could see these devices getting extended to having buttons that are pressed when a board is in place so the tests would begin automatically. Add a robotic arm, and the whole thing would be automated. Scale-up the jig for whole panels of boards. We would like to see more of the hacks people make just to make in production. | 21 | 19 | [
{
"comment_id": "207632",
"author": "Paul",
"timestamp": "2010-11-04T14:02:57",
"content": "I made similar automatic tests for Teensy, but using a piece of plastic and drill press instead of fabricating PCBs. It’s pretty easy to just print a copy of the original PCB on a laser printer, tape it to t... | 1,760,377,342.405445 | ||
https://hackaday.com/2010/11/03/rc-bristlebot-shifts-weight-for-steering/ | RC Bristlebot Shifts Weight For Steering | Mike Szczys | [
"Robots Hacks"
] | [
"bristlebot",
"rc",
"steering"
] | This large bristlebot
has no prolem steering itself by shifting its weight. It’s easy enough to watch the video after the break and see how this works. But there’s still the same air of “I can’t believe that actually works” which we experienced with
the original bristlebot
.
This is not the first
attempt to calm a bristlebots movements
, but we don’t remember seeing one you could drive around like an RC car. [Glajten] up-sized the bot with what appears to be a small shop broom cut in half, creating a
catamaran
design. The vibrating motor, which might have come out of a gaming controller, rides on the back of the bot, centered between the two bristle platforms. On the front a servo motor holds the shaft of a long bolt which has extra weight at the end of it. Steering happens when the weight is offset by a turn of the servo.
[youtube=http://
http://www.youtube.com/watch?v=TL_88papBLg%5D
[Thanks Bret via
SaskView
] | 39 | 38 | [
{
"comment_id": "207294",
"author": "Fetret",
"timestamp": "2010-11-03T20:20:36",
"content": "First sentence, “prolem”. Other than that cool bot, I love the homemade look (and the fact that it is home made)",
"parent_id": null,
"depth": 1,
"replies": []
},
{
"comment_id": "207296... | 1,760,377,342.545178 | ||
https://hackaday.com/2010/11/03/patching-into-android-music-control/ | Patching Into Android Music Control | Mike Szczys | [
"Android Hacks"
] | [
"android",
"control",
"music",
"nexus one",
"resistor",
"trrs"
] | Here’s a look at
the TRRS cable
that Android phones use. [Rich Kappmeier] want to control the music player on his Nexus One while driving. It’s not necessarily a safe endeavor if you’re staring at the screen and poking away with one hand while trying to stay in your lane. A little bit of research helped him figure out how the hardware in a headphone controller worked and he decided to incorporate that into a connector cable for the car.
The control signals rely on a specific resistance between the TRRS function ring and ground. Once he worked out the chart above and targeted the correct resistance values he built a rocker switch for Fast Forward and Reverse, as well as a Play/Pause button into the connector cable. You should be able to use this for more than just music control. Take a look at
our Android Development tutorial
and see what else you can come up with.
[Thanks Alastair] | 26 | 24 | [
{
"comment_id": "207258",
"author": "Josh",
"timestamp": "2010-11-03T18:08:49",
"content": "Awsome. I’ve been waiting for this!",
"parent_id": null,
"depth": 1,
"replies": []
},
{
"comment_id": "207263",
"author": "biozz",
"timestamp": "2010-11-03T18:17:48",
"content"... | 1,760,377,342.469854 | ||
https://hackaday.com/2010/11/03/rgb-stroboscopic-guitar-tuning/ | RGB Stroboscopic Guitar Tuning | Mike Szczys | [
"cons"
] | [
"badge",
"defcon",
"guitar",
"led",
"rgb",
"stroboscopic",
"tuner"
] | This is [Michael Ossmann’s]
RGB LED stroboscopic guitar tuner
. If his name is familiar that’s because
we mentioned
he’d be giving a talk with [Travis Goodspeed] at ToorCon. But he went to DefCon as well and spent the weekend in his hotel room trying to win the badge hacking contest.
Despite adversity he did get his tuner working. It’s built into a toy guitar that he takes on road trips with him. By adding a row of RGB LEDs between two of the frets he can use the vibration frequency of an in-tune string to flash the three different colors. If the string is not in tune the three colors will dance around but matching it with the LED frequency produces a stable color. He then uses that big yellow button to advance to the next string. See his demonstration after the break.
This is basically a built-in
plectrum tuner
that uses one LED package instead of two.
[youtube=http://www.youtube.com/watch?v=fNx3_yTPCks] | 15 | 15 | [
{
"comment_id": "207248",
"author": "Brennan",
"timestamp": "2010-11-03T17:32:31",
"content": "This is pretty sweet, they have existing stroboscopic tuners out there but they’re rather novel. There is one that is in keychain form and only flashes at the frequency of the low E string, which is awesom... | 1,760,377,342.598595 | ||
https://hackaday.com/2010/11/03/normal-connectors-for-apple-studio-display/ | Normal Connectors For Apple Studio Display | Mike Szczys | [
"Mac Hacks"
] | [
"apple display connector",
"dvi",
"lcd",
"monitor",
"studio display"
] | [Sherry Wu] sent in a link to her
Apple Studio Display hack
. She got her hands on the 17″ display which has a proprietary Apple Display Connector that rolls signals for DVI, USB, and 25V power into one plug. Convenient right? Not if you want to use it on a machine that has standard video connections. No problem, she got out her meter and figured out which wires belong to each signal. After some soldering she now has a DVI connector for the video, and a 24V bench supply is standing in for power until a dedicated unit arrives. No luck so far at getting the USB and hotplug detection to work but she plans to keep going until that’s accomplished.
Looks like
you can pick these displays up refurbished for as low as $75. Might not be a bad addition to your home setup if you’re willing to do some soldering. | 25 | 24 | [
{
"comment_id": "207213",
"author": "P",
"timestamp": "2010-11-03T16:09:20",
"content": "nice work with the hack, but she could have simply consulted the internet :)http://pinouts.ru/Video/apple_adc_pinout.shtml",
"parent_id": null,
"depth": 1,
"replies": []
},
{
"comment_id": "2... | 1,760,377,342.661099 | ||
https://hackaday.com/2010/11/03/how-to-program-pics-using-linux/ | How-to: Program PICs Using Linux | Devlin Thyne | [
"Linux Hacks",
"Microcontrollers"
] | [
"linux",
"Microchip PIC",
"pic",
"PIC12F675",
"PIC16F688",
"pic16f887",
"PICkit 2",
"PICStart+",
"SDCC"
] | Arguably, Microchip’s PIC microcontrollers do not get enough posts here. One of the drawbacks for some of us is that Linux support for PICs is not very well known. The information is out there, but no one has laid out the process of going from writing C code to programming a chip. Written for Linux users that are familiar with microcontrollers, basic circuits, the C programming language, and can read a datasheet, this how-to should get you up and programming a PIC quickly with Linux.
The Compiler:
The
Small Device C Compiler
, sdcc is what will be used to create the .hex file needed to program a PIC. Support for PICs is still growing, and still in beta, so be aware that things outside the code and chips of this article may need some debugging. However, like every other open source project out there, more contributing users will help the project. Best of all, it is free, with ports to Windows and MacOS X, this is a compiler that handles many architectures and devices without the program limit of free versions of for-pay compilers that are limited to Windows. Sdcc is available through various distributions’ package managers including Ubuntu and Fedora.
To install sdcc on Ubuntu:
sudo apt-get install sdcc
To install sdcc on Fedora:
sudo yum install sdcc
The Chips:
Three different PIC chips were used in the writing of this tutorial: the 40 pin
PIC16F887
, the 14 pin
PIC16F688
, and the 8 pin
PIC12F675
. You can follow along with any of these chips as well as other chips.
The Programmer:
We will be using two programmers, Olimex’s PICStart+ compatible
PIC-MCP-USB
programmer, and Microchip’s
PICkit 2
. Both programmers have been tested to work with the three chips used here.
The PICStart+ programmers use the picp program. Most any PICStart+ compatible programmer will work with picp. Easily installed in Ubuntu with:
<pre>sudo apt-get install picp
For Fedora and other distributions may have to download and install it from source. So, in an empty directory of your choosing:
wget http://home.pacbell.net/theposts/picmicro/picp-0.6.8.tar.gz
tar -xzf picp-0.6.8.tar.gz
cd picp-0.6.8
make
sudo make install
The source is on [Jeff Post]’s
Development Tools for PIC programmers
page along with other programming options.
If you will be using the PIC16F887 and picp, you will need to modify your /etc/picp/picdevrc file by adding the following lines:
[16F887]
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
PICSTART
[16F887:def]
20 00 3f ff 3f ff 00 7f
00 7f 3f ff 3f ff 00 ff
00 ff 00 00 00 00 00 00
0D 10 20 00 04 20 07 02
00 00 01 00 00 00 00 00
00 01 22 0f
[16F887:defx]
3f ff 07 00 00 00 00 00
00 00 00 00 00 00 00 00
3f ff 07 00 00 00 00 00
00 00 00 00 00 00 00 00
The above lines are modified parameters for PIC16F886 found in a
post
by [Al Williams]. For chips not already in /etc/picp/picdevrc, additional parameters will need to be added to /etc/picp/picdevrc.
PICkit 2 programmers will work with another program called pk2cmd hosted by Microchip
here
. You will need to install pk2cmd from source. so in a directory of your choosing:
wget http://ww1.microchip.com/downloads/en/DeviceDoc/pk2cmdv1.20LinuxMacSource.tar.gz
tar -xzf pk2cmdv1.20LinuxMacSource.tar.gz
cd pk2cmdv1.20LinuxMacSource
make linux
sudo make install
Note that Microchip touts the PICkit 3 as a replacement for the PICkit 2. It is not a replacement for the PICkit 2 as there are no Linux drivers for the PICkit 3, so do not buy the PICkit 3 thinking it will work in Linux.
There is also another program that claims to work with a range of DIY PIC programmers:
PICPgm
. We have not tried this program or any of the DIY programmers at this point. We know there are other PIC programmers out there, both cheap and expensive, that have not been mentioned. Perhaps a PIC programmer roundup is in need of writing.
The Code:
The code for this how-to is a kind of hello world program using LEDs. The code for this is hosted on Github, you can follow along with the blink.c file for the
PIC16F887
,
PIC16F688
, or
PIC12F675
. Also included are working .hex files. Here is the PIC16F887 code as a reference as we walk through each major operation:
//Simple program to get started programming
//PIC microcontrollers in Linux.
//Written by Devlin Thyne.
//Released to the public domain.
#include "pic/pic16f887.h"
//Use these configuration words:
//0x2ff4 0x3fff
//Set the configuration words:
unsigned int at _CONFIG1 configWord1 = 0x2FF4;
unsigned int at _CONFIG2 configWord2 = 0x3fff;
//To compile:
//sdcc -mpic14 -p16f887 blink.c
//To program the chip using picp:
//Assuming /dev/ttyUSB0 is the serial port.
//Erase the chip:
//picp /dev/ttyUSB0 16f887 -ef
//Write the program:
//picp /dev/ttyUSB0 16f887 -wp blink.hex
//Write the configuration words (optional):
//picp /dev/ttyUSB0 16f887 -wc 0x2ff4 0x3fff
//Doing it all at once: erasing, programming, and reading back config words:
//picp /dev/ttyUSB0 16f887 -ef -wp blink.hex -rc
//To program the chip using pk2cmd:
//pk2cmd -M -PPIC16f887 -Fblink.hex
//Setup variables
unsigned char ucharCount = 0;
unsigned int uintDelayCount = 0;
void main(void)
{
//Set PORTC to all outputs
TRISC = 0x00;
ucharCount = 0;
uintDelayCount = 0;
//Loop forever
while ( 1 )
{
//Delay Loop
while ( uintDelayCount < 10000 )
{
//Increment the loop counter
uintDelayCount++;
}
//Reset delay loop counter
uintDelayCount = 0;
//Increment the count
ucharCount++;
//Display the count on the PORTC pins
PORTC = ucharCount;
}
}
The first line is the #include for the header file of the particular chip you will be using. It tells the compiler which registers are available and where they are located in memory. In most systems, the header files will be in /usr/share/sdcc/include.
Then we setup the configuration word or words fuses. They are only able to be written when the chip is programmed, but we can define them here so we don’t have to manually program them later. The PIC16F887 has the address for the configuration words defined in its header file as _CONFIG1 and _CONFIG2. The PIC16F688 and PIC12F675 do not have the configuration word address defined in their header (we said sdcc was in beta, didn’t we?), so we just use the address of the configuration word: 0x2007. The configuration words are specific to the chip model and application and are described in the chapter “Special Features of the CPU” in each of the respective chips’ datasheets. In the blink.c samples, the configuration word is just a 16bit hexadecimal word, but the word can be made more human readable by ANDing together the configuration options. Check out the chips’ header files for the names of the options.
Next, we setup some global variables, one for the value that will be output on the LEDs and the other for a delay counter.
In the void main(), we set the PORTC tristate register, TRISC to all outputs. The PIC12F675 has only one port, GPIO, and its tristate register is TRISIO. After setting the tristate register, we enter an infinite loop with while(1). Inside that loop is a delay loop so that we can see the LEDs changing. Following the delay loop, the display counter is incremented and then written to PORTC (or GPIO) for display on the LEDs.
Compiling the Code:
Now that we have reviewed the code, it is time to turn it into something a PIC can use. sdcc will take the blink.c file and make a bunch of files. One of these files will be blink.hex which will be what the PIC device programmer will be writing to the PIC. Here’s how:
For the PIC16F887:
sdcc -mpic14 -p16f887 blink.c
For the PIC16F688:
sdcc -mpic14 -p16f688 blink.c
For the PIC12F675:
sdcc -mpic14 -p12f675 blink.c
The -mpic14 option tells sdcc that it will be compiling for the 14-bit instructions of the PIC16 and PIC12 families. The second option is the specific chip that code will be compiled for. The last thing on the line is the file containing the C code that will be compiled.
Programming the Chip:
To program a chip you will take your device programmer and connect the chip you want to load with your program. Unless you are using a socket programmer like the PIC-MCP-USB, you will need to consult the datasheets of the programmer and the chip to be programmed for the proper connection. Once properly connected, you will need to run the program to run the programmer:
For a PICStart+ programmer on /dev/ttyUSB0 programming a PIC16F887 :
picp /dev/ttyUSB0 16f887 -ef -wp blink.hex -rc
For a PICkit 2 programmer programming a PIC16F887:
pk2cmd -M -PPIC16f887 -Fblink.hex
If you are programming another chip, or the PICStart+ programmer is on a port besides /dev/ttyUSB0, you will need to make corresponding changes to the commands.
Note: The code provided for the PIC16F887 disables low-voltage programming. Some of the programmers available but not directly mentioned only perform low-voltage programming. If you have one of these programmers, you will need to change the code so that the low-voltage programming bit in the configuration words allows for low-voltage programming. The low-voltage programming pin on the microcontroller will also need to be pulled low during normal operation.
Wire the Circuit:
The circuit for this project with the code provided is really simple to breadboard. Below are the schematics for the three chips:
Start out by connecting the Vdd pins to a positive voltage source between 4.5 volts and 6 volts and the Vss pin to ground. The 40 pin PIC16F887 and the 14 pin PIC16F688 will both need a pullup resistor on their master clear pin. To any one or all of the PORTC pins (or GPIO pins for the PIC12F675), connect LEDs with current-limiting resistors to ground. Note that pin 4 of the PIC12F675 is only an input and will not light an LED. The current out of any pin of the three chips used is limited to 20mA, so the current-limiting resistors are optional for most cheap jellybean LEDs. What you should see when you power up the circuit are blinking LEDs. The LEDs should be lighting to a binary count.
Your turn!
Now that we have given you a start with programming PICs using Linux, we hope to see more projects using these chips and the tools we have mentioned above. Though this article was written for Linux users, Windows and MacOS X users should be able to use sdcc for their PIC programming needs.
Image information: The Tux logo is by Larry Ewing, Simon Budig, and Anja Gerwinski, via
Wikimedia Commons
. The Microchip logo is a registered trademark of
Microchip Technology Incorporated
.
Development Tools for PIC programmers | 94 | 50 | [
{
"comment_id": "207153",
"author": "Squirrel",
"timestamp": "2010-11-03T14:08:46",
"content": "Very nice.I’m liking these tutorials..I think that ARM programming should come next",
"parent_id": null,
"depth": 1,
"replies": []
},
{
"comment_id": "207160",
"author": "Mat",
... | 1,760,377,342.832855 | ||
https://hackaday.com/2010/11/02/robot-bicep-curl-accompanied-by-too-much-fanfare/ | Robot Bicep Curl Accompanied By Too Much Fanfare | Mike Szczys | [
"Robots Hacks"
] | [
"arm",
"dumbbell",
"marketing",
"mecanum",
"tap light"
] | So this is
the world’s strongest robot arm
. Great… no really, that’s wonderful. We think lifting a 1000 kilogram dumbbell is a good way to show it off to the public. But with great power came the world’s most over-the top marketing. Well, maybe not as bad as the
shake weight
but it’s getting there. In the video after the break you’ll see that there is plenty of adrenaline-pumping music and they’ve hired an acrobat to pull a sheet off of the thing. We’ve pointed her out in the image above. [Caleb] noticed that they seem to have programmed in human kinetic to make it bounce and strain as a human lifting a heavy load would. And then there’s the fog machine. Classic. We also enjoy the use of a tap light (
which we’ve seen around here before
) to activate the demo.
But now we’re getting carried away. The article linked at the top covers a new development for the arm; a motorized base that can move it around. Looks like the base, which uses
mecanum wheels
, just slips under a stationary frame for the robot and lifts enough to truck it around.
[youtube=http://www.youtube.com/watch?v=LcZJA3XyVjQ] | 43 | 43 | [
{
"comment_id": "206817",
"author": "anon",
"timestamp": "2010-11-02T20:35:05",
"content": "Well the marketing is clearly working….",
"parent_id": null,
"depth": 1,
"replies": []
},
{
"comment_id": "206818",
"author": "Jef",
"timestamp": "2010-11-02T20:37:39",
"conten... | 1,760,377,342.738983 | ||
https://hackaday.com/2010/11/05/avr-programming-03-reading-and-compiling-code/ | AVR Programming 03: Reading And Compiling Code | Mike Szczys | [
"Featured",
"how-to",
"Microcontrollers"
] | [
"AVR",
"bitwise",
"c++",
"code",
"datasheet",
"programmer",
"programming"
] | In
the last installment
of our tutorial series we built a simple circuit on a breadboard and programmed an ATmega168 to make it run. That proves that you know how to follow directions, but the eureka moments of doing everything yourself are on the way. This time around you will get down and dirty with the datasheet, learning where each line of the sample code came from, and give your recently installed compiler a test drive. We will:
Talk about bitwise operators and how they work when coding for microcontrollers
Discuss C code shorthand
Review the sample code from Part 2 and talk about what each line of code does
Learn to compile code
If this is the first you’ve heard about our AVR Programming series, head back to
Part 1
and start from the beginning. Otherwise, take a deep breath and we’ll being after the break.
Series roadmap:
AVR Programming 01: Introduction
AVR Programming 02: The Hardware
AVR Programming 03: Reading and compiling code
AVR Programming 04: Writing code
Prerequisites
You must know something about C code. The ability to read it is probably good enough, Google can help you with the rest as you learn.
It helps if you have a text editor that includes syntax highlighting. I’m purely a Linux user and I like to use both Kate and Gedit depending on my mood. But I also use nano from the shell quite frequently. This is a tool and your choice is purely personal preference.
Grab
the sample code from part 2
of the series. I’ve embedded it below but you may want it in a separate windows for reference.
Datasheets; the instruction manual for hardware. Grab
the datasheet for the ATmega168
as I’ll be referencing specific pages as examples. Knowing how to look up information in the datasheet and turn it into code will make it easy for you to use any chip in the AVR family.
Bitwise Operators
Even though we’ll be writing code in the C language, we’re quite close to the hardware when programming microcontrollers. Because of this
you must understand bitwise operators
. Not just kind of, not intuitively, you should know them well enough to teach them to someone else without looking it up.
Hands down the best explanation I’ve ever come across is by [Eric Weddington], who also co-authored the makefile that came with my example code. It is also known as
Programming 101.
Read it, know it, love it. But I’ll try to give a quick crash course for those to lazy to read his whole lesson.
Code Symbol
Logic Function
|
OR
&
AND
~
NOT
^
XOR
<<
Shift Left
>>
Shift Right
The list above shows all of the code symbols and their logic operation.
OR – true if either or both bits being compared are 1
AND – true only if both bits being compared are 1
NOT – results in the opposite of a value (~1 = 0, ~0 = 1)
XOR – exclusive OR… true if one bit being compared is 1 but false if neither or both of them are
Shift Left – moves bits left within a binary number. (1<<0 = 0b0001, 1<<4 = 0b1000)
Shift Right – moves bits to the right a desired amount (0b1000>>2 = 0b0010)
We’re going to use Shift Left all the time in our code because it’s a quick way to build a binary number. We’re
always
working in binary numbers made up of eight bits. Those bits are numbered 0-7 because counting always starts with 0 when it comes to microcontrollers. So if you want to set the fifth bit to a logic high (‘1’) you would shift ‘1’ left by 5:
1<<5
This will result in the binary number 0b00100000. If this is child’s play, move to the next section. If not, read [Eric’s] tutorial.
C Code Shorthand
I tend to use shorthand in my code as my hands often hurt from too much typing (as they do now). This saves a bit on the old ibuprofen expenditure for the month by allowing me to type less characters to accomplish the same simple assignments. Here’s a quick table of examples:
Traditional Code
Shorthand Equivalent
value = value + 1;
value += 1;
value = value >> 1;
value >>= 1;
value = value & bitMask;
value &= bitMask;
value = value | bitMask;
value |= bitMask;
PORTD = PORTD ^ (1<<0);
PORTD ^= (1<<0);
So basically, if I am setting a variable by using that same variable as the first
operand
I can just place the
operator
before the equals sign and put the second operand after the equals sign to accomplish the same task without typing the variable name twice. If you understood that sentence you’re doing quite well!
Jump into the sample code
Psuedocode
A good practice when developing code is to write psuedocode. Something that clearly states what you want to do in plain language. This is an outline of the structure that your program will take and it shouldn’t include any specific code, but will be replaced by that code later:
//Setup the clock
//prepare an interrupt every 1 second
//Setup the I/O for the LED
//toggle the LED during each interrupt
This program is so simple that the psuedocode seems unnecessary, but it will keep you focused and help stave off errors on larger projects.
The Actual Code
The main.c from the
Part 2 sample code
is embedded below. Take a minute to match up the parts of the psuedocode above with actual code blocks below.
/*
* Hackaday.com AVR Tutorial firmware
* written by: Mike Szczys (@szczys)
* 10/24/2010
*
* ATmega168
* Blinks one LED conneced to PD0
*
* http://hackaday.com/2010/10/25/avr-programming-02-the-hardware/
*/
#include <avr/io.h>
#include <avr/interrupt.h>
int main(void)
{
//Setup the clock
cli(); //Disable global interrupts
TCCR1B |= 1<<CS11 | 1<<CS10; //Divide by 64
OCR1A = 15624; //Count 15624 cycles for 1 second interrupt
TCCR1B |= 1<<WGM12; //Put Timer/Counter1 in CTC mode
TIMSK1 |= 1<<OCIE1A; //enable timer compare interrupt
sei(); //Enable global interrupts
//Setup the I/O for the LED
DDRD |= (1<<0); //Set PortD Pin0 as an output
PORTD |= (1<<0); //Set PortD Pin0 high to turn on LED
while(1) { } //Loop forever, interrupts do the rest
}
ISR(TIMER1_COMPA_vect) //Interrupt Service Routine
{
PORTD ^= (1<<0); //Use xor to toggle the LED
}
The first few lines are comments for the benefit of human eyes and will not be used by the microcontroller. Comments in C are prefaced by two slashes (//) for single line comments or encased in slash-star (/*) and star-slash (*/) pairs for multiline comments. It’s a good idea to write comments that detail the program, what it does, what hardware it runs on, and any other helpful information. I find that I often reuse code from past projects and a bit of information at the top of the file helps locate what I’m looking for quickly.
The Includes
The next thing you see are the includes:
#include <avr/io.h>
#include <avr/interrupt.h>
Includes tell the compiler that we’re going to be using things from other files. In this case, two files from
AVR Libc
that came with the cross-compiling toolchain we installed in
Part 1
. These are C files that allow us to use human-readable (and rememberable!) code when working with the hardware on the chip. The io.h file rolls header files for all of the supported AVR chips into one. We define what processor we’re using in our makefile, and the appropriate header file is automatically chosen from io.h when we compile our code later in this tutorial.
In our example code I’ve used names like DDRD, PORTD, TCCR1B, OCR1A, TIMSK1, etc. All of these have addresses that are pointed to using the io.h file. This allows us to call pins on the chip by the names like PORTD which are the same across all AVR variants instead of register addresses like 0x0B which has different functions on different chips. Most likely you’ll need to include io.h in every AVR program you use, and doing so makes your code more portable. The interrupt.h file is only needed if you are using interrupts, something we’ll talk about as we look at the next code block
Setting up the clock for use with interrupts
Processors need a clock signal in order to work. AVR chips can use external clocks like a crystal oscillator or a ceramic resonator, but they come from the factory configured to use the internal RC oscillator as the system clock (read more on page 28 of the datasheet). The internal RC oscillator of the ATmega168 runs at approximately 8.0 MHz depending on voltage stability and temperature. It also ships with the DIV8 fuse enabled which divides the clock signal down to 1.0 MHz. For the sample program I wanted an LED to blink between on and off, changing about once a second. Here’s the code block that sets that functionality up:
//Setup the clock
cli(); //Disable global interrupts
TCCR1B |= 1<<CS11 | 1<<CS10; //Divide by 64
OCR1A = 15624; //Count 15624 cycles for 1 second interrupt
TCCR1B |= 1<<WGM12; //Put Timer/Counter1 in CTC mode
TIMSK1 |= 1<<OCIE1A; //enable timer compare interrupt
sei(); //Enable global interrupts
The very first line has something to do with interrupts. An interrupt is a great feature of microprocessors. Basically you tell the chips to watch for a certain condition. When it matches that condition it will stop what it is doing no matter where it is, and run a different set of code called an Interrupt Service Routine (ISR). Because we are about to change some settings having to do with interrupts, we don’t want anything (like an interrupt) to stop us in the middle of this process. I’ve used a command that is available to us because we included interrupt.h at the beginning of our file. The command is
cli();
which disables all interrupts. Once we are done with our settings we
must
remember to enable them again, using the
sei();
command. You can see I’ve done that at the bottom of this code block
Now we want to watch for the passage of 1 second worth of time. The four lines in between these two commands are used to setup a counter to do just that. Because the internal oscillator is running at 1 MHz, or 1 Million cycles per second, we must trigger an interrupt every 1 million cycles. The biggest timer this chip has is 16-bits which can only count from 0 to 65,535. In other words, we don’t have a timer that can count high enough to measure such a large number of cycles.
Fortunately, we have the option to use a divider with our timer, called a prescaler. To do so we look in the datasheet on page 134 to see a chart outlining the clock select. It shows prescaler options which divide the system clock by 1, 8, 64, 256, and 1024. Knowing that we want to count 1,000,000 cycles we can use a bit of math to choose the best prescaler:
1,000,000 / 1 = 1,000,000
1,000,000 / 8 = 125,000
1,000,000 / 64 = 15,625
1,000,000 / 256 = 3,906.25
1,000,000 / 1024 = 976.5625
The math only leaves us with one choice. That’s because using a prescaler of 1 or 8 results in a number of cycles that is larger than
65,536
so our 16-bit timer can’t count high enough. Prescalers of 256 and 1024 give results that are not a whole number. If we don’t use a whole number we introduce an inaccuracy in our timing because we can’t measure a fraction of a cycle. A prescaler of 64 meets both our needs, being a whole number that is smaller than the limits of our 16-bit counter.
How can we set up this prescaler? The datasheet tells all. Looking at “Timer/Counter1 Control Register B” (TCCR1B) which spans pages 133 and 134 we can find the answer. Diagram 15-5 shows a clock settings table. In our case we need to set CS10 and CS11 to ‘1’ on the TCCR1B register. To do this we use an OR operator and Left Shift a ‘1’ to the location of the CS10 and CS11 bits:
TCCR1B |= 1<<CS11 | 1<<CS10;
Because this is our first real bitwise math let’s look at it in depth. First off, we’re only setting two bits on the register so we do not want to use just an equals sign. If I had done that, this command would force all other bits to zero. Instead, I use shorthand code to use the OR operator to compare TCCR1B with a bitmask containing a ‘1’ at the correct location for the CS10 and CS11 bits. Any other bits on the TCCR1B register that are set to ‘1’ will remain so.
I’ve created a bitmask to the right of the |= operator. As I talked about in the includes section, CS10 and CS11 are defined in io.h. But looking at the TCCR1B register we can see that CS10 is on bit 0 and CS11 is on bit 1. If you solved your math problem longhand it would look like this:
1<<CS11 | 1<<CS10;
1<<1 | 1<<0;
0b00000010 | 0b00000001;
0b00000011;
This is the method that you use for setting any bit for any purpose. It really is that simple. Build a bitmask and apply it to a register or variable. Just remember to be careful about preserving data that might already be stored on a register or in a value but using the OR operator during assignment.
Now that we have a divided clock source for the counter, and a target number of 15,625 cycles to watch for thanks to the math above. We can use one of the modes of Timer1, the Clear Timer on Compare Match (CTC), to trigger an interrupt at that exact cycle count. Take a look at page 121 of the datasheet and you will see we need to set OCR1A to our target value. We’ll set it to 15,624, one less than our cycle count because microcontroller timers start counting with the number zero, not one. This time we will use an equal sign because there are no other values stored in this register:
OCR1A = 15624;
I also need to set the timer mode I want to use. Table 15-4 on page 133 has a lot of information on this. As discussed before, I want to use CTC mode so that narrows my choices on this table down to just two. I can choose between those because I know I’m using the value of OCR1A as the largest number the timer should count to, or TOP. The chart tells me to set the WGM12 bit on the TCCR1B register to 1.:
TCCR1B |= 1<<WGM12;
This could have been done at the same time as the timer prescaler because they’re set on the same register. But it’s fine to do it in two steps because I’ve used the OR operator, making sure I’m not changing any of the other bits on this register.
The next step can be a “gotcha” for new developers. Everything is now setup correctly for our timer to trigger an interrupt at the appropriate interval. But if we don’t set the “interrupt enable” flag for that particular event, the interrupt will never happen. Page 136 of the datasheet cryptically discusses the use of the Timer/Counter Output Compare A Match Interrupt Enable. Setting this bit to 1 will enable the CTC interrupt we are planning to use:
TIMSK1 |= 1<<OCIE1A;
Simple right? Do it a few times and it will be. There’s a lot of functionality with the timers on these chips and wading through the register settings is the price you pay for that power. But now we’re ready to go with 1-second interrupts.
Initializing the Input/Output pins
When an AVR chip resets, the pins are all placed in tri-state mode. At the beginning of the program any input and output pins need to be setup for their desired function. Starting on page 73 of the datasheet you can read about using pins as general input and output. There are three registers for each pin that we will generally be concerned with: Data Direction Register (DDR), Port register (PORT) and Pin register (PIN). Each of these will be suffixed with a letter corresponding to which set of pins we are working with. I’ve connected the LED to Port D so I need to work with DDRD, PORTD, and if I was using inputs, PIND.
//Setup the I/O for the LED
DDRD |= (1<<0); //Set PortD Pin0 as an output
PORTD |= (1<<0); //Set PortD Pin0 high to turn on LED
The code above is used to set up an LED. Setting a bit on DDRD to 1 will make the corresponding pin an output. Setting it to zero would make it an input. Here I’ve set up an output because we are driving an LED. Outputs can be turned on or off by setting a 1 or a 0 to the PORT register respectively. So above I’ve used PORTD to turn on bit 0 which corresponds to pin connected to the LED.
If we were using a pin as an input the PORT register would be used to enable or disable an internal pull-up resistor and the PIN register would be used to measure the logic value currently present on that pin. Table 13-1 on page 74 shows the various states of I/O pins, but I’ll cover it more in part 4 of this series.
The Loop
Embedded programs must have an infinite loop that prevents the program from getting to the end and exiting. That’s because if our program exits the chip will just sit there and do nothing (after all, there’d be no program running). In this case I don’t need the loop to do anything since I’ve already set up the hardware and I’m using an interrupt to blink the LED:
while(1) { } //Loop forever, interrupts do the rest
I’ll add functionality to the loop in Part 4 or the series, but for now the ‘while(1)’ loop just traps the program and does nothing else.
Handling the interrupt
Everything is now setup and ready to go, but nothing will happen unless we write code that does something after the interrupt happens. This is called an Interrupt Service Routine (ISR). The rest of the code is halted and this routine is run. It is best to keep this as short as possible, which is easy here because we just need to toggle the LED:
ISR(TIMER1_COMPA_vect) //Interrupt Service Routine
{
PORTD ^= (1<<0); //Use xor to toggle the LED
}
If you look at page 62 of the datasheet you can see that the interrupt source for Timer/Counter1 Compare A match is called “TIMER1 COMPA”. We take this and use it as the input variable for the ISR, replacing spaces with underscores and adding a lower case “vect” at the end. This is how the compiler knows which ISR belongs to different interrupt sources. As for the LED itself, I’ve used the XOR operator and a bitmask. The bitmask ensures that only bit 0 will be changed.
Compiling Code
Before we leave this segment of the tutorial series you should give your compiler a test-drive.
The compiler takes our C code and turns it into a file that can be written to the microcontroller. The ins and outs of a compiler get a bit hairy and this isn’t the time to explain those details. But as you learn to write embedded code you should make an effort to also learn how this code will be interpreted by the compiler. Doing so will prevent a lot of headaches caused by optimization (the compiler trying to streamline your bloated C code) and it will allow you to make the most of your hardware both in terms of programming space, and functionality.
But for now there’s a make file included in
the example source from Part 2
. If you haven’t already, unzip that package and navigate to the ‘src’ directory. There are two files in that directory, main.c and makefile. A makefile is a way to automate the compiling process. This one compiles, links, and programs a C code source file. If you look at the makefile you’ll notice that there are several user settings near the top. You need to setup the microprocessor for which you’ve written code, the name of the source file you’ve written (TARGET = main), the programmer you’re using (from the AVRdude list discussed in Part 2), and the port path for the programmer.
If you type ‘make’ you should be able to compile the example program. Unless you have an AVR Dragon programmer and you’re running Linux you’ll get an error when it tries to program the chip, but it should compile the code and output several extra files:
$ ls -la
total 84
drwxr-xr-x 2 mike mike 4096 2010-11-04 14:20 .
drwxr-xr-x 3 mike mike 4096 2010-11-01 14:55 ..
-rw-r--r-- 1 mike mike 894 2010-10-24 12:34 main.c
-rw-r--r-- 1 mike mike 23 2010-11-04 14:20 main.d
-rw-r--r-- 1 mike mike 13 2010-11-04 14:20 main.eep
-rwxr-xr-x 1 mike mike 7121 2010-11-04 14:20 main.elf
-rw-r--r-- 1 mike mike 750 2010-11-04 14:20 main.hex
-rw-r--r-- 1 mike mike 5224 2010-11-04 14:20 main.lss
-rw-r--r-- 1 mike mike 5171 2010-11-04 14:20 main.lst
-rw-r--r-- 1 mike mike 14464 2010-11-04 14:20 main.map
-rw-r--r-- 1 mike mike 3972 2010-11-04 14:20 main.o
-rw-r--r-- 1 mike mike 1454 2010-11-04 14:20 main.sym
-rw-r--r-- 1 mike mike 10235 2010-10-24 10:44 makefile
‘main.hex’ is the file that you can program onto the microcontroller. This makefile is extremely versatile. You can also see that it output ‘main.eep’ which can be used to program the EEPROM on the chip if your code includes default data stored in the EEPROM. It can also be altered to output an assembler file, or binaries in different formats.
If you’re compiler didn’t spit out this information, there’s something wrong with your toolchain. Use your friend Google to search for any error messages and see if you can’t get things fixed up. Another great exercise would be to modify this file to work with your programmer. If you managed to get AVRdude working in Part 2 of this series, this alteration is as simple as changing the makefile to use those same settings.
Conclusion
That’s it for now. In the next installment of this series I’ll be talking about fuse bits, writing our own code, and I’ll try to touch on many of the different peripheral features of this chip. I’m plan to augment the original circuit with a few more LEDs (so make sure you have at least 8 of them and their matching resistors) along with adding a button for input. Thanks for reading!
Follow Me
@szczys
Resources
Atmel AVR
ATmega168 Datasheet
(PDF)
AVR Libc manual | 41 | 39 | [
{
"comment_id": "208256",
"author": "jamieriddles",
"timestamp": "2010-11-05T23:14:25",
"content": "excellent serieskeeps this upits gonna be a while before my brain takes this all in.",
"parent_id": null,
"depth": 1,
"replies": []
},
{
"comment_id": "208347",
"author": "mini... | 1,760,377,343.324347 | ||
https://hackaday.com/2010/11/05/robot-eyes-look-where-you-do/ | Robot Eyes Look Where You Do | Mike Szczys | [
"Video Hacks"
] | [
"augmented reality",
"eye",
"robot",
"tracking",
"wearable"
] | This robot eye
can move five times faster than the human eye. It’s capable of being used to follow a human gaze and, as you can see by that coin, it’s small enough to be used in pairs. When used to follow your gaze it needs a custom-made eye tracker. The thought here is that a lot can be learned about a person’s psyche by monitoring what they are focusing on. But we wonder about the
augmented reality
properties of a setup like this.
Imagine a pair of glasses as a heads up display. If this camera knows where you’re looking it can process the items in your gaze and overlay digital information. As with all new technology there are obvious military uses for this, but we’d be more interested in a Flickr pool type collection of people’s real-world experiences. Like subscribing to the locations of that
thumb drive network
in NYC and having the camera/glasses guide you to the nearest installation.
Want to see how fast this thing responds? Check out the video after the break.
[youtube=http://www.youtube.com/watch?v=6hLiQQaUnGM]
[via
Neatorama
] | 35 | 35 | [
{
"comment_id": "208197",
"author": "Physics_Dude",
"timestamp": "2010-11-05T20:15:34",
"content": "If I’m not mistaken, that uses the same magnetic technology that your hard drive uses to move the pinheads.",
"parent_id": null,
"depth": 1,
"replies": []
},
{
"comment_id": "20819... | 1,760,377,342.93058 | ||
https://hackaday.com/2010/11/05/ai-via-super-mario-evolution/ | AI Via Super Mario Evolution | Mike Szczys | [
"Misc Hacks"
] | [
"ai",
"artificial intelligence",
"evolution",
"mario",
"super mario bros"
] | Can Super Mario teach you to think? That’s the idea behind using a simple version of the
game to teach artificial intelligence
. [Oddball] calls this The Mario Genome and wrote at program that can take on the level with just two controls, right and jump. He gave the script 1000 Marios to run through the level. It then eliminates the 500 least successful and procreates back to 1000 using the 500 most successful. In this way the program completed the level in 1935 generations and completed it in the quickest possible time in 7705 generations. He’s posted the script for download so that you can try it yourself. It’s an interesting exercise we’d love to see applied to more random games, like Ms. Pac-Man.
[via Reddit] | 25 | 25 | [
{
"comment_id": "208175",
"author": "brad",
"timestamp": "2010-11-05T19:10:02",
"content": "very neat to try on my machine. i don’t know much about this stuff, but it’s fun to watch all them little marios!",
"parent_id": null,
"depth": 1,
"replies": []
},
{
"comment_id": "208184"... | 1,760,377,343.204406 | ||
https://hackaday.com/2010/11/05/chest-freezer-temperature-controller/ | Chest Freezer Temperature Controller | Mike Szczys | [
"Beer Hacks"
] | [
"atmega48",
"chest freezer",
"controller",
"ferment",
"temperature"
] | [Mikey Sklar] finds himself in need of a temperature regulated refrigerator for fermenting foods like yogurt, kimchi, bread, and beer. After some testing he found that by
building his own controller
he can get a chest freezer to outperform an upright refrigerator at this task by 2-to-1.
The controller is based around an ATmega48. It includes a remote temperature sensors which you can see connected to the lower left header in the image above. On the back of the board there’s a relay used to switch the freezer’s power on and off. [Mikey] is selling a kit but the hardware and software for the project are both open source so build it yourself if you have the know-how.
A chest freezer is a great place to store Cornelius kegs… we’ll keep our eyes open for one. | 11 | 11 | [
{
"comment_id": "208171",
"author": "JB",
"timestamp": "2010-11-05T18:35:17",
"content": "nice Mikey! Good seeing your project posted here!",
"parent_id": null,
"depth": 1,
"replies": []
},
{
"comment_id": "208176",
"author": "PanicOpticon",
"timestamp": "2010-11-05T19:13... | 1,760,377,343.136392 | ||
https://hackaday.com/2010/11/05/making-point-contact-transistors/ | Making Point Contact Transistors | Devlin Thyne | [
"classic hacks",
"Misc Hacks",
"Parts"
] | [
"germanium",
"point contact transistor",
"transitor"
] | [youtube=http://www.youtube.com/watch?v=vmotkjMSKnI&w=470]
[Jeri Ellsworth] is back at it again. We seem to cover her work
a lot here
. Her latest video above covers how she created a point contact transistor from a 1N34 germanium cat whisker diode. After opening the glass casing on the diode, she uses sharpened phosphor bronze metal from common electrical connectors as the collector and emitter. A 330 microfarad capacitor charged to 20 volts and then discharged though a 680 ohm resistor to the base and collector leads forms the collector region. Her test jig is a simple oscillator circuit such that a properly formed transistor will start the circuit oscillating and make and audible sound. We look forward to more esoteric knowledge of electronic devices being brought to our attention. | 15 | 15 | [
{
"comment_id": "208143",
"author": "biozz",
"timestamp": "2010-11-05T17:07:02",
"content": "these are like the first type of transistors made right?",
"parent_id": null,
"depth": 1,
"replies": []
},
{
"comment_id": "208174",
"author": "zerth",
"timestamp": "2010-11-05T19... | 1,760,377,343.473073 | ||
https://hackaday.com/2010/11/05/racing-sim-cockpit-stores-inside-an-ottoman/ | Racing Sim Cockpit Stores Inside An Ottoman | Mike Szczys | [
"home entertainment hacks"
] | [
"ottoman",
"racing",
"simulator"
] | [Lyscho] built a racing simulator cockpit based on a PVC frame but it took up a lot of space when not in use.
His second generation
is built inside the frame of an ottoman, meaning it can be stored right under your feet.
The pedals are fixed in place, with some padding below to rest your heels on. The cockpit chair and steering wheel are both adjustable to suit different drivers. They use a routed groove along with wing nuts and bolts, making it easy to slide them for adjustments. The ottoman itself is [Lyscho’s] own creation, which just needs power and USB when in use, and has a padded top when not in use.
If you can’t
use a real car as the simulator
this is fantastic alternative.
[via
Make
] | 14 | 14 | [
{
"comment_id": "208122",
"author": "fartface",
"timestamp": "2010-11-05T16:00:04",
"content": "Not wireless?LAME!get wireless power in there!",
"parent_id": null,
"depth": 1,
"replies": []
},
{
"comment_id": "208128",
"author": "jayson",
"timestamp": "2010-11-05T16:26:56... | 1,760,377,343.878687 | ||
https://hackaday.com/2010/11/05/have-you-ever-wanted-to-be-on-internet-tv/ | Have You Ever Wanted To Be On (Internet) TV? | James Munns | [
"contests"
] | [
"badge",
"Independent",
"Inventor",
"Rev3",
"revision3",
"tv"
] | Are you an independent inventor? It might just be your lucky day. The fine folks at
Independent Inventor TV
, a new show currently filming for Revision3, is looking for home and garage based inventors to present their inventions for the camera. Currently they are based out of San Francisco, CA and are looking to film people in person, or by Skype if you are out of town.
To apply to be on the show, send an email to Independent.Inventor.tv(at)gmail.com with the details, photos, and videos of your inventions. The shooting date of the show is November 15th, so make sure to have all submissions in well before then. The selected inventors will get to meet the hosts, Comedian Jonah Ray, as well as fellow hacker [Joe Grand] (who is the creator of many of the
DefCon Badges
we have
covered before
). Be sure to let them know Hackaday sent you! | 2 | 2 | [
{
"comment_id": "208109",
"author": "skater_j10",
"timestamp": "2010-11-05T15:04:28",
"content": "Hey kinda coincidental, but one of my projects was just featured on TV last week on the Daily planet’s “Planetyou”. Check it out:http://tinyurl.com/2vqmlyuThere have been a few other Hackers and makers ... | 1,760,377,343.242641 | ||
https://hackaday.com/2010/11/02/lego-ball-mill/ | LEGO Ball Mill | Mike Szczys | [
"chemistry hacks"
] | [
"aluminum powder",
"ball mill",
"lego",
"PVC",
"pyrotechnics"
] | This is a ball mill
used for refining materials into a fine powder. [Jpoopdog] built it in two parts, a base and the tumbler chamber. The base itself is build using LEGO wheels as rollers. The motor and controller from an NXT kit is used to drive the rotation, with programming to stop the mill every so often so that the raw material can cool down. That’s important because this can be used to make substances like aluminum powder, an explosive substance sometimes used in pyrotechnics. We don’t recommend producing your own explosives (or
making your own propellant
) but if that’s what you’re after [Jpoopdog] did build in a safety feature. The chamber,which is constructed from PVC, has a fail safe to prevent an explosion. A hole has been drilled in the end cap and plugged with hot glue. In the event the milling material starts to overheat the glue will melt and alleviate the built up pressure. | 21 | 21 | [
{
"comment_id": "206771",
"author": "hacknet",
"timestamp": "2010-11-02T19:14:34",
"content": "PVC seems very static prone to me.",
"parent_id": null,
"depth": 1,
"replies": []
},
{
"comment_id": "206773",
"author": "dwqasw",
"timestamp": "2010-11-02T19:18:07",
"conte... | 1,760,377,343.937558 | ||
https://hackaday.com/2010/11/02/lego-barcode-scanner/ | LEGO Barcode Scanner | Mike Szczys | [
"Toy Hacks"
] | [
"barcode",
"lego",
"nxt",
"scanner"
] | Playing store just got really, really fun because you can now
build your own LEGO barcode scanner
. As you can see after the break, it works well and it’s fast like a real barcode scanner. Unfortunately it doesn’t scan real barcodes. Or at least not traditional ones. As we learned in
the Barcode Challenge
, standard barcodes are a set of white and black bars that make up the ones and zeros of the code. This system uses the same white and gray bar system but it seems that it’s only the number of bars that identify an item, not a code created by a particular combination of light and dark. The items above are all scannable because the scanner counts the 2, 3, 4, 5 or 6 white beams on the bottom of each package. Still, it’s incredibly clever and a great toy for the young hackers to build if they have a little help.
[youtube=http://www.youtube.com/watch?v=Q6UYW0hwKTg]
[via
Tinkernology
] | 3 | 3 | [
{
"comment_id": "206763",
"author": "Marco",
"timestamp": "2010-11-02T18:40:02",
"content": "I have found the NXT light sensor to be rather noisy. Getting accurate results at that scanning speed is quite an achievement.",
"parent_id": null,
"depth": 1,
"replies": []
},
{
"comment... | 1,760,377,343.511896 | ||
https://hackaday.com/2010/11/02/hacking-a-hack-disassembly-and-sniffing-of-im-me-binary/ | Hacking A Hack: Disassembly And Sniffing Of IM-ME Binary | Mike Szczys | [
"Microcontrollers"
] | [
"binary",
"bus pirate",
"disassembly",
"im-me",
"reverse engineering",
"sniffing",
"spi"
] | It’s fun to pick apart code, but it gets more difficult when you’re talking about binaries. [Joby Taffey] opened up the secrets to one of [Travis Goodspeed’s] hacks by
disassembling and sniffing the data from a Zombie Gotcha game binary
.
We looked in on [Travis’] work yesterday at
creating a game using sprites on the IM-ME
. He challenged readers to extract the 1-bit sprites from an iHex binary and that’s what got [Joby] started. He first tried to sniff the LCD data traces using a Bus Pirate but soon found the clock signal was much too fast for the device to reliably capture the signals. After looking into available source code from other IM-ME hacks [Joby] found how the SPI baud rate is set, then went to work searching for that in a disassembly of [Travis’] binary. Once found, he worked through the math necessary to slow down communication from 2.7 Mbit/s to 2400 bps and altered the binary data to match that change. This slower speed is more amenable to the Bus Pirate’s capabilities and allowed him to dump the sprite data as it was sent to the LCD screen.
[Thanks Travis] | 9 | 9 | [
{
"comment_id": "206706",
"author": "andrew",
"timestamp": "2010-11-02T17:20:19",
"content": "#corrections “SPI baud rate” should be “SPI bit rate”",
"parent_id": null,
"depth": 1,
"replies": []
},
{
"comment_id": "206710",
"author": "andrew",
"timestamp": "2010-11-02T17:... | 1,760,377,346.165719 | ||
https://hackaday.com/2010/11/02/halloween-prop-mario-bros-with-full-sound-effects/ | Halloween Prop: Mario Bros. With Full Sound Effects | Mike Szczys | [
"home hacks"
] | [
"arduino",
"greeting card",
"Halloween props",
"mini",
"nunchuck",
"sound effect",
"super mario bros",
"wii"
] | Creativity abounds in putting together this
pair of Super Mario Bros. costumes
. [Rob] and his wife didn’t stop with a well-assembled troupe of familiar wardrobe items, but decided to go for authentic sound effects as well. It started by finding a few of his favorite Mario sounds on the Internet. From there he grabbed a greeting card that allows you to record several message. He recorded each of the sounds and removed the electronics from the card. From there an Arduino mini was connected to the playback buttons and to a Wii nunchuck. After the break you can see that when the kids press a button, the card plays back the sound of jumping, shooting fireballs, etc. So far it’s the best use of an audio greeting card that we think eclipses its intended use.
[flickr video=http://www.flickr.com/photos/53860850@N02/5134441901] | 13 | 13 | [
{
"comment_id": "206668",
"author": "Imanoss",
"timestamp": "2010-11-02T16:13:51",
"content": "so cool.that’s next year’s costume sorted for me",
"parent_id": null,
"depth": 1,
"replies": []
},
{
"comment_id": "206674",
"author": "kristian",
"timestamp": "2010-11-02T16:28... | 1,760,377,345.943539 | ||
https://hackaday.com/2010/11/02/magnetic-card-stripe-spoofer/ | Magnetic Card Stripe Spoofer | Mike Szczys | [
"Arduino Hacks"
] | [
"credit card",
"magnetic stripe",
"magstripe",
"spoofer"
] | This hodge-podge of components is capable of
spoofing the magnetic stripe
on a credit card. [Sk3tch] built an electromagnet using a ferrous metal shim wrapped in enameled magnet wire. While he was doing the windings [Sk3tch] connected his multimeter to the metal shim and one end of the wire, setting it to test continuity. This way, if he accidentally scraps the enamel coating and grounds the wire on the metal the meter will sound and alarm and he’ll know about the short immediately. An Arduino takes over from here, actuating the coil to simulate the different data sections of a magnetic stripe.
From his schematic we see that the electromagnet is directly connected to two pins of the Arduino. We haven’t looked into the code but is seems there should be either some current limiting, or the use of a transistor to protect the microcontroller pins (we could be wrong about this).
[Sk3tch’s] realization of this spoofer can be made quickly with just a few parts. Card data must be written in the code and flashed to the Arduino. If you want to see what a more feature-rich version would entail take a
look at this spoofer that has a keypad
for changing data on the go.
[via
Lifehacker
] | 26 | 26 | [
{
"comment_id": "206631",
"author": "James",
"timestamp": "2010-11-02T14:18:47",
"content": "I’m a bit ignorant in these matters, but don’t the magnetic stripes have 3 sub-stripes? Does this spoof all of them, or just simple cards like those used to give carpark access?",
"parent_id": null,
... | 1,760,377,345.845877 | ||
https://hackaday.com/2010/11/01/augen-e-go-booting-linux/ | Augen E-Go Booting Linux | Mike Szczys | [
"Linux Hacks"
] | [
"augen",
"Didj",
"e-go",
"linux",
"Windows CE"
] | The Augen E-Go is billed as a Netbook that ships with Windows CE. [Moogle]
got it to boot the Linux kernel
after a bit of
hardware snooping
. He found a UART connector on the main board and discovered that if you tie the enable pin to ground
you can send an ARM bootloader
to the device during boot up. His past experience
hacking the Didj and the Explorer
helped him recognize the processor used in the Augen. This lead to using a zimage from the Didj to boot the Linux kernel. So far the process halts at a kernel panic, but that’s because he hasn’t built the image with a file system for the device yet.
If the E-Go ends up playing nicely with Linux, [Moogle] may have found a suitable replacement for
the Zipit
.
Update:
Looks like we’ve got the wrong version of the E-Go pictured above (and linked below). Check out
[Moogle’s] comment
for model numbers.
[Augen photo credit:
Newegg.com
] | 29 | 29 | [
{
"comment_id": "206334",
"author": "Decius",
"timestamp": "2010-11-01T20:20:54",
"content": "What are the specs of this Device?",
"parent_id": null,
"depth": 1,
"replies": []
},
{
"comment_id": "206336",
"author": "The Moogle",
"timestamp": "2010-11-01T20:22:22",
"co... | 1,760,377,346.111348 | ||
https://hackaday.com/2010/11/01/futuristic-3d-mouse-originally-arduino-powered-and-3d-printed/ | Futuristic 3D Mouse Originally Arduino Powered And 3D Printed | Mike Szczys | [
"Peripherals Hacks"
] | [
"3d",
"arduino",
"mouse",
"printer"
] | We usually shy away from posting about commercial products. Strap on a bib to protect your shirt from the drool, watching the video after the break will show you why we had to post about this. [Valentin Heun] and his cohorts
developed this three-dimensional controller
using tools common to the hacker community. The patent-pending device uses a sphere for rotational input but can also be nudged for movement on 3 axes.
You may remember that [Valentin] as involved with that
10,000 watt flourescent lamp display
. His Arduino skills were honed with that installation and used during the development of this mouse. Also joining in the prototyping fun was a 3D printer used to make the parts. From project to production, we figure the skills you use when hacking are breaking down the barriers that inventors have traditionally faced when looking to marked useful products.
This would be fantastic for 3D cad, modelling, etc. But we think it would also go well with Eagle, like
the other 3D mouse hack
did.
[vimeo=http://vimeo.com/16253164] | 42 | 40 | [
{
"comment_id": "206299",
"author": "Craig Burden",
"timestamp": "2010-11-01T19:08:13",
"content": "OMG!!! where can i buy one!!",
"parent_id": null,
"depth": 1,
"replies": []
},
{
"comment_id": "206300",
"author": "James",
"timestamp": "2010-11-01T19:08:47",
"content... | 1,760,377,345.718225 | ||
https://hackaday.com/2010/11/01/typewriter-as-io-lets-you-play-zork/ | Typewriter As I/O; Lets You Play Zork | Mike Szczys | [
"Peripherals Hacks"
] | [
"arduino",
"resistor",
"solenoid",
"typewriter",
"zork"
] | Okay, for many the fact that
this typewriter plays Zork
on paper instead of a CRT is the fascinating part of this hack. But we love the implementation that makes the keys of the device an input and output.
The electric typewriter has been fitted with a solenoid for each key (wow, that’s a lot of work). In the image above you can see they are housed on plywood platforms behind the typewriter and connect using a piece of mono-filament fishing line. This flexible connection means the solenoids have no adverse effect when
you
want to do the typing instead of the Arduino which drives the solenoids. [Johnathan M. Guberman] took advantage of this, adding a resistor for each key. When depressed the key completes a circuit with the resistor, acting as the input. In this way, you can play Zork with a piece of paper as the monitor, typing for the input, and watching the typewriter magically pound out responses. See it happen after the break.
[vimeo=http://vimeo.com/16311288]
[via
Laughing Squid
and
Make
] | 26 | 26 | [
{
"comment_id": "206261",
"author": "Addidis",
"timestamp": "2010-11-01T18:14:56",
"content": "filed under “How to kill trees at an alarming rate”",
"parent_id": null,
"depth": 1,
"replies": []
},
{
"comment_id": "206262",
"author": "xythobuz",
"timestamp": "2010-11-01T18... | 1,760,377,346.001576 | ||
https://hackaday.com/2010/11/01/im-me-graphic-manipulation-using-sprites/ | IM-ME Graphic Manipulation Using Sprites | Mike Szczys | [
"Microcontrollers"
] | [
"animation",
"array",
"perl",
"sprite",
"travis goodspeed"
] | Here’s
a study in sprite animations
that [Travis Goodspeed] put together. He’s working with one of his favorites, the pink IM-ME device that
he’s been hacking on for a while
now. But if you don’t have this hardware that shouldn’t discourage you. There’s a lot to be learned from his methods which will translate to any microcontroller working with a graphic LCD.
He starts with a 24-bit PNM sprite that includes three frames of his desired animation. From there he needs a way to store the data for use with 8-bit microcontrollers. He chose to write a Perl script that will translate the image format into a 1-bit map. Each frame of the animation takes up a column width that is a multiple of 8 for easy retrieval by the processor. This translation into a C array, and the accompanying code that translates it into data for the frame buffer is the key to the animation process. What is he shooting for? A sprite-based video game on the handheld. | 7 | 7 | [
{
"comment_id": "206239",
"author": "JohnPower",
"timestamp": "2010-11-01T17:10:09",
"content": "umm… where’s the link to the actual article of Travis?",
"parent_id": null,
"depth": 1,
"replies": []
},
{
"comment_id": "206240",
"author": "Daid",
"timestamp": "2010-11-01T1... | 1,760,377,346.046248 | ||
https://hackaday.com/2010/11/01/halloween-house-has-been-known-to-burst-into-song/ | Halloween House Has Been Known To Burst Into Song | Greg R. Jacobs | [
"home hacks"
] | [
"halloween",
"House",
"Michael Jackson",
"Musical",
"Thriller"
] | Just a day after Halloween and a replacement for Michael Jackson has been found, in the form of a very talented
musical house
. Not only does this house come close to a Michael Jackson dance routine but can mimic the voice quite well. The house has also been known to do the
Monster Mash
as well as
Sandstorm (Techno) by Darude
. YouTube’s
KJ92508
has uploaded his Halloween conquests for all to enjoy. As of yet, he has not made a how to or even done a walk through video in broad daylight but here is to hoping he will due to numerous requests for a sneak peak. He has mentioned that he used “4 singing pumpkin faces, tombstones, hand carved and blow mold pumpkins, strobes, floods and thousands of lights.” I look forward to what is in store for next years decor. Just another example of what technology in everyday life and a little elbow grease can do. Be sure to check out the video of “Thriller” as done by this house after the break.
[youtube=http://www.youtube.com/watch?v=GUAV_1jBJB4]
We know that he’s using a commercial product called Light-o-Rama, but not much else. Anyone got some info? | 24 | 24 | [
{
"comment_id": "206225",
"author": "Chris",
"timestamp": "2010-11-01T16:18:22",
"content": "That is pure awesome.",
"parent_id": null,
"depth": 1,
"replies": []
},
{
"comment_id": "206228",
"author": "Bill",
"timestamp": "2010-11-01T16:23:53",
"content": "“We know th... | 1,760,377,345.642114 | ||
https://hackaday.com/2010/10/31/large-magnets-spark-on-halloween-who-knew/ | Large Magnets Spark On Halloween, Who Knew? | Jakob Griffith | [
"Misc Hacks"
] | [
"acrylic",
"arduino",
"brain",
"foam",
"hot knife",
"led",
"pwm"
] | This
overly large magnet
certainly completes the mad scientist look (for an even crazier look, take a jar of water with red food coloring and place in one large cauliflower, instant brain in a jar).
The base of the magnet is painted foam cut with a makeshift hot-knife; to get the magnet sparking [Macegr] laser
etched acrylic
with a fractal pattern and embedded LEDs in the ends of the acrylic. An Arduino handles the flashing LEDs and also produces a 60Hz PWM pulse for the spark’s hum. The end result is satisfyingly mad, and while practicing your evil ominous laugh catch a video of the magnet after the jump.
[youtube
http://www.youtube.com/watch?v=L6UlE1NH4iQ%5D | 28 | 28 | [
{
"comment_id": "205920",
"author": "Parker",
"timestamp": "2010-10-31T19:20:20",
"content": "Now go up behind someone and wait.",
"parent_id": null,
"depth": 1,
"replies": []
},
{
"comment_id": "205921",
"author": "tjb",
"timestamp": "2010-10-31T19:20:42",
"content":... | 1,760,377,345.787163 | ||
https://hackaday.com/2010/10/31/mechanical-mustache-envy/ | Mechanical Mustache Envy | Jakob Griffith | [
"Wearable Hacks"
] | [
"brass",
"copper clad",
"mechanical",
"mustache",
"steam punk",
"tension"
] | While this
mechanical mustache
isn’t made for a Halloween costume, it certainly looks like part of one. Copper clad, brass, cable, and a few other bits come together in a similar style to
tension based hands
; the piece is then worn much like a Mardi Gras mask. To complete the rustic “old tyme” look [John] was after, the copper was tarnished using the vapor from a vinegar and salt solution. The finished assembly is
steam punk delicious
, but we’re saddened by the lack of steam punk eye brows to complete the look (or steam punk mutton chops, or steam punk goatee, or…)
[via
Boing Boing
] | 8 | 8 | [
{
"comment_id": "205907",
"author": "Andrew",
"timestamp": "2010-10-31T18:49:00",
"content": "“warn much like a Mardi Gras ”Come in guys….at least proofread and have someone else proofread your posts",
"parent_id": null,
"depth": 1,
"replies": []
},
{
"comment_id": "205908",
... | 1,760,377,345.89192 | ||
https://hackaday.com/2010/10/31/even-more-halloween-links/ | Even More Halloween Links | Caleb Kraft | [
"Hackaday links"
] | [
"halloween"
] | We know you just got a links post a couple hours ago, but more people tipped us off to some great Halloween stuff and we just couldn’t wait.
[Michael] came up with this fantastic idea for a
flying ghost
. He’s using a twin prop tilt rotor design to fly his ghost all over the neighborhood. It has a camera mounted on board and the footage is both fascinating and, toward the end, quite funny. Nothing beats chasing children down the street in first person from a flying ghost.
[Trey] wrote in to show off his
47 foot wide spider
. He made it himself out of black painters plastic that he heat welded together using a heat gun. In the video you can see his victim, a dummy mounted on a salvaged rotissierie.
[Floe] has been thinking about this one for quite some time. He finally decided to build his
flame throwing jack-o-lantern
, a concept we approve of. Using two servos, one to start a pilot light and one to spray a travel deodorant, it is pretty simple. He used a ceramic jack-o-lantern so it would be sturdy enough, and marginally less flammable.
Here’s a safer Jack-o-lantern for you. [Paul] wrote in to show us his LED synchronized Jack-o-lanterns. While they may not be ground breaking, we just love seeing that logo out in the wild. Maybe we’re just egotistical, maybe those toothpicks just brought back
fond memories
. Why didn’t we ever run that Jack-0-lantern carving contest? Oh well, maybe next year. You can see a video of it in action after we get it uploaded correctly to our youtube channel. | 12 | 11 | [
{
"comment_id": "205897",
"author": "Bill",
"timestamp": "2010-10-31T18:18:31",
"content": "Video was taken down:“This video contains content from mahalo.com, who has blocked it on copyright grounds.”",
"parent_id": null,
"depth": 1,
"replies": [
{
"comment_id": "205909",
... | 1,760,377,346.286788 | ||
https://hackaday.com/2010/10/31/keyboard-concept-uses-magic-trackpad/ | Keyboard Concept Uses Magic Trackpad | Mike Szczys | [
"Peripherals Hacks"
] | [
"apple",
"kernel",
"keyboard",
"linux",
"magic trackpad",
"multitouch",
"nail polish"
] | This is a keyboard alternative
that [Sebastian] is building from two Apple Magic Trackpads. The multitouch devices are a good platform for this because they’re designed to pick up several events at the same time. To prototype the locations of the keys he’s using printable transparency sheets. He gives you a sense of where the home row is with a dab of clear fingernail polish that you can feel with your digits.
He may laser etch these pads once the key location is just right. This should give a bit of texture in itself and do away with the need for nail polish but we still like the ingenuity of that solution. The device is being developed in Linux, with some kernel hacking to handle the devices. We asked about source code and [Sebastian] is hesitant to post it because he’s been getting a lot of kernel panics. It sounds like once he cleans things up a bit he’ll share his work.
Don’t forget, there’s
an easy hack to do away with the batteries
in these things. | 6 | 6 | [
{
"comment_id": "205876",
"author": "Anonymous",
"timestamp": "2010-10-31T16:35:08",
"content": "Two $70 trackpads to emulate a keyboard?",
"parent_id": null,
"depth": 1,
"replies": []
},
{
"comment_id": "205890",
"author": "the_author",
"timestamp": "2010-10-31T17:41:58"... | 1,760,377,346.454889 | ||
https://hackaday.com/2010/10/31/hackaday-links-october-31-2010/ | Hackaday Links: October 31, 2010 | Mike Szczys | [
"Hackaday links"
] | [
"coat",
"Halloween props",
"led",
"logo",
"skull",
"star wars",
"twitter"
] | Happy Halloween to one and all. Let’s celebrate the holiday with some related links.
[Brandon] carved
the Hackaday logo into his Jack-‘o-Lantern
. But that’s not all, inspired by
EMSL’s Jack-‘o-Lantern
, as well as
our own offering
, he added LEDs. Three of them occupy the flesh behind the eyes and nose, fading in and out thanks to some pulse-width modulation that an Arduino provides.
Mad Scientist Blinken Costume
[Bill Porter] is getting down with the LEDs by making
a Mad Scientist costume
. The accent jewelry is an LED matrix necklace that he made himself to go along with 76 of them sewn into the coat. Also joining the party is over one hundred feet of wire and two Arduinos.
Dole Out Candy Via Twitter/Phone
Apparently [Noel Portugal] will be too busy hacking together his next project to dish out candy on Halloween. To make up for his double-booked schedule
he built an automated candy dispenser
. Just tweet your request and the bucket will open a hatch from which candy will fall. There’s also an option to activate it with a voice call, or just slap that red button until your blood sugar reaches an adequate level.
Star Wars Pumpkins
[Charles Gantt]
carved Yoda’s mug into his pumpkin
and backlit it with green LEDs. Someone else paired two together for a
Death Star shoots Alderon
scene [via
Reddit
]. If those aren’t enough for you there’s a Star Wars top 10 collection
out there somewhere
.
Now go start working on next year’s props! | 8 | 8 | [
{
"comment_id": "205850",
"author": "Ben Wright",
"timestamp": "2010-10-31T15:37:51",
"content": "Yoda didn’t look like a hack. Thats a stencil out of the Star Wars pumkin carving book. I would of liked to see more halloween insprired hacks this year.",
"parent_id": null,
"depth": 1,
"r... | 1,760,377,346.584482 | ||
https://hackaday.com/2010/10/31/halloween-props-voice-changing-daft-punk-costume/ | Halloween Props: Voice-changing Daft Punk Costume | Mike Szczys | [
"home hacks"
] | [
"arduino",
"daft punk",
"dsp",
"Halloween props",
"helmet",
"r-2r"
] | [Dr. West] shared his Halloween costume with us; a
Daft Punk inspired voice-changing helmet
. He stared with a motorcycle helmet, cutting out a hole in the back for a sub-woofer speaker. Inside there’s an old computer mic and the amp circuitry for a portable stereo system. An Arduino is used to pick up the wearer’s voice from the microphone and perform the digital signal processing. Once the alterations have been made the signal is sent to an R-2R resistor ladder to perform the digital to analog conversion, and onto the amp for broadcast. Hear the result in the video after the break.
The rest of the helmet is window dressing. He found some kind of auto-body repair product called flex-edging to use as metallic hair. Those fins are accented with strings of red and blue LEDs. The faceplate finishes the look using speakers from the stereo system and a tinted visor.
He wan’t going for a replica, but we think his creation would be right at home with
the look of the original
.
[youtube=http://www.youtube.com/watch?v=5jK7iwLZVwY] | 6 | 6 | [
{
"comment_id": "205814",
"author": "coolty",
"timestamp": "2010-10-31T13:33:39",
"content": "oh god what.",
"parent_id": null,
"depth": 1,
"replies": []
},
{
"comment_id": "205818",
"author": "loans",
"timestamp": "2010-10-31T13:52:22",
"content": "i bet that’s weird... | 1,760,377,346.496103 | ||
https://hackaday.com/2010/10/30/building-the-banana-jr-6000/ | Building The Banana Jr. 6000 | Mike Szczys | [
"Mac Hacks"
] | [
"apple",
"banana jr. 6000",
"bloom county",
"mini",
"plus"
] | [John’s] latest build strikes a chord of nostalgia by
realizing the Banana Jr. 6000
. The whimsical hardware is
the product of the Bloom County comic strip
. It first appeared in 1984, the same year as the Macintosh. [John] used a Mac Plus as the case but completely revamped the insides. An 8″ touchscreen takes the place of the original cathode ray tube. There’s also a Mac Mini and a couple of speakers salvaged from other Macs. To get things looking just right he altered the case’s logo, painted it yellow, and even altered the Leopard operating system. Now when you boot up you’ll see a Banana and not a partly consumed
pomaceous fruit
.
[Thanks Captain DaFt] | 15 | 15 | [
{
"comment_id": "205444",
"author": "mjrippe",
"timestamp": "2010-10-30T23:29:00",
"content": "As one who fondly remembers both Bloom County and the birth of Macintosh, I give this three thumbs up!",
"parent_id": null,
"depth": 1,
"replies": []
},
{
"comment_id": "205468",
"a... | 1,760,377,346.663222 | ||
https://hackaday.com/2010/10/30/tv-out-for-ti-calculators-using-the-link-port/ | TV Out For TI Calculators Using The Link Port | Jakob Griffith | [
"Peripherals Hacks"
] | [
"calculator",
"link port",
"ti",
"TI-Presenter",
"tv"
] | Do people enjoy wasting 300$ on a bulky convoluted system, that only works for special “Teacher Edition” calculators, and is several years out of date; E.G. the TI-Presenter? [Benryves] certainly
does not
. So instead of purchasing a TI-Presenter, he made his own
TV out system
for the TI brand of calculators by using an ATmega168, a few passive components, and some clever code. The only draw backs being: you save 280$, it fits in your pocket, and it works for almost any TI calculator.
Bias aside
, the system does actually have a few caveats compared to the commercial edition, but the pros far outweigh the cons. | 19 | 19 | [
{
"comment_id": "205408",
"author": "Michael Bradley",
"timestamp": "2010-10-30T22:13:51",
"content": "Just curious, how is it showing on a VGA monitor? Does that monitor have NTSC in? I realy need to read the whole thing probly",
"parent_id": null,
"depth": 1,
"replies": []
},
{
... | 1,760,377,347.035633 | ||
https://hackaday.com/2010/10/30/beginner-concepts-electronics-basics-from-the-giz/ | Beginner Concepts: Electronics Basics From The Giz | Mike Szczys | [
"Misc Hacks"
] | [
"beginner concepts",
"electronics",
"gizmodo. university"
] | Gizmodo University is open for business. This free educational series aims to
educate about the basics of electronic theory
. No prerequisite knowledge needed and they’re starting from the ground level. First lesson? Resistors! From there they’ve posted about voltage dividers, series/parallel circuits, Ohm’s law, and how to calculate a resistor value for an LED.
This is a great way to get the base knowledge that you need to start hacking like an EE. These are concepts that we assume you have already mastered if you’re following along with
our AVR Programming series
. We’re hard at work on part three but that’s still a little ways off. You’ve got time to do a review a GizU and reread
our favorite book on electronic theory
. | 7 | 7 | [
{
"comment_id": "205410",
"author": "sweet",
"timestamp": "2010-10-30T22:19:00",
"content": "nice idea for beginers",
"parent_id": null,
"depth": 1,
"replies": []
},
{
"comment_id": "205426",
"author": "Ajaxx",
"timestamp": "2010-10-30T22:39:20",
"content": "Thanks fo... | 1,760,377,346.978939 | ||
https://hackaday.com/2010/10/30/ignore-uop-on-the-osx-dvd-player/ | Ignore UOP On The OSX Dvd Player | Mike Szczys | [
"home entertainment hacks",
"Mac Hacks"
] | [
"dvd",
"leopard",
"OsX",
"playback",
"snow leopard",
"tiger",
"uop"
] | If you’ve been frustrated by the inability to skip past parts of DVDs on OSX the here is one solution. It’s a patch script that uses some binary hacking to
remove the User Operation Prohibition locks from DVD playback software
. Using
UOP flags
is a way to force users to watch trailers or warnings as part of the DVD experience. This script can patch Tiger, Leopard, and Snow Leopard systems. It also has the ability to generate diagnostic information for other installations that will lead to expanded support in the future. | 13 | 13 | [
{
"comment_id": "205302",
"author": "thebulbguy",
"timestamp": "2010-10-30T18:16:02",
"content": "Yet another reason I still watch laserdiscs…",
"parent_id": null,
"depth": 1,
"replies": []
},
{
"comment_id": "205307",
"author": "UltraMagnus",
"timestamp": "2010-10-30T18:... | 1,760,377,346.782691 | ||
https://hackaday.com/2010/10/30/this-is-a-peer-to-peer-filesharing-network/ | This Is A Peer-to-peer Filesharing Network | Mike Szczys | [
"Misc Hacks"
] | [
"filesharing",
"flash drive",
"network",
"peer2peer",
"usb"
] | [Aram Bartholl] is
building his own filesharing network
that screws those fat cats who want to control your freedom. He’s added file cache devices throughout NYC (five so far but more to come) that are anonymous and free to use. Upload what you want, download what you want. They’re completely offline which means monitoring who’s doing what gets a lot harder and quite possibly requires a warrant from a Judge (we’re obviously not legal experts, your mileage may vary).
As for the slew of comments that are sure to point out the dangers of malicious USB device; We think everyone knows they’re taking on some risk when connecting to a USB plug protruding from a brick wall.
[Thanks Neckbeard] | 116 | 50 | [
{
"comment_id": "205193",
"author": "Mike Szczys",
"timestamp": "2010-10-30T15:51:03",
"content": "I’m in love with this idea.",
"parent_id": null,
"depth": 1,
"replies": []
},
{
"comment_id": "205194",
"author": "Nippey",
"timestamp": "2010-10-30T15:53:37",
"content"... | 1,760,377,346.866899 | ||
https://hackaday.com/2010/10/29/bbb-1-the-santa-pede-challenge/ | BBB #1: The Santa-pede Challenge | Caleb Kraft | [
"contests"
] | [
"contest",
"recycle",
"upcycle"
] | Welcome to the first
Buy Break Build
at hackaday, sponsored by
Adafruit Industries
and
Make
. This challenge will be focusing on dancing Santas, or what is inside them. We’ve seen them everywhere, and may even have one or two in an attic somewhere. These annoying little guys should have enough bits and pieces inside to build some pretty interesting stuff. This time, we want to see a multi-legged walking device. We don’t care if it has 2 legs, 7 legs, or 32 legs, as long as it “walks” using its legs.
Join us after the break for the rules, the prize breakdown, and to find out who the guest judge will be!
The challenge:
Acquire a
dancing Santa
. We don’t care which one it is, how much you spend, how big it is etc. We know there are tons of models out there ranging from dancing Christmas [Homer Simpson] to giant life sized Santa. It might be a good idea to do some patent searches first to figure out what is inside. Here’s an example of what you can find (
pdf
).
Tear the Santa apart and use the pieces to build a multi legged walking thing. There are
tons of
ways
to pull this off
. Try to use only the pieces that came from the Santa. You may add tape/glue and solder (as well as batteries). We realize that you may absolutely have to add some stuff to get your plan working. Please document exactly what you added as this will be one of the judging points.
Photograph and document the entire process and
submit it to us
by
November 30th
.
Judging:
Your entries will be judged by the Hackaday staff, as well as our guest judge [Phillip Torrone]. For those who are unfamiliar,
[Phillip] was the founder of Hackaday
. Judging will be based on the final result, the presentation, how many external parts were used, and how well it is documented.
There will be three winners chosen, each with their own strong point.
The best result:
This project will walk somewhat efficiently using the least amount of external parts. We’re going for function over form on this one.
The best presentation:
Your walking machine will look fantastic. Your cuts are smooth, your motion is fluid, your photos are delightful… maybe it doesn’t work that well, but it looks great.
The most overkill:
So you decided to put a 6hp Briggs and Stratton engine in there instead of following the rules and you managed to make it actually work. What’s that? You also programmed it to retrieve frosty beverages? Sweet! We’ll give you an award for that.
Prizes:
The prizes for the Santa-pede challenge have been supplied by
Adafruit Industries
and are as follows.
Best Result:
The Mintyboost
. The Mintyboost is a battery charger for your mobile devices. Just plop 2 AA batteries into the nifty altoids tin case and you’re ready to start charging.
Best Presentation:
The Drawdio
. A peculiar instrument that makes noise based on the motion of the writing utensil you’ve attached it to.
Most Overkill:
The Brain Machine
. A set of glasses that flashes pulses of light into your eyes. The claim is that it can put you into a meditative state by synchronizing your brainwaves. We just think they look cool.
We will also be choosing one out of the above three to win a box set of the first year of Make Magazine courtesy of the
makershed.com
. This decision will be based on a whim mostly, but will probably go to the person who does the best in more than one category.
FAQ:
–this will be updated as people as questions. It’s our first, so there will be a few —
How many times can I enter?
You can enter as many times as you want. We don’t mind.
Can I melt the plastic to completely change the shape?
Absolutely. That sounds awesome.
What should I submit to you, a pdf? a website?
We’re pretty open to what you give us. Ultimately, we want to post your writeup on hackaday so a pdf or word document would work. We won’t turn down other formats though. Keep those original pictures though. We don’t want to have to pull them out of a document if we re-publish yours! | 33 | 28 | [
{
"comment_id": "204795",
"author": "Tom",
"timestamp": "2010-10-29T19:19:25",
"content": "Bonus points if the final result resembles an evil multi-legged robo-santa",
"parent_id": null,
"depth": 1,
"replies": [
{
"comment_id": "204797",
"author": "Caleb Kraft",
... | 1,760,377,346.734304 | ||
https://hackaday.com/2010/10/29/exercise-along-to-google-street-view/ | Exercise Along To Google Street View | Mike Szczys | [
"home hacks"
] | [
"bicycle",
"bike",
"exercise",
"stationary",
"street view"
] | As part of a Master’s Thesis [Lette Moloney]
made this exercise bike control Google Street View
. The hardware setup is quite rudimentary, two hall effect sensors mounted next to each other detect a magnet that was hot-glued to the crank. When the magnet passes the sensors an Arduino establishes if it was a forward or backward stroke based on which sensor was tripped first. From there a keystroke is issued to
Google Street View
to move the virtual location accordingly.
One thing we didn’t expect until we saw the video (embedded after the break) is that traversing street view is not a smooth experience. It’s more of a slide show as you exercise. Not a big deal since the hardware setup can be reused with different virtual stimuli. One thing that comes to mind is attaching a camera to the handlebars of your bike and recording your favorite rides during the warm months so that you can replay them during your indoor winter training. Of course that’s going to require some coding to marry the Arduino data to the speed of the video playback but we want to see it done anyway. Wow, image a database that would allow folks to share point-of-view videos of their rides… it’s the only way we’d ever get to see what it’s like to climb your way up
Alpe_d’Huez
.
We saw a slew of these stationary bike hacks a while back. If this wets your appetite, check in on
one with a wearable display
, another that
also uses Street View
, or
pedaling to the top of a miniature mountain
.
[youtube=http://www.youtube.com/watch?v=DrUp6oKOABc] | 28 | 28 | [
{
"comment_id": "204763",
"author": "Erik Johnson",
"timestamp": "2010-10-29T18:27:40",
"content": "@Dex Why would you be spending money on a fuckbuddy? I think you need to learn the difference between one of those and a girlfriend.Anyway, wasn’t this posted ages ago?",
"parent_id": null,
"... | 1,760,377,346.933204 | ||
https://hackaday.com/2010/10/29/maze-solving-robo-mouse/ | Maze-solving Robo Mouse | Mike Szczys | [
"Robots Hacks"
] | [
"maze",
"mouse",
"RACE",
"speed"
] | Looking for something to build that will be challenging and interesting to laypersons at the same time? Take some inspiration from this
maze-solving robot mouse
. It take the idea of a line-following robot, and makes it infinitely more cool. The tiny rover uses sensors to map out a physical maze. Once it figure it out, you put it back at the beginning for a speed run to the finish. We’ve embedded the video below showing the whole process. Looks like the speed-run is completed in just under five seconds.
Now that you’ve enjoyed a virtual mouse in a real maze, check out
a real mouse in a virtual maze
.
[youtube=http://www.youtube.com/watch?v=FzBwnsnxFGU]
[Thanks Bemental] | 18 | 18 | [
{
"comment_id": "204729",
"author": "Squirrel",
"timestamp": "2010-10-29T17:20:15",
"content": "I’d like to see some more specs on that mousie. Like what type of sensors it uses, how it handles slip etc during its SLAM process (it almost has to be using Simultaneous Localization and Mapping to be a... | 1,760,377,347.088265 | ||
https://hackaday.com/2010/10/29/crutch-mounted-light/ | Crutch-mounted Light | Mike Szczys | [
"digital cameras hacks"
] | [
"crutches",
"flash",
"light",
"photography"
] | [Malikaii] is exercising the hacker spirit inside by
building light stands out of junk
. He’s using them as an alternative to purchasing off-camera flash units. He made this one using a lot of salvaged parts; two crutches make up the frame, a discarded reflector for one of those highway-work floodlights will house the flash, and an old pillow case diffuses the light. The version above can easily be moved around by an assistant, or if you’re shooting solo [Malikaii] also found that the base from an oscillating fan was easy to adapt for use with the crutch frame.
If you’re not able to scavenge these parts perhaps
a folding light tripod
is what you need. | 9 | 9 | [
{
"comment_id": "204713",
"author": "andres",
"timestamp": "2010-10-29T16:30:13",
"content": "from the picture that’s only one crutch to make the frame. of course it doesn’t free stand without that fan base you mentioned.",
"parent_id": null,
"depth": 1,
"replies": []
},
{
"comme... | 1,760,377,347.135897 | ||
https://hackaday.com/2010/10/29/tiny-usb-business-card/ | Tiny USB Business Card | Mike Szczys | [
"Microcontrollers"
] | [
"attiny85",
"AVR",
"business card",
"diode",
"V-USB",
"zener"
] | [Frank Zhao] put together
a USB business card
. It’s even got the instructions printed right on the silk screen of the PCB explaining how it should be used. He based the design around an AVR ATtiny85 microcontroller. It runs the V-USB package that handles USB identification and communication protocols. The rest of the hardware is pretty standard, the uC draws power from the 5V USB rail, with a couple of 3.6V Zener diodes to drop the two data lines down to the proper level.
Once plugged in it waits until it detects three caps lock keypresses in a row, then spews a string of its own keypresses that type out [Frank’s] contact information in a text editor window (video after the break). It’s not as reusable as
the mass storage business card
because [Frank] didn’t breakout the pins on controller. But we still enjoy seeing
business cards that make you stand out
.
This is a great project to tackle with
your newly acquired AVR programming skills
.
[youtube=http://www.youtube.com/watch?v=vX1tDk_iwOo]
[Thanks Harald] | 43 | 43 | [
{
"comment_id": "204671",
"author": "biozz",
"timestamp": "2010-10-29T15:17:55",
"content": "i think the usb would be better on top and shorten the card a bit so it does not snag in the wallet and you can pull it out with a convenient tab :P",
"parent_id": null,
"depth": 1,
"replies": []... | 1,760,377,347.217234 | ||
https://hackaday.com/2010/10/28/buy-break-build-a-hackaday-contest-series/ | Buy Break Build: A Hackaday Contest Series | Caleb Kraft | [
"contests",
"News"
] | [
"break",
"contest",
"prize"
] | We are proud to introduce a new contest here at Hackaday. Buy Break Build will be regular event where we challenge you to make something from something else. We want to work out your hacker brains to come up with inventive ways to use limited parts. We may have a specific product or genre in mind, and a specific out come we would like to get, then we let you guys loose to make it happen. The contests will usually be judged for winners in 3 categories; best presentation, best use of
only
the existing parts, and most massive overkill. You don’t have to be an electronics engineer, or even know how to program a microcontroller. You simply document your entire hack with pictures and notes, then submit it to
BBB@hackaday.com
and we’ll choose the winners. Those winners will be awarded fabulous prizes and Internet fame as we’ll publish your writeup for everyone to enjoy.
Here’s an example to make things a little more clear.
Don’t actually go do this one
, it is just an example.
Contest: Radio controlled faces. Everyone has an old R/C car lying around right? Can you use those parts to make an animatronic face? It doesn’t have to be humanoid, but at least recognizable as a face. There would be 3 winners, the one that made the best use of
only
the included parts, the one that had the best presentation, and the one that went absolutely the furthest overboard.
Remember, this one is just an example, so please don’t run out and get started just yet. We’ll be announcing our first Buy Break Build very soon. | 31 | 30 | [
{
"comment_id": "204313",
"author": "Ivan",
"timestamp": "2010-10-28T20:16:36",
"content": "Cool… 1st!",
"parent_id": null,
"depth": 1,
"replies": []
},
{
"comment_id": "204314",
"author": "mowcius",
"timestamp": "2010-10-28T20:17:06",
"content": "Sounds like fun. Sig... | 1,760,377,347.301376 | ||
https://hackaday.com/2010/10/28/servicing-an-epson-projector/ | Servicing An Epson Projector | Mike Szczys | [
"Repair Hacks"
] | [
"5500c",
"epson",
"powerlite",
"projector"
] | [Socket7] got his hands on a projector that had some color calibration problems. Of course the servicing manual says that there are no technician serviceable parts inside, but
he cracked it open and fixed it
anyway. This is an Epson PowerLite 5500c which was showing blue and yellow bands around the outside of the projected image. He could hear something rattling around inside which happened to be the lenses. It turns out there are foam pads that hold them in place that had shriveled over time. After a bit of careful work he replaced them and now has a working projector.
We’d love to have a projector of our own; there’s a lot of
cool stuff
you can do with them. Fixing a broken one is a great way to get one cheap, [Socket7’s] was free! | 32 | 27 | [
{
"comment_id": "204289",
"author": "Jules",
"timestamp": "2010-10-28T19:14:00",
"content": "I LOVE the what not to do with the adjustment screws! Great write up.Jules",
"parent_id": null,
"depth": 1,
"replies": []
},
{
"comment_id": "204290",
"author": "Dex",
"timestamp"... | 1,760,377,347.481818 | ||
https://hackaday.com/2010/10/28/we-knew-we-were-doomed-when-the-t-shirt-cannon-bots-showed-up/ | We Knew We Were Doomed When The T-shirt Cannon Bots Showed Up | Mike Szczys | [
"Robots Hacks"
] | [
"cannon",
"robot",
"t-shirt"
] | The newest addition to the Skynet armada is this
10-barrel t-shirt cannon
. It’s capable of storming the battlements at over twelve feet per second with a firing rate of three T-shirts per second (ooh, is that cotton?).
The members of Team 254, which is hosted by Bellarmine College Preparatory School, built the robot over the summer. This involved a full production cycle; planning, 3D modelling, acquiring the materials, and finishing the build. All of this is well documented in
their build blog
and for video, check out their
media page
.
We already know
how to customize the T-shirts
for use as ammo, now what this needs is
some tank treads
. | 14 | 14 | [
{
"comment_id": "204272",
"author": "typhon1126",
"timestamp": "2010-10-28T18:11:05",
"content": "These guys are The Cheesy Poofs, a FIRST Robotics Competition team, and they rock!",
"parent_id": null,
"depth": 1,
"replies": []
},
{
"comment_id": "204293",
"author": "Marco",
... | 1,760,377,347.601626 | ||
https://hackaday.com/2010/10/28/software-security-courtesy-of-child-labor/ | Software Security Courtesy Of Child Labor | Mike Szczys | [
"Security Hacks"
] | [
"bounty",
"firefox",
"mozilla",
"security",
"vulnerability"
] | We couldn’t help but poke a little fun in the headline. This is [Alex Miller], a twelve year old who
claimed a $3000 bounty from Mozilla
. See, [Alex] is a self-taught security guru. When
Mozilla upped the reward
for discovering and reporting critical security flaws in their software he went to work searching for one. He estimates that he spent an hour and a half a day for ten days to find the hole. Fifteen hours of work for $3000? That’s pretty good!
Is it good or bad to pay for these kind of submissions? The real question: Is the bounty high enough to get blackhats to report vulnerabilities, rather than selling software that exploits them? Let us know what you think in the comments.
[via
Zero Day
] | 34 | 33 | [
{
"comment_id": "204244",
"author": "biozz",
"timestamp": "2010-10-28T17:04:44",
"content": "god damn i thought i started young XDhe is second only to zero-cool XP",
"parent_id": null,
"depth": 1,
"replies": []
},
{
"comment_id": "204245",
"author": "Gdogg",
"timestamp": ... | 1,760,377,347.552098 | ||
https://hackaday.com/2010/10/28/hacking-a-disobedient-act-that-drives-change/ | Hacking: A Disobedient Act That Drives Change | Mike Szczys | [
"Misc Hacks"
] | [
"corey doctorow",
"disobedience",
"eula",
"warranty"
] | [Adam Dachis] published an essay a couple of days ago called
Why We Hack
. In it he discusses the outlook that hacking, on all of its various levels, is a simple form of disobedience. We have to agree with him. Manufacturers would like you to think that voiding the warranty is as good as smashing the product to bits. But we all know that if you can’t crack it open you don’t really own it. [Adam] says we can sit around and complain about it, or we can do better. So crack it open, dump the firmware, and make it do your bidding.
If you haven’t already seen it, you should also go back and
watch [Corey Doctorow’s] keynote address from Toorcon 8
. He discusses freedom of information and hits especially hard on End User License Agreements (
EULA
) and the ills they cause. We’ve never seen someone hit the target quite as well as he does in this fantastic speech. | 16 | 16 | [
{
"comment_id": "204223",
"author": "Brennan",
"timestamp": "2010-10-28T16:14:23",
"content": "@TomasitoI came to the comments to post the exact same thing. Seriously HAD writers, if you’re only writing one or two paragraphs about a link, PROOF READ IT. It literally takes a minute to read over and i... | 1,760,377,347.655353 | ||
https://hackaday.com/2010/10/28/artisans-asylum-takes-on-the-machine/ | Artisans Asylum Takes On The Machine | Jakob Griffith | [
"Misc Hacks"
] | [
"artisans asylum",
"breakfast",
"machine",
"wallace and gromit",
"yum"
] | You’ll probably lose your appetite after watching
part one
and
part two
of Artisans Asylum as they Take on the Machine. Based around the Wallace and Gromit “automated”
set of contraptions
, the team from Boston set out to make their own
breakfast machine
. Of course, with only three weeks to work it didn’t exactly turn out as planned. They certainly had some good ideas though, and we were amazingly impressed at their egg cracking machine. But in the end, we wouldn’t want to be first in line for a plate of breakfast. Next is the final team, The Transistor, who will be making a live action zombie video game.
[Thanks Deven] | 6 | 6 | [
{
"comment_id": "204173",
"author": "Mason.moore",
"timestamp": "2010-10-28T14:12:41",
"content": "First. Haha.I’m hungry. And I wish I had breakfast machine. Maybe I’ll try at this.",
"parent_id": null,
"depth": 1,
"replies": []
},
{
"comment_id": "204176",
"author": "uze... | 1,760,377,347.701062 | ||
https://hackaday.com/2010/10/27/unreal-speaker-build/ | Unreal Speaker Build | Mike Szczys | [
"digital audio hacks"
] | [
"concrete",
"lathe",
"odyssey 2",
"speakers",
"stereo"
] | These speakers are hand made and almost one of a kind. [Lluís Pujolàs] didn’t come up with the original design, but he sure did an amazing job of crafting them, including
an eleven page build log
(
translated
). They’re called the Odyssey 2, after the original design. The shell-shaped cavity on the bottom was built as a wooden skeleton first, then covered over for the finished shape. But the mid and high range enclosures were turned on a lathe from wood glued-ups. A serious machine shop is necessary to do this kind of woodworking. The bases are poured concrete, impregnated with lead beads to help with vibration isolation. At 330 pounds each it’s understandable that he tested them on wheels before parking them in their final position as seen above.
[Thanks Neorazz] | 50 | 50 | [
{
"comment_id": "203783",
"author": "grenadier",
"timestamp": "2010-10-27T21:03:46",
"content": "Oh. My. God.",
"parent_id": null,
"depth": 1,
"replies": []
},
{
"comment_id": "203786",
"author": "Grovenstien",
"timestamp": "2010-10-27T21:07:13",
"content": "Uh humm!!... | 1,760,377,347.784201 | ||
https://hackaday.com/2010/10/27/power-supplies-and-transformers-a-learning-experience/ | Power Supplies And Transformers; A Learning Experience | Mike Szczys | [
"Misc Hacks"
] | [
"ac",
"converter",
"dc",
"transformer",
"tutorial"
] | [Ladyada] is working on
a tutorial series covering power supplies
. If you’ve ever built an electronic project you’ve used some type of power supply but we think that most people have no idea how you get from mains power to the DC voltages that most small projects use. So if you want to learn, get started with the first installment which
covers AC/DC converters
based on a transformer like the one seen above.
These transformers are inside the heavy and hot wall-wart plugs that come with many electronics. We used one along with a breadboard power supply when
building the pumpkin LED matrix
. They use a pair of coils to step down the voltage to a much smaller level. From there it’s a matter of rectifying the AC into DC power, which she talks about in an easy to follow discussion.
We understand this type of converter quite well but we’re a bit foggy on switch-mode AC/DC converters that don’t use a transformer. They’re much better because you don’t have to build a regulator into the target project like you do with wall-warts. Can’t wait until she gets to that part of the series! | 38 | 37 | [
{
"comment_id": "203769",
"author": "Jim",
"timestamp": "2010-10-27T20:21:46",
"content": "So my first job involved switching DC/DC converter design, in fact, that’s all I did. It’s really not hard, but it can be quite difficult to do without a proper PCB and a good layout. The easiest thing to do... | 1,760,377,347.859155 | ||
https://hackaday.com/2010/10/27/halloween-props-borg-costume/ | Halloween Props: Borg Costume | Mike Szczys | [
"home hacks"
] | [
"borg",
"costume",
"Halloween props",
"star trek"
] | The Halloween hacks are rolling in late this year, but we’re delighted to see that [DJ Sures] finished
his borg costume
in time. It is made up of a hodge-podge of items from different cultures… oh wait, so are the borg. These include a set of hockey pads spray painted black with just a light misting of silver to give them some depth. After taking the image above (which mostly shows off his makeup) [DJ Sures] added an LCD screen to the chest plate and lighted electronics throughout. See for yourself after the break.
If you liked this you might take a look at his
singing spark plug
.
[youtube=http://www.youtube.com/watch?v=exbADVDdfKw] | 17 | 17 | [
{
"comment_id": "203753",
"author": "space",
"timestamp": "2010-10-27T19:23:19",
"content": "Will it assimilate?",
"parent_id": null,
"depth": 1,
"replies": []
},
{
"comment_id": "203759",
"author": "Ryan",
"timestamp": "2010-10-27T19:46:07",
"content": "Very cool cos... | 1,760,377,347.915206 | ||
https://hackaday.com/2010/10/26/tanks-treads-for-your-next-robot/ | Tanks Treads For Your Next Robot | Mike Szczys | [
"Robots Hacks"
] | [
"bicycle",
"bike",
"chain",
"tank",
"tread"
] | If you ever wanted to incorporate tank treads into one of your build
you should check out this guide
. The method shown above is our favorite, which uses rubber fuel line hose and #10 machine bolts to hold together two lengths of hollow-pin roller chain. You can see the drive sprocket is keyed into the outer length of chain but the wheels that distribute the vehicle’s weight rest on the rubber tubing. You’ll also find details on building hinged track, molded track, plastic conveyor track, treadmill track, and bicycle chain construction. This should cut down on development time when you finally get around to making that
paintball tank
.
[Thanks BoKu] | 16 | 16 | [
{
"comment_id": "203160",
"author": "Giorgos Lazaridis",
"timestamp": "2010-10-26T16:26:05",
"content": "Awesome idea! I feel that i will use this idea myself",
"parent_id": null,
"depth": 1,
"replies": []
},
{
"comment_id": "203165",
"author": "Life2Death",
"timestamp": ... | 1,760,377,347.970759 | ||
https://hackaday.com/2010/10/26/ethernet-connection-using-capacitive-coupling/ | Ethernet Connection Using Capacitive Coupling | Mike Szczys | [
"Misc Hacks"
] | [
"capacitive",
"ethernet",
"magnetics",
"network",
"switch"
] | Wanting to save space and weight on his project build [Florin] set out to find a way to
add Ethernet connectivity without the magnetics
. His ill-advised first try involved directly coupling two switches, frying both in the process. After some research he found that Ethernet hardware manufacturers have considered the need for devices without the magnetics and there are several application notes available on the subject. [Florin] followed the information that Realtek has for their devices and learned that they can be couple capacitively. After depopulating the magnetics from a second pair of switches he wired up some resistor-capacitor networks on a breadboard and got the connecting to work. | 26 | 26 | [
{
"comment_id": "203141",
"author": "andrew",
"timestamp": "2010-10-26T15:21:54",
"content": "It would be nice to include a line or two about how or why ethernet connections require magnets; I had no idea they did.",
"parent_id": null,
"depth": 1,
"replies": []
},
{
"comment_id":... | 1,760,377,348.033624 | ||
https://hackaday.com/2010/10/26/pc-game-controller-with-a-touch-of-class/ | PC Game Controller With A Touch Of Class | Jakob Griffith | [
"home entertainment hacks",
"Peripherals Hacks"
] | [
"controller",
"game",
"keyboard",
"men of war",
"pc",
"pic",
"ps2"
] | The above is a
specially designed game controller
made by [Giorgos] solely for the RTS game Men Of War (now that’s dedication to a game). [Giorgos] started off with a rough breadboard and 11 buttons. Slowly overtime he included a joystick, countdown timers, and the wonderfully lit case. Under the hood is a couple of PIC microcontrollers multiplexing the switches, LEDs, timers, and also interfacing with the computer via
how is it not dead yet
PS/2 port.
The build log
is a very detailed read and well worth it, even if you’re not planning on making a custom controller.
[Ben Heck]
better watch out, there is a new controller making enthusiast on the loose. | 23 | 23 | [
{
"comment_id": "203119",
"author": "Mr. Sandman",
"timestamp": "2010-10-26T14:26:07",
"content": "reminds me of a Belkin Nostros (or however its spelled)pretty neat.",
"parent_id": null,
"depth": 1,
"replies": []
},
{
"comment_id": "203120",
"author": "asdf-chan",
"times... | 1,760,377,348.919343 | ||
https://hackaday.com/2010/10/25/rc-controlled-camera-takes-intimate-video-of-rodents/ | RC Controlled Camera Takes Intimate Video Of Rodents | Mike Szczys | [
"Video Hacks"
] | [
"AVR",
"radio controlled",
"rc",
"recorder",
"sd",
"video"
] | [Leor] wanted to take some video of the wildlife in his yard, like this chipmunk or some hummingbirds, but every time he tried to get close it scared them away. His solution was to
rig up a cheap video recorder to be radio controlled
(PDF). The donor camera was a cheap SD card based eBay purchase that takes 720×480 video. [Leor] removed the SMD switches from the recorder’s PCB and wired up a 4066 quad bi-lateral switch IC in its place. An RC toy car donated the receiver transmitter pair. The receiver signals are monitored by an AVR microcontroller which translates the commands in a proper set of button presses for the video. What you get is a controller that and turn the camera on and set to the proper mode, and the ability to start and stop the recording.
We’ve got some pics of the hardware after the break, and [Leor] posted
a bit of the chipmunk video
for your enjoyment.
The component boards (click to enlarge):
Inside the enclosure:
Finished product: | 27 | 27 | [
{
"comment_id": "202801",
"author": "biozz",
"timestamp": "2010-10-25T22:59:21",
"content": "well cheaper than a telephoto lens i guess",
"parent_id": null,
"depth": 1,
"replies": []
},
{
"comment_id": "202807",
"author": "bioss",
"timestamp": "2010-10-25T23:14:05",
"... | 1,760,377,348.415727 | ||
https://hackaday.com/2010/10/25/gas-containment-for-laser-cutters/ | Gas Containment For Laser Cutters | Mike Szczys | [
"Laser Hacks"
] | [
"gases",
"jeri ellsworth",
"laser",
"silicone",
"vent",
"wafer"
] | Tired of breathing all the noxious fumes your laser cutter puts out? Yeah… we don’t have a laser cutter either. But [Jeri Ellsworth] does and she needed a way to evacuate off-gases generated during cutting so that they don’t damage the laser cutter, or her lungs. What she came up with is
a containment box that attaches to a pump system
.
The problem is that you want to keep the gases away from the laser cutter hardware but you still need to be able to shoot the laser at your work material. Her clever solution is to use a silicone wafer like the ones with which she makes
integrated circuits
. They allow the infrared laser to pass through without being chopped in half. What you see in the image above is a red box with the round wafer in the center. Near the bottom of the image is a clear window so you can see what’s going on with your work piece. But to get the full idea you need to watch the video embedded after the break.
We can’t help but think she’s building this in preparation for some
more chemistry hacking
.
[youtube=http://www.youtube.com/watch?v=eGJ2WZRdUPA] | 27 | 27 | [
{
"comment_id": "202742",
"author": "Juan Cubillo",
"timestamp": "2010-10-25T21:07:48",
"content": "Cool trick using the silicon wafer… but… can’t you just stick a computer fan on one end of the cutter and an air opening at the other side of the “printing” area space? Run a small pipe into a nearby ... | 1,760,377,348.352644 | ||
https://hackaday.com/2010/10/25/firesheep-promoting-privacy-in-a-scary-way/ | Firesheep: Promoting Privacy In A Scary Way | James Munns | [
"Security Hacks",
"Software Hacks"
] | [
"extension",
"facebook",
"firefox",
"firesheep",
"flickr",
"plugin",
"twitter"
] | Often, software hackers are the activists that push software giants towards updating vulnerable applications. In todays example, [Eric Butler] is
pushing Facebook, Twitter, Flickr, and more
all at the same time. By creating a
user
script-kiddie friendly extension for Firefox, he has allowed just about anyone to sniff unsecured connections on public Wi-Fi access points and log into these unprotected accounts.
Right now
the extension
is available for Windows and Mac, with a Linux port coming soon. Temporarily, the best way for a user to avoid getting taken advantage of would be to not use these social networking sites on a public connection, or to implement a secure proxy for these connections that would keep your data safe. Hopefully these websites will have a quick rebuttal that allows for security without workarounds. With all of the bad press they are recieving, they certainly have incentive to.
Are there any software or security buffs out there? We would love to see someone port this to an iPhone or
Android app
that could check and log open Wi-Fi points. We’ll leave the foot work to the experts out there, but do be sure to give us a heads up if anyone manages to make it happen, okay? | 50 | 49 | [
{
"comment_id": "202713",
"author": "really?",
"timestamp": "2010-10-25T20:17:13",
"content": "“By creating a user script-kiddie friendly extension for Firefox, he has allowed just about anyone to sniff unsecured connections on public Wi-Fi access points and log into these unprotected accounts.”“We ... | 1,760,377,348.286158 | ||
https://hackaday.com/2010/10/25/fully-customized-robots/ | Fully Customized Robots | James Munns | [
"Robots Hacks"
] | [
"3d",
"printing",
"robot",
"robots"
] | i.materialise, a custom 3D printing fabrication house are
looking for talented robotics enthusiasts
with the skills to design custom robotics parts such as functional frames, decorative shells, as well as unique parts required by robots to look and perform their best. The best part? They are offering free 3D printing of parts to the people they select with the most interesting or useful ideas. Make sure you check out their blog for details on what they are looking for and how to enter, as well as checking out some of the other cool things they do, such as a fully customizable
3D printed frisbee
. Let us know what you design, we would love to show it off!
[via
Robots-Dreams
] | 8 | 8 | [
{
"comment_id": "202681",
"author": "Ben",
"timestamp": "2010-10-25T19:22:59",
"content": "…medabots?",
"parent_id": null,
"depth": 1,
"replies": []
},
{
"comment_id": "202682",
"author": "walt",
"timestamp": "2010-10-25T19:23:52",
"content": "looks awesome. wonder ho... | 1,760,377,348.617165 | ||
https://hackaday.com/2010/10/27/halloween-props-talking-skeleton-in-reaper-robes/ | Halloween Props: Talking Skeleton In Reaper Robes | Mike Szczys | [
"home hacks"
] | [
"arduino",
"Halloween props",
"reaper",
"skeleton",
"wav shield"
] | Here’s a great way to guard your front door on Halloween. [Sam Seide] built
a motion controlled talking skeleton
. The electronics are fairly straight forward, consisting of an Arduino, WAV shield, PIR motion sensor, servo motor for the jaw, and a couple of red LEDs for the eyes. But [Sam] did some really neat things in the design of the skeleton itself. As we saw with
the puking pirate
, he built the body out of PVC so that he can take it apart for easy storage. Under the reaper robe you’ll find a set of powered computer speakers that connect to the WAV shield. The servo motor is mounted in the skull and moves the jaw using a small wire arm. Since the whole thing is a bit flexible (thanks to the PVC), the torque of the motor causes the skeleton to move around, adding a touch of life. Don’t miss the well-made video walkthrough after the break.
[youtube=http://www.youtube.com/watch?v=GpKBXUxfMPI]
[via
Hack N Mod
] | 11 | 11 | [
{
"comment_id": "203732",
"author": "sam seide",
"timestamp": "2010-10-27T18:09:58",
"content": "Thanks for posting this! Be sure to check out the other halloween vids I put up on building tombstones, pvc candles, and my huge cemetary caretaker costume I’ll be wearing in my front yard this hallowee... | 1,760,377,348.574699 | ||
https://hackaday.com/2010/10/27/smallest-gaming-console-ever-ever/ | Smallest Gaming Console Ever. EVER! | Mike Szczys | [
"Microcontrollers"
] | [
"arm",
"cortex m0",
"game console",
"RBox",
"rossum"
] | That’s it… the
controller and the video game system
all in one. This is the standalone version of [Rossum’s] RBox.
We looked in on the prototype in June
but that was using a bulky development board. You can see the CR1632 button battery, which powers the device for about four hours, sandwiched in between the joystick and the mainboard. Exiting the image on the right are cables used to connect mono-audio and video to a TV via RCA connectors. There’s no port for interchangeable cartridges which means that all game data must be programmed into the ARM Cortex M0 processors. See [Rossum’s] demo video after the break.
[youtube=http://www.youtube.com/watch?v=r-Mdt6uzmOg] | 26 | 26 | [
{
"comment_id": "203697",
"author": "biozz",
"timestamp": "2010-10-27T16:13:58",
"content": "impressively small and impressively simple",
"parent_id": null,
"depth": 1,
"replies": []
},
{
"comment_id": "203700",
"author": "s133p",
"timestamp": "2010-10-27T16:24:30",
"... | 1,760,377,348.751832 | ||
https://hackaday.com/2010/10/27/almost-free-robo-mower/ | Almost Free Robo Mower | Caleb Kraft | [
"contests"
] | [
"make",
"mower"
] | We’ve always felt that the hacker community is a unique one. Make reader [Gnomic] is reinforcing that feeling by running his own contest with unused equipment.
[Gnomic] is offering a free Robot lawnmower to someone, as long as they send the completed project writeup to Make
. The mower is a Robomower RL 850 and you have to pick it up in Richmond Va. To enter, you have to email [Gnomic] your proposal within the next 10 days. He will then choose what he feels would be the most interesting one to give the mower to. We’d love to see one of our readers get in on the action with this one. We would really love to see our logo on the final robot when it gets published to Make. | 12 | 11 | [
{
"comment_id": "203689",
"author": "biozz",
"timestamp": "2010-10-27T15:24:31",
"content": "i wonder how he got so many mowers that he was willing to give them away O_oand why mowers? XD",
"parent_id": null,
"depth": 1,
"replies": []
},
{
"comment_id": "203690",
"author": "J... | 1,760,377,348.801977 | ||
https://hackaday.com/2010/10/26/70-led-matrix-in-a-jack-o-lantern/ | 70 LED Matrix In A Jack-o-lantern | Mike Szczys | [
"Featured",
"how-to",
"LED Hacks",
"Microcontrollers"
] | [
"ATmega168",
"AVR",
"halloween",
"Halloween props",
"led",
"marquee",
"matrix",
"pumpkin",
"transistor"
] | What takes eight hours to solder and uses more shrink tubing that you thought imaginable? An LED matrix installed in a real pumpkin. When I mentioned that we’d like
the LED pumpkin in last Friday’s post
scaled up to a full LED matrix I had no idea it would be me doing the work. But [Caleb] and I thought it might be just the thing to present for the hacker’s favorite holiday.
Installed in the autumn vegetable is a marquee made from a 5×14 matrix of light emitting diodes. I spaced them by printing out a grid on the computer, taping it to the pumpkin, and drilling 70 holes in the front of the thing. The real trouble came when inserting all of the LEDs from the inside; each of them has four wires soldered to it, creating a net of black wiring. Above you can see it turned out great. This is a shot of it scrolling the message HAPPY HALLOWEEN.
Join us after the break for video of this prop. But we’re not just sharing the finished product. I’ll take you through the build process. Along the way you’ll learn the design considerations that go into an LED matrix and how you can use these techniques to build your own in any size and configuration you desire.
If you want to see a larger version of the banner image
try this
, and below is the video clip promised. Sorry for the poor quality, I’m working on borrowing a better video recorder (I’ll post an update if I manage to get one). There are a couple of animations that happen too fast for the camera. One is a side-to-side sweep that looks similar to a Cylon Eye or the front of Kitt, the car from Knight Rider. The other effect that is poorly represented in the video is a chase function that outlines the rectangle of the display. These both look great to the eye, and fortunately the scrolling text comes out pretty well in the video.
[youtube=http://www.youtube.com/watch?v=ZxhLMC6zip4]
I’m going to take you down the rabbit hole of LED Matrix design but before that let’s look at what it took to make this Jack-‘o-lantern. If it turns out to be more than you can chew, we’ve got a beginners tutorial to help you
get started with these microcontrollers
.
Building the hardware
Before we talk about how to design the circuit, let’s take a look and the build process.
I decided from the start to use different colored LEDs. For reasons that I’ll discuss in-depth in the design section of this tutorial I needed to drive the LEDs at about 10 mA each. I calculated my resistors and then measured each to make sure I was close to my target. This is just fine for blue.
I wanted a way to hold the LEDs while I’m soldering, and I needed a template for drilling the pumpkin. Here I’m using that template made from my Eagle board layout to make an assembly jig using some hardboard. This turned out to be a rather poor choice of material because it started to come apart on the underside, but it worked.
I need to solder all of the cathodes in the same row together. I cut small pieces of wire (13 for each row) plus a longer wire to connect to the driver board. Above I’m soldering those wires into daisy chains.
Here’s a daisy chain for one row… four more to go.
I’m using clear LEDs which means you can’t tell what color they are when there’s no electricity running to them. Before moving a row to the assembly jig I tested them on the breadboard.
As I moved each LED from the breadboard to the jig I clipped off the excess cathode lead. From there remember the mantra: ‘Shrinktube FIRST!!!’ or you’ll be sorry. You can see it just above the solder joint in this image.
Just keep going down the row until complete. In the image above I’ve already heated the shrink tube with a candle-lighter. Note: The two images above are different rows. For one I started on the left and for the other I started on the right. I hope it’s not too confusing.
Here’s one row of completed soldering. After each I removed it and set it aside.
All of the rows have been completed and I’ve reinstalled them in the jig in preparation for soldering the anodes into columns.
Here’s the wires cut to make daisy chains for the columns. I used black wire for the short sections because I’ve got a huge supply of it compared to the red, which I’ve cut for the control lines.
The completed column daisy chains.
Here I’m soldering the fourth column. After I’ve finished one I just lifted up the five LEDs and held them aside with this third hand. Go slowly and be patient… you can do this!
Done! Well, the LEDs are all soldered. It’s time to make a control board for the rows.
Here’s the control board for my rows. I hot glued the incoming lines from the rows to the board for strain relief. Each is connected to the collector of a 2N3904 transistor. The camera flash makes it hard to see but there is a 3k3 resistor connected to the base of each transistor. I’ll add single-conductor wire to those later so they can be plugged into the breadboard. On the left you can see a wire for the GND rail, which connects to the ground of the power supply.
Each column contains the same color LED. I found that the red LEDs needed a different resistor from the rest. Here I’ve soldered resistors to the control wires for each column and soldered groups onto pin heads for each interface with the breadboard.
Here’s the finished control board. At the center of the breadboard is an ATmega168 microcontroller. The black arches connect the transistor base to PortC of the chip via the 3k3 resistors. There are three groups of column pin headers that plug into PortB and PortD.
This is an overview of the completed hardware. At this point I was sure hoping I’d be able to get this into the pumpkin.
Here I’m working on the firmware for the matrix. This is where a better choice of material for the assembly jig would have been nice. But like I said before, it worked.
Getting it in the pumpkin
I started with a fairly large donor pumpkin. I tried to pick one that had a fairly flat face without too much curve.
Before starting I made sure to locate where the matrix would be drilled by taping on another copy of the template I used for the assembly jig.
I cut a large access hatch in the back and cleaned out the guts. The seams of this will not be seen from the front.
Here it is, nice and clean. I want to keep as much wet gunk away from the electronics as possible.
Time to drill. I used a bamboo shish-kebab skewer to poke a pilot hole through the skin of the pumpkin so the drill-bit wouldn’t wander. I found a 13/64th drill bit worked perfectly.
Here’s the completed grid.
Here’s where the LEDs need to go. I spent a bit of time making sure the holes were cleaned out using the skewers.
Take a deep breath and start inserting LEDs. Once I had them all in place I powered up the unit and checked to make sure I hadn’t switched around any of them. Once I knew it was right I used a skewer to push each LED through to the surface.
This little plastic dish keeps the control circuitry dry on the bottom. I’ve added a little 5v regulator I built for a different project, with a 9V batter hidden beneath the larger board.
The power is on and I’ve sealed the hatch using a few skewers.
This is how it looks with the lights on. Here it’s displaying the work BOO.
The finished product. Whew, what a relief!
How to design an LED matrix
Ok, let’s jump into the why’s and how’s of building an LED matrix.
Multiplexing
The display I built has 70 LEDs. If you individually address each LED you’re going to need 70 pins on your microcontroller. But there’s an easier way.
Multiplexing
is a method of lighting just a portion of the display at one time. Using a microprocessor you can switch which section is on so quickly that your eye doesn’t ever perceive it being off.
Because one section will be turned off while scanning through the other parts of the display you want to keep the number of multiplexed sections low. I chose to multiplex the five rows of this matrix. That means that one row will be on 1/5th of the time, which we call a 1/5th duty cycle. This is basically a type of pulse-width modulation, a technique we use to dim LEDs. I’ve used ultra-bright LEDs for this very reason.
Here’s how the multiplex of this display is going to work: Turn off all rows and columns. Set the columns you want to be illuminated in the first row. Turn on the first row driver and the columns in that row will light up. Start over and move to the second row. Here’s the schematic for the matrix I built (click to enlarge):
Columns and Addressing
We want each LED to have the same brightness. Because only one row will ever be on at one time. A single resistor in each column will work for all of the LEDs in that column. That is because an LED must be connected to both voltage and ground in order for current to flow. All of the Anodes (positive leg of the LED) are connected together in the columns, and all of the cathodes (negative leg of the LED) are connected in rows. So turning column 1 on and row 1 will let current flow through the LED at that location. The LEDs in rows 0, 2, 3, and 4 will not light because their rows haven’t been turned on and so they have no connection to ground on their cathode. In this way we build a grid of LEDs that are addressable.
Size Limitations
Multiplexing introduces an issue with current draw. I am limited in the number of columns I can drive because I’m connecting them to a microcontroller. If you look at the ATmega168 electrical characteristics in the datasheet you’ll find it can source 40mA per pin. But there is a limitation on what the supply pin of that chip (VCC) can source. The VCC pin is limited to 200mA. We must stay below that threshold or the chip may be damaged.
This is part of the reason that I chose to use 14 columns. There will never be more than 14 LEDs on at once because that’s how many are in a single row. If I drive them at 10mA each, I’m pulling a total of 140mA. This is below the 200mA threshold and leaves some room for error, and for the current that the ATmega168 needs to run. I’ve also limited it to 14 because I wanted to reserve 2 particular pins on the device for other purposes, but more on that later.
We need to consider the current on the low side of the LED matrix. The rows act as the ground connection for the display. If all the LEDs in a row are illuminated at once, there will be around 140mA coming down that control wire. It can’t be connected directly to a microcontroller because that’s too much current for one pin. Instead, I’ve used an NPN transistor. The 2N3904 conveniently has a 200mA limit which is enough to handle the 140 mA sinking from the display. These transistors work like a switch, requiring just 1/100th of the current you are switching to be present on the base leg of the device in order for it to connect the control wire to ground.
How can we make bigger displays?
I wanted to keep the parts count for this display small, but there’s really no limit on size if you’re willing to add more components. Beefier transistors allow you to switch much higher currents. And you can use cascading shift registers to expand the number of columns. Those shift registers are addressed with one data line and a clock… pulsing data in serially instead of in parallel as we’re doing in our example. You take a speed hit because it takes two cycles for each column (one to set the data bit, one to clock it in, and repeat until all columns have been pulsed in). Explaining this in detail is beyond the scope of this tutorial but as long as you are keeping current consumption for your parts within the device specifications you
can
go big.
Making the connection
As I said above, I wanted to keep my parts count to a minimum and so chose not to use shift registers. That means I need one pin for each column and one pin for each row. Using all eight pins on PortB and PortD of the microcontroller I could still hook up the five rows to PortC AND have at least one pin left over (two pins if you want to use RST as I/O). Why didn’t I make this 16 columns long?
There’s a good reason. I wanted to leave the serial port on the chip available for future use. RXD and TXD are located on pins 0 and 1 of PortD. I could have moved the last two columns to a different port but that would mean addressing 3 ports for the columns instead of two; causing a slowdown in the performance of the processor.
Writing the code
Writing code for a multiplex display comes in two parts; some type of frame buffer, and code to handle the multiplexing in the background.
Please
download the source package
and follow along.
There are pin, port, and data direction register defines at the top that will clarify what some of the code examples in this post are doing.
Frame buffering
This is a simple concept. You need a data structure that represents the physical display. We’re operating with pixels that are either on or off, which is the definition of binary code. So we just need to think of our currently displayed frame as five integers. An integer is a 16-bit number when working with AVR; one bit for each LED (two bits will go to waste) and five integers for the five rows:
volatile int buffer[5] = { 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 };
I’ve used hexadecimal instead of binary to instantiate this array. That’s a pretty common practice because it takes 1/4 of the characters to represent the same amount of data. Be assured, 0x0000 and 0b0000000000000000 equal the same value.
Also notice that I’ve used the keyword ‘volatile’. This is extremely important, because this data will be accessed by both an interrupt service routine, and the main body of the code. If it is not volatile the compiler may optimize out changes to this code, resulting in bizarre and hard to debug behavior. Also, we’re using 16-bit data types on an 8-bit device. It will be important to disable interrupts when changing the data so that we don’t have an interrupt happen between changing the first and second bytes of an integer. More on this later.
Interrupt drive multiplexing
This is really one of the easiest parts of this process. It can just be a little hard to wrap your mind around what’s happening at first.
We don’t want to ever think about what’s happening with the scanning of our five rows. Using a timer-based interrupt we can multiplex the display at a constant rate and forget about it.
Here’s how it works. We set up a timer to trigger an interrupt many times per second. When that interrupt occurs, the processor will stop running the main loop of our code (no matter what’s going on) and run the code in our Interrupt Service Routine (ISR). Here’s how I setup Timer1 to interrupt 500 times per second:
//Initialize the Timers
static inline void initTimers(void) //Function used once to set up the timer
{
TCCR1B |= 1<
TIMSK1 |= 1<
OCR1A = 0x07D0; //Set compare value for 500 times per second
sei(); //Enable global interrupts
}
Let’s consider the math for just a bit. The ATmega168 has an internal clock that is set to run at 1 MHz. I’d like to have my display updated 500 times per second, resulting in a complete refresh 100 times per second. So 1,000,000 cycles per second divided by 500 interrupts equals a target of 2000 cycles. I need to set up a timer that will count each of the system clock cycles and trigger an interrupt when 2000 of them have passed. That is what I’m doing with the OCR1A value, 0x07D0 is the hexadecimal equivalent of 2000.
For those of you who really know what you’re doing you’ve probably notice an error. The Timer starts counting at 0 instead of 1, which means I really should be interrupting at one cycle less that 0x07D0 but it’s close enough for jazz.
Interrupt handling
Now that we’ve written code to create an interrupt 500 times per second we’ve got to do something when that happens. The plan is to keep track of the next row that should be turned on. At the beginning of the interrupt we’ll turn off the entire display, set the column pins for the next row to be displayed using the frame buffer, turn on that row, and setup for the next interrupt. Here’s the code to make that happen:
ISR(TIMER1_COMPA_vect) //Interrupt Service Routine handles multiplexing
{
//Shutdown all rows
rowPort &= ~rowMask;
//Shutdown all columns
colPort0 &= ~colMask0;
colPort1 &= ~colMask1;
//Set buffer data to columns
colPort0 = (char)buffer[row_track];
colPort1 |= ((char)(buffer[row_track] >> 6) & 0xFC); //Shift data and mask out lower bits (reserver for Rx and Tx)
//Drive row
rowPort |= (1<<(4-row_track));
//Preload row for next interrupt
if(++row_track == 5) row_track = 0; //Row tracking
}
There is a bit of magic code going on above. Here it is out of context so we can pick it apart:
colPort1 |= ((char)(buffer[row_track] >> 6) & 0xFC)
I’ve defined ‘colPort1’ earlier in the source code as PORTD. That’s the one where we’ve reserved the lowest two bits for later use as a serial connection. When we write the integer data to a port only the lowest 8-bits will be read by the microcontroller because that’s the size of the ports. To the right of the equals sign I’m casting the integer data as an 8-bit char. We want the most significant byte of that integer data for columns 8-13, so we’re shifting the data to the right. But I only shifted it six spaces, because we’re not going to use the lower two bits of the register. Finally, I used the bitwise ‘&’ operator to mask out the lower two bits so that we don’t mess up any other uses for those pins that may come in the future. I feel this line of code is a great example of the power of binary data and if you don’t fully understand it you simply must take the time to study how this works. It’s a fantastic part of working with embedded systems.
Manipulating the frame buffer
Our display is multiplexing in the background and we no longer have to worry about that. Now you can display just about anything you want by manipulating the frame buffer.
In this case, the frame buffer is an array of five integer values. As I discussed earlier, when working with an 8-bit device it takes at least 2 cycles for it to write a 16-bit integer. What happens if an interrupt fires between those two cycles? For this reason it’s important to disable interrupts while changing the frame buffer. But disabling interrupts will stop our automated multiplexing so make sure you change the frame buffer quickly and enable interrupts as soon as you can.
void clearScreen(void)
{
cli();
for (unsigned char i=0; i<5; i++) buffer[i] = 0x0000;
sei();
}
The above code is probably the simplest example we can use. This will immediately clear the display. The ‘cli();’ command will disable interrupts, and the ‘sei()’ command will enable them. In between I’ve used a ‘for’ loop to set all five integers in our buffer array to 0x0000, which represents off. If I had set them to 0x1111, all of the LEDs in the display would be illuminated.
You take it from here
Explaining every part of the example code is beyond the scope of this tutorial. But take some time to figure out how it works. I’ve stored the font array and the messages in PROGMEM or I would have run out of ram. [
Dean Camera
] has
a great tutorial on PROGMEM
use which you should read if you haven’t used it before. As for everything else, play around and see what you can do!
Follow Me
@szczys
Resources
Source files
How to program AVR microcontrollers | 23 | 23 | [
{
"comment_id": "203352",
"author": "bluewraith",
"timestamp": "2010-10-26T22:23:52",
"content": "Nice writeup. I’ve been playing around with homemade 8×8 matrices for the past few days using a MAX7219. It takes care of the multiplexing for me, and all of the current limiting is done with just one r... | 1,760,377,348.689878 | ||
https://hackaday.com/2010/10/26/portal-shirt/ | Portal…shirt? | Jakob Griffith | [
"digital cameras hacks",
"Peripherals Hacks"
] | [
"camera",
"halloween",
"lcd",
"portal",
"shirt"
] | [Ben Heck] is in the
Halloween spirit
with his Portal inspired “see through” t-shirt. That is, a thin lcd is mounted on [Ben’s] chest, with a
not as thin
camera mounted on his back; when the system is running, everything behind him is captured by the camera and displayed on the LCD. The concept isn’t exactly new by any means, often by the name of “
gaping holes
” or “
hole through body
” or
more
, but the project goes to show that a creative costume isn’t always the most elaborate, expensive, or even a new idea. Catch a video of how to make your own Portal shirt, after the jump. Oh, and you can win the Portal shirt
here
.
[via
The Daily What
]
[youtube
http://www.youtube.com/watch?v=p4dUm1oYLL0&feature=player_embedded%5D | 29 | 28 | [
{
"comment_id": "203311",
"author": "Hirudinea",
"timestamp": "2010-10-26T20:55:42",
"content": "Holy shirt, that’s neat!",
"parent_id": null,
"depth": 1,
"replies": []
},
{
"comment_id": "203313",
"author": "Caleb",
"timestamp": "2010-10-26T21:06:27",
"content": "any... | 1,760,377,348.866083 | ||
https://hackaday.com/2010/10/26/robot-gripper-uses-coffee-to-pick-up-anything/ | Robot Gripper Uses Coffee To Pick Up Anything | Mike Szczys | [
"Robots Hacks"
] | [
"arm",
"balloon",
"coffee",
"grip",
"grounds",
"jamming",
"robot"
] | Picking up a raw egg is not something we’d think a robot gripper would be good at. But
this model uses a bulbous tip
instead of claw, which makes crushing the object less of a concern.
That tip is kind of like a balloon. It is stretched full with coffee grounds but air can also be pumped in and sucked out. When it comes time to grip an object, a bit of air is pumped in and the bulb is pressed down on its target. Once in place all of the air is sucked out, locking the coffee grounds around the object. Take a look after the break to see just how many things can be gripped with this technique.
Now the real question,
can it bring me a beer
?
http://www.youtube.com/watch?v=Jj3yVf7ZUcI
[via
BotJunkie
] | 35 | 35 | [
{
"comment_id": "203211",
"author": "hybrid_mind",
"timestamp": "2010-10-26T18:06:12",
"content": "Now that’s an ingenious idea. I’m surprised that the tip can actually grip that well.",
"parent_id": null,
"depth": 1,
"replies": []
},
{
"comment_id": "203212",
"author": "lee... | 1,760,377,348.985557 | ||
https://hackaday.com/2010/10/26/security-flaw-bypasses-iphone-lock-screen/ | Security Flaw Bypasses IPhone Lock Screen | Mike Szczys | [
"iphone hacks"
] | [
"contact",
"flaw",
"ios",
"iphone",
"lock screen",
"security"
] | It looks like the iPhone lock screen provides just a marginal level of protection. [Jordand321] discovered
a key combination that opens the contact app
on a locked iPhone. Just tap the emergency call button, enter the pound sign three times (###), then tap call and immediately tap the lock key on the top of the phone. If this is confusing just look at the video after the break to see how it’s done.
You don’t get access to everything on the device. But this does give an attacker access to all of your contact data and allows that person to make any calls they desire.
[youtube=http://www.youtube.com/watch?v=hq8Dok2Th2s]
[via
Wired
via
9to5Mac
] | 53 | 50 | [
{
"comment_id": "203187",
"author": "ACIDRAIN",
"timestamp": "2010-10-26T17:13:59",
"content": "…and this is why I don’t like Apple or its philosophy of “We know what you need”.Like a pusher robot with a black turtleneck.",
"parent_id": null,
"depth": 1,
"replies": []
},
{
"comme... | 1,760,377,349.064061 | ||
https://hackaday.com/2010/10/25/hacker-housing-rally-to-restore-sanity/ | Hacker Housing – Rally To Restore Sanity | James Munns | [
"Hackerspaces",
"News"
] | [
"colbert",
"dc",
"hackerspace",
"housing",
"lodging",
"Rally",
"sanity",
"stewart",
"washington"
] | HacDC, Washington DC’s own hackerspace has been kind enough to
open their doors
(and floors) to fellow hackers planning on visiting DC this weekend for the upcoming
Rally to Restore Sanity
. They are taking registrations now, and space is limited, so act fast. They have a suggested donation of $20 a night, which will get you floor space and breakfast each morning, as well as the warm feeling of supporting a community based Hackerspace. Details can be found on their registration page, and please make sure you read the rules before registering. Thanks again to HacDC for supporting the Hacker community!
In other news, Hack a Day will be at the Rally, so keep an eye out for the writers wearing the Hack a Day shirts, as well as the
HackaDay Twitter
. If you get seen with one of us, you might just make it to the fan gallery. We will also be handing out some HackaDay Swag if you catch us soon enough on Saturday. | 44 | 42 | [
{
"comment_id": "202617",
"author": "Noooooo",
"timestamp": "2010-10-25T17:17:03",
"content": "Hack A Day, why in the world are you promoting political events? This is insanity. Please leave such nonsense behind. We Hack A Day readers aren’t interested in such things (at least not here). We can ... | 1,760,377,349.137734 | ||
https://hackaday.com/2010/10/25/halloween-props-this-drill-makes-your-head-spin/ | Halloween Props: This Drill Makes Your Head Spin | Mike Szczys | [
"home hacks"
] | [
"drill",
"exorcist",
"Halloween props"
] | [Nollie551] sent us a demonstration of
his head spinning yard prop
. Adding a possessed child as part of your Halloween display is a nice touch. But when her head starts to spin (think:
The Exorcist
) as trick-or-treaters saunter by it should scare the life out of them. You can see that all it took is a jig to hold an inexpensive power drill in place. He didn’t include details of how this is hooked up but we think it would be a great way to use
that drill switch hack
that [Ben Krasnow] did a while back.
Join us after the break for some video.
[youtube=http://www.youtube.com/watch?v=9xLFJK0Uj68] | 9 | 9 | [
{
"comment_id": "202665",
"author": "macw",
"timestamp": "2010-10-25T18:52:17",
"content": "I don’t think this counts as a “hack” yet…it’s really just carpentry! If he included a system to make the head react to people walking by, or jitter the motor speed like that spider from a week ago, then we’d... | 1,760,377,349.184336 | ||
https://hackaday.com/2010/10/25/avr-programming-02-the-hardware/ | AVR Programming 02: The Hardware | Mike Szczys | [
"Featured",
"how-to",
"Microcontrollers"
] | [
"arduino",
"ATmega168",
"Atmel",
"AVR",
"avr-gcc",
"avrdude",
"compiler",
"dapa",
"dragon",
"programmer",
"programming",
"stk500",
"usbtinyisp"
] | You may be able to write the most eloquent code in the history of embedded systems but without a way to run it on the hardware it will be worthless. In this installment of the tutorial series we will:
Look at some of the available AVR programmer options
Place the microcontroller on a breadboard and connect it to a power supply and a programmer.
Use programming software to send some example code to the microcontroller
If you missed
Part 1
take a few minutes to review that portion of the tutorial and then join us after the break.
Series roadmap:
AVR Programming 01: Introduction
AVR Programming 02: The Hardware
AVR Programming 03: Reading and compiling code
AVR Programming 04: Writing code
Programmers
As I said before, if you want to get it on the chip you’ve got to have a programmer. There are a huge number of options, but I’ll cover a few of the easiest and least expensive. We are focusing on
In-System Programming
(ISP) which means that you can program the chip without removing it from the circuit.
DAPA Cable
A Direct AVR Parallel Access, or DAPA cable, is an incredibly simple and cheap programming method. You can build one very quickly for a few bucks worth of parts, but the convenience comes with a few gotchas. The first is that you must have a parallel port on your computer; something that modern laptop and some modern desktops don’t have. But if you’ve got an old PC around that has one this will get you up and programming in no time.
In fact, the first AVR prototyping I did was with one of these cables. That is, until I discovered another gotcha. This will only program low-speed chips. If you try to run the chip’s clock at full speed (by changing fuse settings… more in Part 3) you won’t be able to use a DAPA cable to talk to it any longer. There’s also the possibility of damaging your parallel port or worse if you do something wrong. But if you want to go for it anyway, here’s how I built mine.
It connects to a computer using a DB25 connector. As you can see in the schematic, I’ve used 1 kilo Ohm resistors on the Reset, SCK, MISO, and MOSI pins for current protection. I did not use a resistor on the ground pin. I used a piece of ribbon cable, soldering one end to each of the five signal lines shown in the schematic. On the other end of the ribbon cable I used a connector housing with six slots, filling one of them with a blank so that I could keep track of the signals. This is easy to plug into a pin header or connect to jumper wires as shown above. In retrospect it may have been a better choice to use a 2×3 IDC connector and route the signals using the
AVR ISP standard
(from
AVR: In-System Programming PDF
). If you go this route chances are you’ll upgrade before long so don’t agonize of the design details.
Arduino
I would be remiss to skip over using an Arduino as a programmer. They’re ubiquitous with the embedded systems crowd and if you don’t already own one, you can try to find someone to lend you theirs for a little while. All that is required is to write an AVR programmer sketch to the Arduino and make the programming connections. We’ll take a look at this method later in the post.
USBtinyISP
The
USBtinyISP
is an In-System-Programmer based around an ATtiny2313 that uses a USB connection (see where the name comes from?). It isn’t a bad choice for your first programmer. If you are confident in your skills you can build the circuit circuit yourself and use a DAPA cable to get the programming firmware onto the chip. Or you can just buy it from Adafruit Industries. But if you think you’re going to be serious about AVR development, you should consider shelling out the extra bucks for a professional programmer.
Professional programmers
The Ateml programmers are the gold standard. They offer something that none of the other hardware we’ve covered has, the ability to recover a chip that you’ve messed up. If you want to use the reset pin as I/O, you will need to use High Voltage Parallel Programming to talk to your chip. Even if you don’t
decide
to do that, at some point you’re going to screw up and you’ll need to recover a process, which helps offset the extra cost of a professional programmer. It is possible to use an Arduino for High Voltage Parallel Programming to recover your AVR,
but that’s another hack
in itself.
We use an
AVR Dragon
for pretty much everything. But
the STK500
is a very popular board even though you need a serial port to use it. It has chip sockets, buttons, and LEDs for on-board prototyping. The Dragon leaves options open with unpopulated socket footprints, and it uses a USB connection.
If you’re in this for the long haul there’s no substitute for one of these choices.
We should at least mention
the MKII
, a programmer that offers ISP in the same way that the USBtinyISP does, but also provides JTAG, debug wire, and few others. We have no experience with this unit so you’ll have to do your own research if you’d like to know more. As for the other programmers out there, use Google or check the comments to this post as people usually don’t like to keep their preferred programmer choice a secret.
Bootloader
A bootloader is not really a programmer, but a way to get around using one. A bootloader is a set of code already on your microprocessor. It handles basic input and output neccessary to write your code into the chip’s memory. The bad news is that they do take up programming space, but you won’t have to buy a hardware programmer.
Programming a chip with a bootloader on it is beyond the scope of this tutorial. But it’s not hard to learn to do. In fact, this is how it is possible to program an Arduino without a separate hardware programmer.
Setting up our test circuit
Enough talk, let’s build something! We need four things: A microcontroller, something to power it, some way to program it, and something to show us it’s working.
Hardware:
Solderless breadboard
Jumper wires
ATmega168 microcontroller
78L05 voltage regulator
100uf electrolytic capacitor
10uf electrolytic capacitor
LED
180 Ohm resistor (any resistor between 180 and 330 Ohms will work fine)
A programmer (we’ll show both a DAPA and an Arduino)
What we’re doing
In a nutshell, we’re going to blink an LED as our first embedded program. This takes a few components: a power supply, the microcontroller itself, and the LED and its current limiting resistor.
The power supply consists of a voltage regulator which will take an input voltage above 7v and output a constant voltage of 5V. In order to work correctly, this circuit requires two filtering capacitors. The capacitors act like storage tanks, absorbing small fluctuations on the power rail to provide a steady source of electricity to keep our microcontroller safe and happy.
As an output we are going to use an LED. We must include a resistor to limit the amount of current that will flow when the software lights it up. Without this current limiting resistor, current would flow at levels that are unsafe for the LED, the microcontroller, or both.
The circuit schematic
Above is the circuit we are using as an example. The a simple 5v regulator circuit using an LM7805 linear regulator and two filtering capacitors is on the left, separated from the rest by a dotted box. If you already have some type of regulated 5v supply save yourself some time and use that.
You may also notice that the chip in the schematic is labelled AVR-MEGA8. The ATmega168 that we’re using is pin-compatible with at ATmega8. That means that you can swap one for the other and all 28 pins will be where they’re supposed to be, so this will cause no issue.
It is a good practice to add a few components not seen here. There should be two 0.1 uF capacitors for
decoupling
; they filter out fluctuations on the power rails called noise. One between VCC and GND, the other between AVCC and AGND (as close as possible to the pins). There should also be a pull-up resistor on the reset pin with lets an incredibly small amount of current trickle into the pin at a 5V level. This the chip from resetting by accident when it’s floating (not connected so there’s no clear 0 or 5V value). I’ve omitted these parts for simplicity and it shouldn’t be an issue with this simple project. But as your projects get more complicated, neglecting these considerations will come back to bite you.
The circuit built on a breadboard
I started building the circuit by adding the voltage regulator to the breadboard. Then connect the ground leg to the ground rail on top of your breadboard, and the output leg to the voltage rail of your breadboard. I have also added two wires that I will eventually connect to the positive and negative terminals of a 9V battery.
It is important to read the datasheet for your voltage regulator (example:
LM7805
) to figure out which lead is input, ground, and output. Your regulator may look different from mine as they do come in different packages. In the image above, the input lead is on the left, the ground is in the middle, and the output lead is to the right.
Now I’ve completed the power supply by adding the 100 uF capacitor between the input leg and ground leg of the regulator, and the 10 uF capacitor between the output leg and ground leg. Pay careful attention to these capacitors, one lead should be marked as negative (a band with a minus sign) on the case of each capacitor. Before adding the microcontroller it would be a good idea to check the voltage output using a multimeter. Too much juice can destroy your new chip.
After checking to make sure I had a steady 5V source, then disconnecting the battery, I added the ATmega168 microcontroller to the board. Note that the dimple is pointing to the left. This is important, as
the standard orientation and lead numbering of a DIP package
shows that pin 1 is now on the lower left, letting us easily find the other pins that we need.
Power and ground have been connected to the chip as well. Pin 7 (VCC) and Pin 20 (AVCC) have been connected to 5V. Pin 8 (GND) and Pin 22 (AGND) have both been connected to ground.
The final step is to connect the LED to output 0 on Port D. Our schematic tell us that we want to connect the positive lead of the LED to Pin 2 on the ATmega168, and the negative lead should go to an unoccupied row on the breadboard (make sure you don’t attach it to Pin 1). LEDs usually have a small notch flattened on one side of the plastic case to denote the negative leg of the device. The final piece of the puzzle is to connect the negative side of the LED to ground by using our resistor.
In the image above I’ve hooked up a 9V battery , but nothing happened. That’s because there’s no firmware on the chip to make the LED blink yet. We’ll need to fix that in the next step.
Programming our test circuit
Check all of your connections one more time and let’s get ready to program the microcontroller.
Connecting to a programmer
You only need to make six connections in order to program our chip:
Voltage
Ground
Master In Slave Out (MISO)
Master Out Slave In (MOSI)
Reset (RST)
Slave Clock (SCK)
This is true for any programmer that is using In-System Programming. There’s even
a standardized 6-pin header
that I design into most of my circuits so that you can easily reconnect your programmer to a circuit board and update the firmware down the line. But for this example we’ll just use some jumper wires to make the connections. One thing to keep in the back of your mind is to only use one voltage source when programming. You should either disconnect the power to your circuit while programming, or do not make a connection to the voltage line on your programmer.
Connecting an Arduino as a programmer
Using your Arduino as a programmer is super easy. The first thing you’ll want to do is open up the Arduino IDE, and then open the example software: ArduinoISP.pde (in the examples/ArduinoISP folder). Flash it to your Arduino in the normal fashion. Now follow the directions for
targeting an AVR on a breadboard
(bottom of that page).
Important:
Choose one power source. That is to say, either connect the voltage on the Arduino board to your breadboard, OR connect the battery to the power supply we wired up. Doing both has the potential to damage your hardware.
Here’s how mine looked once I had it hooked up.
Now that everything is ready to go, jump to the next section: Flashing firmware with AVRdude.
Connecting using a DAPA cable
Depending on how you constructed your DAPA cable, it should be pretty easy to make the five connections we need. Notice that the DAPA cable doesn’t have a Voltage connection. The target processor must have its own power source (like the power supply we built on the breadboard) during programming. Here is what my DAPA cable looks like once connected.
If you’re unsure of the connection that need to be made, go back and compare the DAPA cable design to the circuit schematic. Match up our five connections: MISO, MOSI, RST, SCK, and GND.
Flashing firmware with AVRdude
If you did your homework from Part 1 of this series you should already have the cross compiler tools installed. First,
download the firmware package
and navigate to that directory in a shell, or at the command prompt. The following commands can be used on Linux and OSX systems to program the chip.
Arduino as the programmer:
avrdude -P usb -b 19200 -c avrisp -p m168 -U flash:w:main.hex
DAPA as the programmer:
avrdude -P /dev/parport0 -c dapa -p m168 -U flash:w:main.hex
AVR Dragon as the programmer:
avrdude -P usb -c dragon_isp -p m168 -U flash:w:main.hex
USBtinyISP as the programmer:
avrdude -P usb -c usbtiny -p m168 -U flash:w:main.hex
You can get help from the AVRdude program by running:
avrdude -h
That will print out a list of available commands, or you can read
the online documentation
.
Windows users will need to change the /dev/* portion of the command
to match your connection. You should find the
Windows page of the online manual
particularly helpful for this. Standard Windows port names include com0, com1, etc. for serial ports and lpt0, lpt1, etc. for parallel ports.
As for the other flags used in the programming commands above:
When using the Arduino as an ISP programmer you must specify the speed, using ‘-b’. That value is set in the Arduino sketch and should be 19200 by default.
You will always need to specify what kind of chip is connected to the programmer. Here I’ve used ‘-p m168’ for our ATmega168. Get a list of all compatible microprocessors by typing
avrdude -p ?
The same is true for specifying a programmer. You can change the ‘-p’ to ‘-c’ in the command above to get a list of programmers.
The final option in the commands we used tells the programmer to write (that’s the ‘w’) the file ‘main.hex’ to flash memory. Part of the command is used for many things, including changing the fuse bits on the chip. I’ll talk about this in Part 3 of the series.
Debugging
Your LED should be flashing away quite happily at this point. What’s that? It’s not? Time to start the real learning. Here’s a list to get you started:
Did you successfully program the chip? You should get the message: “258 bytes of flash verified” and “avrdude done. Thank you.”
If you had an error during programming, check first to make sure there is power going to your chip.
Try the programming command again using ‘-v’ in place of ‘flash:w:main.hex’. This will just attempt to talk to the chip instead of writing to it, and is very handy when working out programming bugs
Recheck your programming connections to ensure you’ve got the correct signals connected to the right pins
Make sure you have the correct port on the computer and that you have permission to use that port. Linux users may try talking to the chip with the -v flag as ROOT to discover if there is a permission problem. If this works you need to add your user to the group that has permission to access the port the programmer is connected to
If you did successfully program the chip you should recheck your hardware. Is the LED installed backwards, preventing it from lighting up?
Take a trip to Google and start searching… this usually plays a roll in the development process so don’t feel bad. A lot of folks have already experienced the trouble you’re having and they made it through okay in the end.
Conclusion
You’ve done it, your first embedded circuit is alive! For now it will just flash to let you know everything is working. But next time we’ll talk about how this was accomplished, what we can do to make it behave differently, and how to use the compiler to translate our code changes into a file that the microcontroller can run. Thanks for reading and we’ll see you back here for the next installment.
Follow Me
@szczys
Resources
Firmware package:
Package download
or
Github page
Atmel AVR
ATmega168 Datasheet
(PDF)
AVR dude online documentation
AVR In-System Programming Application Note
(PDF)
AVR ISP Programming Header: | 67 | 50 | [
{
"comment_id": "202502",
"author": "Akhil",
"timestamp": "2010-10-25T13:17:59",
"content": "great… waiting for the part three.",
"parent_id": null,
"depth": 1,
"replies": []
},
{
"comment_id": "202543",
"author": "Panikos",
"timestamp": "2010-10-25T14:00:47",
"conten... | 1,760,377,349.335646 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.