( ! ) Warning: Declaration of Suffusion_MM_Walker::start_el(&$output, $item, $depth, $args) should be compatible with Walker_Nav_Menu::start_el(&$output, $item, $depth = 0, $args = NULL, $id = 0) in /var/www/public/arduino/wp-content/themes/suffusion/library/suffusion-walkers.php on line 39
Call Stack
#TimeMemoryFunctionLocation
10.0002342528{main}( ).../index.php:0
20.0004344216require( '/var/www/public/arduino/wp-blog-header.php' ).../index.php:17
31.543327438984require_once( '/var/www/public/arduino/wp-includes/template-loader.php' ).../wp-blog-header.php:19
41.546027449888include( '/var/www/public/arduino/wp-content/themes/suffusion/author.php' ).../template-loader.php:98
51.546027449888get_header( ).../author.php:12
61.546027450160locate_template( ).../general-template.php:41
71.546027450240load_template( ).../template.php:671
81.546327462000require_once( '/var/www/public/arduino/wp-content/themes/suffusion/header.php' ).../template.php:722
91.557827471304wp_head( ).../header.php:50
101.557827471304do_action( ).../general-template.php:2879
111.557827471576WP_Hook->do_action( ).../plugin.php:478
121.557827471576WP_Hook->apply_filters( ).../class-wp-hook.php:312
131.578127505744Suffusion_Framework->specific( ).../class-wp-hook.php:288
141.578227505936require_if_theme_supports( ).../framework.php:230

alin

mai 162014
 

Ok, this is an easy one to make. We are going to use a hall effect switch to turn the Arduino UNO’s built-in led on and off with a magnet.

We will be using the Allegro Microsystems A1120EUA Hall Effect Switch

  • Connect pin 1 of the switch to the Arduino +5V supply (red wire)
  • Connect pin 2 to 0V (black wire)
  • Connect pin 3 to Arduino input pin 12 (orange wire)

A pull-up resistor is required between pin 1 and pin 3 to pull-up the switch’s output to +5V.

When the switch detects a magnet, it will pull it’s output pin low, which we can easily detect on the Arduino board.

hall-effect-breadboard

Here is the Arduino sketch

/*
 Hall Effect Switch
 
 Turns on and off a light emitting diode(LED) connected to digital  
 pin 13, when Hall Effect Sensor attached to pin 2 is triggered by a magnet
 
 Hall effect sensor used is the A1120EUA from Allegro Microsystems
 
 This example code is in the public domain.
 
 http://www.hobbytronics.co.uk/arduino-tutorial8-hall-effect
*/

// constants won't change. They're used here to set pin numbers:
const int hallPin = 12;     // the number of the hall effect sensor pin
const int ledPin =  13;     // the number of the LED pin
// variables will change:
int hallState = 0;          // variable for reading the hall sensor status

void setup() {
  // initialize the LED pin as an output:
  pinMode(ledPin, OUTPUT);      
  // initialize the hall effect sensor pin as an input:
  pinMode(hallPin, INPUT);     
}

void loop(){
  // read the state of the hall effect sensor:
  hallState = digitalRead(hallPin);

  if (hallState == LOW) {     
    // turn LED on:    
    digitalWrite(ledPin, HIGH);  
  } 
  else {
    // turn LED off:
    digitalWrite(ledPin, LOW); 
  }
}
ian. 052013
 

fm.mp4_snapshot_00.42_2011.02.08_14.45.25-300x168[1]

Old wish to make digitally controlled FM tuner come true when I found on Ebay cheap module with TEA5767 (Low-power FM stereo radio for handheld applications).

B1M7u9QBGkKGrHqYOKiIEV7hWnCPBMdgsNVlV_12-e1297170953699[1]

This module size is only 11.2mm x 11mm. TEA 5767 supports I2C.  Pinout and wiring:

pinout_TEA5767module[1]

For antenna i have used just 75 cm long wire, because that is 1/4 of wavelength at 100 MHz. TEA5767 doesn’t have audio amplifier, sound output level is very low, headphone can not be connected directly. During testing i had connected audio output to PC audio system.

Writing to TEA5767

Radio chip is controlled by writing 5 bytes one by one. During writing TEA5767  IC2 address is 0×60, reading – 0×61. Arduino IDE supports only 7 bit address ant last bite is assigned automatically,  so  in code 0×60 is used as address.

   frequency=87.5; //starting frequency

   frequencyB=4*(frequency*1000000+225000)/32768; //calculating PLL word

   frequencyH=frequencyB>>8;

  frequencyL=frequencyB&0XFF;

  delay(100);

  Wire.beginTransmission(0x60);   //writing TEA5767

  Wire.send(frequencyH);
  Wire.send(frequencyL);
  Wire.send(0xB0);
  Wire.send(0x10);
  Wire.send(0x00);
  Wire.endTransmission();

This is code responsible for starting frequency of FM receiver.

Frequency is controlled by 14 bit word, that is written to two 8 bit registers.

Example of word calculating is given in datasheet.

3 byte (0xB0): high side LO injection is on,.

4 byte (0×10) : Xtal is 32.768 kHz

5 byte (0×00)

Reading TEA5767

Reading is performed every time in the loop

  Wire.requestFrom(0x60,5); //reading TEA5767

  if (Wire.available()) 

  {
    for (int i=0; i<5; i++) {

      buffer[i]= Wire.receive();
    }

    freq_available=(((buffer[0]&0x3F)<<8)+buffer[1])*32768/4-225000;

    lcd.print("FM ");

    lcd.print((freq_available/1000000));

    frequencyH=((buffer[0]&0x3F));

    frequencyL=buffer[1];

    if (search_mode) {

      if(buffer[0]&0x80) search_mode=0;

    }

    if (search_mode==1) lcd.print(" SCAN");
    else {
      lcd.print("       ");
    }

    lcd.setCursor(0, 1);

    lcd.print("Level: ");
    lcd.print((buffer[3]>>4));
    lcd.print("/16 ");

    if (buffer[2]&0x80) lcd.print("STEREO   ");
    else lcd.print("MONO   ");

  }

1 byte has information about search status and part of frequency word

2 byte has remaining information about frequency

3 byte – Stereo indicator

4 byte – Signal level

5 byte – reserved

Search

Search mode is on by pressing up or down buttons longer. TEA 5767 stars scanning up or down with 100kHz steps.  Search stop level can be selected.

1 byte (Search mode on/off)

2 byte (Search up/down , stop level)

If station if found ready flag is on (1 byte).

Demo

All code

/// Arduino FM receiver with TEA5767 http://www.electronicsblog.net
#include <Wire.h>
#include <LiquidCrystal.h>

unsigned char search_mode=0;

int b=0;
int c=0;

#define Button_next 30
#define Button_prev 31

unsigned char frequencyH=0;
unsigned char frequencyL=0;

unsigned int frequencyB;
double frequency=0;

double freq_available=0; 

LiquidCrystal lcd(12, 11, 5, 4, 3, 2); 

void setup()   { 

  Wire.begin();
  lcd.begin(16, 2);

  /// buttons  

  pinMode(Button_next, INPUT);
  digitalWrite(Button_next, HIGH); //pull up resistor

  pinMode(Button_prev, INPUT);
  digitalWrite(Button_prev, HIGH); //pull up resistor

  frequency=87.5; //starting frequency

  frequencyB=4*(frequency*1000000+225000)/32768; //calculating PLL word

  frequencyH=frequencyB>>8;

  frequencyL=frequencyB&0XFF;

  delay(100);

  Wire.beginTransmission(0x60);   //writing TEA5767

  Wire.send(frequencyH);
  Wire.send(frequencyL);
  Wire.send(0xB0);
  Wire.send(0x10);
  Wire.send(0x00);
  Wire.endTransmission();

  delay(100);

}

void loop()
{

  unsigned char buffer[5];

  lcd.setCursor(0, 0);

  Wire.requestFrom(0x60,5); //reading TEA5767

  if (Wire.available()) 

  {
    for (int i=0; i<5; i++) {

      buffer[i]= Wire.receive();
    }

    freq_available=(((buffer[0]&0x3F)<<8)+buffer[1])*32768/4-225000;

    lcd.print("FM ");

    lcd.print((freq_available/1000000));

    frequencyH=((buffer[0]&0x3F));

    frequencyL=buffer[1];

    if (search_mode) {

      if(buffer[0]&0x80) search_mode=0;

    }

    if (search_mode==1) lcd.print(" SCAN");
    else {
      lcd.print("       ");
    }

    lcd.setCursor(0, 1);

    lcd.print("Level: ");
    lcd.print((buffer[3]>>4));
    lcd.print("/16 ");

    if (buffer[2]&0x80) lcd.print("STEREO   ");
    else lcd.print("MONO   ");

  }

  ///// buttons read

  //////////// button_next////////// 
  if (!digitalRead(Button_next)&&!b) {

    frequency=(freq_available/1000000)+0.05;

    frequencyB=4*(frequency*1000000+225000)/32768+1;

    frequencyH=frequencyB>>8;
    frequencyL=frequencyB&0XFF;   

    Wire.beginTransmission(0x60);   

    Wire.send(frequencyH);
    Wire.send(frequencyL);
    Wire.send(0xB0);
    Wire.send(0x1F);
    Wire.send(0x00); 

    Wire.endTransmission(); 

    //////////////////////

    b=100;

  };

  if (!digitalRead(Button_next)&&b==1) {

    ///scannnn UP

    search_mode=1;

    Wire.beginTransmission(0x60);   

    Wire.send(frequencyH+0x40);
    Wire.send(frequencyL);
    Wire.send(0xD0);
    Wire.send(0x1F);
    Wire.send(0x00); 

    Wire.endTransmission();

    /////////////////

    b=100;

  };    

  if (!b==0) b--;

  //////////// button_prev////////// 
  if (!digitalRead(Button_prev)&&!c) {

    frequency=(freq_available/1000000)-0.05;

    frequencyB=4*(frequency*1000000+225000)/32768+1;

    frequencyH=frequencyB>>8;
    frequencyL=frequencyB&0XFF;

    Wire.beginTransmission(0x60);   

    Wire.send(frequencyH);
    Wire.send(frequencyL);
    Wire.send(0xB0);
    Wire.send(0x1F);
    Wire.send(0x00); 

    Wire.endTransmission(); 

    c=100;

  };

  if (!digitalRead(Button_prev)&&c==1) {

    ///scannnn DOWN

    search_mode=1;

    Wire.beginTransmission(0x60);   

    Wire.send(frequencyH+0x40);
    Wire.send(frequencyL); 

    Wire.send(0x50);
    Wire.send(0x1F);
    Wire.send(0x00);
    Wire.endTransmission();   

    c=100;

  };          

  if (!c==0) c--;

  ////////////////////

}

Code have some problem with frequency control/indication. Button press doesn’t always adds/subtracts exactly 0,05 MHz. Also later i found in application note, that after search frequency word must be rounded and sent back to tuner, because with 32768 Hz Xtal search step is not 100 kHz, but 98.304 kHz.

Source:http://www.electronicsblog.net/arduino-fm-receiver-with-tea5767/

ian. 022013
 

acs

int VQ;
int ACSPin = A2;
void setup() {
Serial.begin(9600);
VQ = determineVQ(ACSPin); //Quiscent output voltage – the average voltage ACS712 shows with no load (0 A)
delay(1000);
}

void loop() {
Serial.print(„ACS712@A2:”);Serial.print(readCurrent(ACSPin),3);Serial.println(” mA”);
delay(150);
}

int determineVQ(int PIN) {
Serial.print(„estimating avg. quiscent voltage:”);
long VQ = 0;
//read 5000 samples to stabilise value
for (int i=0; i<5000; i++) {
VQ += analogRead(PIN);
delay(1);//depends on sampling (on filter capacitor), can be 1/80000 (80kHz) max.
}
VQ /= 5000;
Serial.print(map(VQ, 0, 1023, 0, 5000));Serial.println(” mV”);
return int(VQ);
}

float readCurrent(int PIN) {
int current = 0;
int sensitivity = 185.0;//change this to 100 for ACS712-20A or to 66 for ACS712-30A
//read 5 samples to stabilise value
for (int i=0; i<5; i++) {
current += analogRead(PIN) – VQ;
delay(1);
}
current = map(current/5, 0, 1023, 0, 5000);
return float(current)/sensitivity;
}

ian. 022013
 

volts[1]

Since we are involved in off grid solar power systems, we have a need to monitor battery voltage. The Arduino can do this easily with a simple voltage divider. With some simple mods, we can control loads, generators, or notifications based on battery voltage.

To read a maximum of 20vdc, R1 should be 3k ohm, R2 should be 1k ohm, and the code would be as follows:

/*
DisplayMoreThan5V sketch
prints the voltage on analog pin to the serial port
Do not connect more than 5 volts directly to an Arduino pin.
*/

const int referenceVolts = 5; // the default reference on a 5-volt board
//const float referenceVolts = 3.3; // use this for a 3.3-volt board

const int R1 = 3000; // value for a maximum voltage of 20 volts
const int R2 = 1000;
// determine by voltage divider resistors, see text
const int resistorFactor = 255 / (R2/(R1 + R2));
const int batteryPin = 0; // +V from battery is connected to analog pin 0

void setup()
{
Serial.begin(9600);
}

void loop()
{
int val = analogRead(batteryPin); // read the value from the sensor
float volts = (val / resistorFactor) * referenceVolts ; // calculate the ratio
Serial.println(volts); // print the value in volts
}

 

Sursa articol :http://arduinotronics.blogspot.ro/2011/03/monitoring-voltage-of-dc-battery-supply.html

 Posted by at 01:51
aug. 192011
 

First of all, you will need to wire the DHT11 sensor and the LCD as shown in the circuit diagram below:

Fig 1: Circuit to wire up the Arduino the LCD and the DHT11 sensor

Fig 1: Circuit to wire up the Arduino the LCD and the DHT11 sensor

Loading the program to get the weather station going:

The code for reading the Sensor data and displaying it on the LCD is available here,
The code is very easy to read and understand and you can tweak it to your advantage..

Once the code is loaded the Weather Station should be reading the Temperature and Humidity reading and displaying it on the cool blue backlight screen!!!

DESCRIPTION:

This is our original weather station kit. You will be surprised how much you can learn from it, such as how to connect sensors and write program to read the data, and display it on a LCD display. What you can do with this kit is only limited by your imagination. All the wiring diagram and datasheet is available from our website. We have include the source code in the CD to make sure that you can get it up and running once the components are hooked up. For any of our products combined shipping is welcome.   The kit includes:

  • Arduino Duemilanove
  • USB cable – Arduino ProtoShield + mini breadboard
  • Breadboard wires (approx. 70 pcs)
  • 1402 Blue backlit LCD display
  • Photo transistor 3533
  • Digital temperature and humidity sensor DHT11
  • CD with the software to get it running Its easy to add in more sensors (like windspeed etc) and customize it to do what you want!

Wii Motion Plus + Arduino

 Articole  Comentariile sunt închise pentru Wii Motion Plus + Arduino
feb. 022011
 

Ok so I, after much research, have been able to read the gyro data of the new wii motion plus peripheral with the arduino microcontroller. With this code and the code previously developed for the wii nunchuck (here), we are able to create a 6 DOF IMU for under $40. Thanks Nintendo! Best of all, everything is I2C so only 2 analog inputs (A4 and A5 needed for the wire library) are needed to read 6 sensors and no ADC conversion happens on the arduino board.

Links and Thanks:
First off, I’m going to link(and thank) a few sites that have helped me immensely with this undertaking:
Arduino.cc
original nunchuck code
Wii brew WM+ info
Propeller forums

Hardware connections:
I used full 5V TTL signals and power and have had no problems thus far (a week going strong) but if you have a 3.3v arduino or a level converter and 3.3v regulator, i would suggest that over a 5v connection. Furthermore, twi.h under the wire library does not need to be changed for my setup but might under some setups. Start with the default 100khz TWI_FREQ and if that doesnt work, use 400khz. Websites disagree about which is the proper speed for direct I2C on wii peripherals. Connections to WM+ are same as nunchuck and look like this:

| 1 2 3 |
|       |
| 6 5 4 |
|_-----_|

1 – green – data
2 – nothing
3 – red – 3.3+v
4 – yellow – clock
5 – nothing
6 – white – ground

So its pin 3 to 5v, 6 to ground, 1 to A4, and 4 to A5

Adapters such as the one sold here should (theoretically) work; I use jumper wires and hot glue

Software:

I have commented the demo code pretty well so it should be easy to follow, if not comment here or on Arduino.cc Forums->Exhibition

#include <Wire.h>
byte data[6]; //six data bytes
int yaw, pitch, roll; //three axes
int yaw0, pitch0, roll0; //calibration zeroes

void wmpOn(){
Wire.beginTransmission(0x53); //WM+ starts out deactivated at address 0x53
Wire.send(0xfe); //send 0x04 to address 0xFE to activate WM+
Wire.send(0x04);
Wire.endTransmission(); //WM+ jumps to address 0x52 and is now active
}

void wmpSendZero(){
Wire.beginTransmission(0x52); //now at address 0x52
Wire.send(0x00); //send zero to signal we want info
Wire.endTransmission();
}

void calibrateZeroes(){
for (int i=0;i<10;i++){
wmpSendZero();
Wire.requestFrom(0x52,6);
for (int i=0;i<6;i++){
data[i]=Wire.receive();
}
yaw0+=(((data[3]>>2)<<8)+data[0])/10; //average 10 readings
pitch0+=(((data[4]>>2)<<8)+data[1])/10;
roll0+=(((data[5]>>2)<<8)+data[2])/10;
}
Serial.print(„Yaw0:”);
Serial.print(yaw0);
Serial.print(” Pitch0:”);
Serial.print(pitch0);
Serial.print(” Roll0:”);
Serial.println(roll0);
}

void receiveData(){
wmpSendZero(); //send zero before each request (same as nunchuck)
Wire.requestFrom(0x52,6); //request the six bytes from the WM+
for (int i=0;i<6;i++){
data[i]=Wire.receive();
}
yaw=((data[3]>>2)<<8)+data[0]-yaw0;
pitch=((data[4]>>2)<<8)+data[1]-pitch0;
roll=((data[5]>>2)<<8)+data[2]-roll0;
}
//see http://wiibrew.org/wiki/Wiimote/Extension_Controllers#Wii_Motion_Plus
//for info on what each byte represents
void setup(){
Serial.begin(115200);
Serial.println(„WM+ tester”);
Wire.begin();
wmpOn(); //turn WM+ on
calibrateZeroes(); //calibrate zeroes
delay(1000);
}

void loop(){
receiveData(); //receive data and calculate yaw pitch and roll
Serial.print(„yaw:”);//see diagram on randomhacksofboredom.blogspot.com
Serial.print(yaw); //for info on which axis is which
Serial.print(” pitch:”);
Serial.print(pitch);
Serial.print(” roll:”);
Serial.println(roll);
delay(100);
}
Orientation:

Sorry for the arrows being all in the negative direction. Picture was done quickly.

source : randomhacksofboredom.blogspot.com

Miniarduino

 Articole, Documentatie  Comentariile sunt închise pentru Miniarduino
dec. 282010
 

Nevoia de miniaturizare i-a impins pe electronisti sa creeze opere de arta.

mai jos o sa prezit proiectul  One Chip Arduino preluat de pe http://www.geocities.jp/arduino_diecimila/obaka/project-2/index_en.html

  • The circuit of LilyPad arduino is mounted on the DIP of ATmega88.
  • There are Reset-SW,Skech loading pin-header and LED of D13.
  • Using internal clock 8MHz.
  • Doesn’t put ICSP pin-header because there is no space.
  • Cost is less than 500yen($5).
  • Source code of bootloader for the ATmega88 which is made by Mr. bird.dip.jp. And recompiled it with clock 8MHz.
  • Writing the sketch uses an USB-Serial converter.

LCD Digital Clock

It used „One Chip Arduino”, LCD and RTC. A breadboard can still afford.

Arduino on Arduino

I made DIP a flat by force to hold down height. And added the pin-header of ICSP.

It’s form such as a weird bug. The downside is more weird. When it was connected by ICSP cable , and it hung down, it seems to be „that Bug” of „The MATRIX”

Connected LCD. And display „those words”.

„One Chip Arduino” which I made as a joke. But, when I use it in a breadboard it is useful because mount area is so small.

 Posted by at 09:51

Modificarea servo motoarelor

 Articole, Documentatie  Comentariile sunt închise pentru Modificarea servo motoarelor
dec. 272010
 

Am vazut ca cele mai ieftine servo motoare nu depasesc cu mult 20 roni, dar au un dezavantaj enorm cursa prea mica si anume 60 de grade.

Am cautat pe internet si am gasit cum se poate modifica in servo motor pentru a obtine o miscare continua la 360 de grade .

sau

Voi ce parere aveti?