Saturday, May 28, 2011

Hardware Random Number Generator

I've been playing with various ciphers and encryption schemes, and needed a true random number generator to ensure secrecy. A Pseudo Random Number Generator uses a algorithm to produce a pseudo random number. If the algorithm can be determined, so can the outcome. A Hardware Random Number Generator uses a external event (sound, light, atmospheric noise, etc.) to seed the random number generator. For a neat project, and more info, see

http://robseward.com/misc/RNG2/

http://en.wikipedia.org/wiki/Hardware_random_number_generator

Tuesday, May 24, 2011

Dissolved Oxygen Sensor

Looking for a way to detect dissolved oxygen levels? If you raise fish, this and a ph sensor are two important things to monitor (and of course, temperature), and an Arduino is the ideal platform to build upon. The Sensorex DO1200 ($139) outputs a <1mv - 54 mv signal indicating DO levels. Use

analogReference(INTERNAL1V1);  //Mega & Mega 2560

or


analogReference(INTERNAL); //328p based


to set the top of the input range to 1.1v.

Connect it to one of your analog pins. Very simple to read, just like a potentiometer. Just connect the plus wire (usually red) to your analog input, and the minus wire (black) to Arduino Gnd.

So:


//GND(black original cable)
//A3(red original cable)

int analogPin = 3;     // sensor+ connected to analog pin 3
                       
int val = 0;           // variable to store the value read

 void setup()
{
  Serial.begin(9600);          //  setup serial
  analogReference(INTERNAL1V1); //MEGA 2560
}



 void loop()
{

   val = analogRead(analogPin);    // read the input pin
  Serial.println(val);             // debug value
  delay(500);
}