I’ve been playing on the squarecows servers with some new and updated spam fighting tools. Firstly I decided to beef up spamassasin with the latest and greatest rule sets from the rules emporium, and then I thought I’d take a serious look at SPF and DKIM. Both which are relatively easy to get going if you have a few hours to play and spend tweaking. Now neither of these features on there own will combat spam so that why I use both! Also I’m now signing outgoing messages using dkimproxy which works really well with postfix, and will hopefully stop my users ham being marked as spam, well once these technolgies take off that is ;)

If anyone else has been playing with anti spam software recently, I’d love to hear from you.

,

Well I once again have a working rockband drum pedal! Thanks to this metal pedal billet! So once again we are annoying the nieghbours and rockin into the early hours. Speaking of which we went to see the fabulos backtrackin again at the kings arms in Colchester and it was another great show! Also we spent time with our good friends at the Mersay Regatta, there was plenty of cheeky vimto flowing! Thanks guys! Now all the fun is settling down i may get time to do some more development!

Buttonkeypad

Little-Scale shares tips for using a button keypad with the Arduino platform -

The idea of the digital scanning of a keypad is very simple. The keypad in question has twelve buttons, set up in four rows of three (like a phone keypad, for example). Each button has two connection points – one point goes to a row pin, and one point goes to a column pin. Therefore, seven pins are connected between the keypad and the Arduino – four for the rows and three for the columns. When a button is pushed, it connects the two points – a column pin and a row pin.

Read on for more detail - How to read a keypad with Arduino

Makershedsmall
Arduino Crop
Arduino Diecimila

Read more | Permalink | Comments |

Read more articles in Arduino |

Digg this!

I recently read a post on ladyada’s blog where she used roland-reigel’s code to read an SD card. I used ladyada’s adaptation of his code and was able to read my SD card!

The code takes up most of the Arduino memory. Sad, but true.

Hopefully, I will be able to do some data logging and playback.

It has been a long time since I blogged about the SD card project. I have been busy, but every once in a while I was able to do some experimenting.

I was able to build the AVRLIB mmc code and mmctest program, which should work with my SD card, and load it to the Arduino using avrdude. It brings up a command line interface to test mmc functions like read, write, initialize(reset). It seems to interface fine to the SD card, but I keep getting an error back in the status register. The error code is a 0×5. I did some research on the error, but haven’t figured out exactly what is happening.

For now, I have put the SD project on hold.

I am now connecting up the TSOP32238 and getting data from my remotes into the PC and hopefully LIRC. The output of the TSOP32238 is a stream of 1’s and 0’s. I think LIRC expects pulse lengths in hex, so I have some code to write.

I borrowed walter anderson’s code to look at what the TSOP32238 is seeing…. I am getting some false pulses probably because I hooked the TSOP directly to the input pin instead of using the recommended cap and resistor.


/* *  File....... IRanalyzer.pde  *  Purpose.... Records up to 128 signal changes *  Author..... Walter Anderson  *  E-mail..... wand...@walteranderson.us  *  Started.... 18 May 2007  *  Updated.... 18 May 2007  *  * */#include <avr/interrupt.h>#include <avr/io.h>

#define TIMER_RESET  TCNT1 = 0#define SAMPLE_SIZE  64

int IRpin = 2;unsigned int TimerValue[SAMPLE_SIZE];char direction[SAMPLE_SIZE];byte change_count;long time;

void setup() {  Serial.begin(115200);  Serial.println("Analyze IR Remote");  TCCR1A = 0x00;          // COM1A1=0, COM1A0=0 => Disconnect Pin OC1 from Timer/Counter 1 -- PWM11=0,PWM10=0 => PWM Operation disabled  // ICNC1=0 => Capture Noise Canceler disabled -- ICES1=0 => Input Capture Edge Select (not used) -- CTC1=0 => Clear Timer/Counter 1 o  //Compare/Match  // CS12=0 CS11=1 CS10=1 => Set prescaler to clock/64  TCCR1B = 0x03;          // 16MHz clock with prescaler means TCNT1 increments every 4uS  // ICIE1=0 => Timer/Counter 1, Input Capture Interrupt Enable -- OCIE1A=0 => Output Compare A Match Interrupt Enable -- OCIE1B=0 => O  //tput Compare B Match Interrupt Enable  // TOIE1=0 => Timer 1 Overflow Interrupt Enable  TIMSK1 = 0x00;            pinMode(IRpin, INPUT);}

void loop(){  Serial.println("Waiting...");  change_count = 0;  while(digitalRead(IRpin) == HIGH) {  }                                   TIMER_RESET;  TimerValue[change_count] = TCNT1;  direction[change_count++] = '0';  while (change_count < SAMPLE_SIZE) {    if (direction[change_count-1] == '0') {      while(digitalRead(IRpin) == LOW) {      }      TimerValue[change_count] = TCNT1;      direction[change_count++] = '1';    }     else {      while(digitalRead(IRpin) == HIGH) {      }      TimerValue[change_count] = TCNT1;      direction[change_count++] = '0';    }  }  Serial.println("Bit stream detected!");  change_count = 0;  time = (long) TimerValue[change_count] * 4;  Serial.print(time);  Serial.print("\t");  Serial.println(direction[change_count++]);  while (change_count < SAMPLE_SIZE) {    time = (long) TimerValue[change_count] * 4;    Serial.print(time);    Serial.print("\t");    Serial.println(direction[change_count-1]);    Serial.print(time);    Serial.print("\t");    Serial.println(direction[change_count++]);      }  Serial.println("Bit stream end!");  delay(2000);}

I wrote some code to test my wiring and voltage dividing resistor setup. It allows me to toggle each of the pins (10 - 13) using the serial port of the PC. All of the wiring and voltage dividers seem to be working.

Now for the real work. The question is: do I write my own code or try to reuse other code. AVRLib has MMC code which can be adapted to SD very easily, but AVRLib may not integrate with the Arduino development environment. There are other AVR examples out there. I even found one that does FAT format and IDE, which would be useful if I were connecting up a compact flash card interface because compact flash behaves like an IDE drive.


Test Code

int incomingByte = '1';int prevByte = 0;

int pinArray[] = {  10, 11, 12, 13};int pinCount = 4;int LastPinVals[] = {   LOW, LOW, LOW, LOW };int count = 0;

void setup(){  for (count=0;count<pinCount;count++) {    pinMode(pinArray[count], OUTPUT);  }

  reset_pins();

  Serial.begin(9600);  Serial.println("Start");}

void reset_pins(){  for (count=0;count<pinCount;count++) {    digitalWrite(pinArray[count], LOW);  }}

int pinToIdx(int pin){  int i;  for (i = 0; i < pinCount; i++)  {    if (pinArray[i] == pin)    {      return i;    }  }  return 0;}

void toggle(int pin){  digitalWrite(pin, ! LastPinVals[pinToIdx(pin)]);  LastPinVals[pinToIdx(pin)] = ! LastPinVals[pinToIdx(pin)];}

int byteToPin(int byteVal){  return pinArray[byteVal - '1'];}

void loop(){  if (Serial.available() > 0)  {    incomingByte = Serial.read();    if (incomingByte >= '1' && incomingByte <= '4')    {      if (prevByte != incomingByte)      {        Serial.print("Got ");        Serial.println(incomingByte);        toggle(byteToPin(incomingByte));        prevByte = incomingByte;      }    }  }}

I set up the arduino this way to connect a micro SD card to it for extra memory.

Step one is to get regulated 3.3V to the SD card. I used an LM317T and some resistors to take the 5V from the arduino and turn it into 3.3V.

I purchased the micro SD card breakout board from SparkFun electronics.

Step two will be to write the firmware. This will be discussed in my next installment.

Over the last couple of days, I set up my arduino this way:

The potentiometer controls the speed of the pattern being displayed. The arduino reads the analog value of the potentiometer and adjusts the pattern’s delay value based on that.

The program still provides the same 3 patterns: knight rider, wave and binary counter.

I found a really good site today with USB information. They cover everything from an intro (USB in a nutshell) to hardware and development kits and resources.

This is the hardware page.

Another good site is usbdeveloper.

They have a great section about how USB works here.


I received my arduino microcontroller several days ago.

The IDE is simple and the arduino is easy to program. I hooked up a 10 LED strip to it and made several programs to display patterns on it.

1. I made a wave program that starts at one end and lights the LEDs sequentially until they are all lit. Then it starts at the same end and turns them off sequentially. The program does that in an endless loop. It looks like a wave of LEDs.

2. I made a binary counter program. It counts up from 0 and displays the binary value on the LEDs. It starts over at zero when it reaches 1023 (all 10 LEDs lit).

3. I made a program that takes serial input from the computer connected to the arduino via the USB cable. The arduino looks like a USB com port to the computer. When you send a ‘1′, the board displays the knight rider pattern. When you send a ‘2′, the board displays the wave pattern. When you send a ‘3′, the board displays the binary counter pattern. You can send a character at any time and the board will reset the LEDs and start the new pattern.