Show Posts
Pages: 1 [2] 3 4
16  Using Arduino / Project Guidance / Arduino Bios Programmer on: July 30, 2012, 01:24:31 pm
I need help trying to re-flash a bios chip, I looked it up on the internet and I've only found completed projects being showed, not any instructions. Can you please tell me which Arduino ports I connect this chip to: [link]http://pdf1.alldatasheet.com/datasheet-pdf/view/47677/WINBOND/W55F10.html[/link]

Also how do I program the chip with the Asus bios?
17  Using Arduino / Programming Questions / Re: Revolutions Per Minute Calculating Error on: July 14, 2012, 07:15:00 pm
Thanks for all your help, I fixed it.

Code:
//these are just some references for it to work properly
#include <StopWatch.h>
#include <LiquidCrystal.h>
//these are the microcontroller ports that an lcd screen is connected to, a status led, and the switch.
LiquidCrystal lcd(12, 11, 7, 6, 5, 4);
#define LED 13
#define Reed 3 //pin for the switch

//create a timer
StopWatch MySW (StopWatch::MICROS);
//state of sensor 1 or 0
byte reedState=0;
//time between pass of magnet
unsigned long timeSincePass=0.0;
//revolutions per second
float RPS=0.0;
//revolutions per minute
float RPM=0.0;
//last state
byte lastreedState=0;

//just some setup stuff
void setup()
{
  pinMode(LED,OUTPUT);
  pinMode(Reed,INPUT);
  Serial.begin(9600);
  lcd.begin(16, 4);
  lcd.print("RPM");
}


void loop()
{  
  reedState=digitalRead(3);
  //get the state of the sensor;
  //time since pass of magnet
  timeSincePass= MySW.elapsed();
  //set the lcd cursor to write on the second line
  

  //if the magnet engages the switch
  if (reedState != lastreedState && reedState==HIGH)
  {
    //turn on status led for visual purposes
    //convert milliseconds to seconds
    RPS=(float)1000000.0/timeSincePass;
    //reset the timer storage int    
    timeSincePass=0;
    //reset the timer and start it again
    MySW.reset();
    MySW.start();

  }

  if (reedState==HIGH)
  {
    digitalWrite(LED, HIGH); // gives a visual aid to tell when it is being magnetized
  }

  else
  {
    digitalWrite(LED, LOW); //Turns off when no magnet is detected
  }

  //convert seconds to minutes
  RPM=(float)RPS*60.0;
  

  //print the results to a screen
  lcd.print(RPM);
  lcd.setCursor(0, 1);
  lcd.print("Time  ");
  lcd.print(timeSincePass);  
  lcd.print(" MPH ");
  lcd.print();
  lastreedState = reedState;

  Serial.begin(9600);
  Serial.println(RPM);
}

Moderator edit: [code] ... [/code] tags added. (Nick Gammon)
18  Using Arduino / Motors, Mechanics, and Power / Re: How would I control these stepper motors with this driver? on: July 01, 2012, 07:09:40 pm
Also those settings like wave and half step, are those in the programming?
19  Using Arduino / Motors, Mechanics, and Power / Re: How would I control these stepper motors with this driver? on: July 01, 2012, 06:53:34 pm
Sorry, to clarify this motor is the 24v version with 4 wires. Which wires do I connect where? Which wires do I connect where? There is a brown, yellow, orange, and black, and output 1, 2, 3, and 4. Also where do you put the input? to the +5v or the +12v will it step it up to 24v?
20  Topics / Device Hacking / Re: Off Road Traction Control on: July 01, 2012, 01:44:52 pm
One thing that you should definitely do is have a differential. This will spread out the traction between the two wheels (or four if you put on on the front also) and give the non slipping wheel more torque.
21  Using Arduino / Motors, Mechanics, and Power / Re: Torque calculation on: July 01, 2012, 01:24:14 pm
I suggest viewing this video from a guy in my robotics club, it's very useful and interesting.

22  Using Arduino / Motors, Mechanics, and Power / How would I control these stepper motors with this driver? on: July 01, 2012, 01:21:51 pm
I would like to control 2 stepper motors like this one: http://pdf1.alldatasheet.com/datasheet-pdf/view/105735/MITSUMI/M42SP-7.html

Using this motor controller, a 24volt transformer power supply and the arduino:
http://www.ebay.com/itm/180898363604?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1439.l2649#ht_5489wt_1189

I appreciate any help.
23  Using Arduino / Programming Questions / Re: Revolutions Per Minute Calculating Error on: June 19, 2012, 08:11:25 pm
I wasn't using my bike right away for the test I was just testing the concept by doing a simulation of moving the magnet in front with my hand. As for the hall effect, I'll look into that. My reed switch does however seem to be working because the light goes on when I move it in front of it. Also here's my new code, strangely it keeps getting 257 then a decimal like 257.45 and 257.56 rps even when I wait a long time.
Code:

//these are just some references for it to work properly
#include <StopWatch.h>
#include <LiquidCrystal.h>
//these are the microcontroller ports that an lcd screen is connected to, a status led, and the switch.
LiquidCrystal lcd(12, 11, 7, 6, 5, 4);
#define LED 13 //pin for the LED indicator (green)
#define Reed 3 //pin for the switch

//create a timer
StopWatch MySW (StopWatch::MICROS);
//state of sensor 1 or 0
byte reedState=0;
//time between pass of magnet
float timeSincePass=0;
//revolutions per second
float RPS=0;
//revolutions per minute
float RPM=0;
//last state of reed switch on or off
byte lastReedState=LOW;
long lastDebounceTime = 0;
long debounceDelay = 50;

//just some setup stuff
void setup()
{
  pinMode(LED,OUTPUT);
  pinMode(Reed,INPUT);
  Serial.begin(9600);
  lcd.begin(16, 4);
  lcd.print("Your Revs/Sec");
}


void loop()
{
  
  byte reading = digitalRead(Reed);  
  //get the state of the sensor;
  //time since pass of magnet
  timeSincePass= MySW.elapsed();
  //set the lcd cursor to write on the second line
  lcd.setCursor(0, 1);

  if (reading != lastReedState)
  {
    // reset the debouncing timer
    lastDebounceTime = millis();
  }
  
    if ((millis() - lastDebounceTime) > debounceDelay)
  {
    // whatever the reading is at, it's been there for longer
    // than the debounce delay, so take it as the actual current state:
    reedState = reading;
  }

//if the magnet engages the switch
  if (reedState==HIGH)
  {
    //turn on status led for visual purposes
    digitalWrite(LED, HIGH);
    //convert milliseconds to seconds
    RPS=(float)1000000.0/timeSincePass;
    //reset the timer storage int    
    timeSincePass=0;
    //reset the timer and start it again
    MySW.reset();
    MySW.start();
  }

  else
  {
    //turn off led otherwise
    digitalWrite(LED, LOW);
  }
  //convert seconds to minutes
  RPM=(float)RPS*60;
  
  //print the results to a screen
  lcd.print(RPS);
  lcd.print("  ");
  lcd.print(timeSincePass);
  lastReedState = reading;
}
24  Using Arduino / Programming Questions / Re: Revolutions Per Minute Calculating Error on: June 19, 2012, 07:54:43 pm
Oh ok thanks I'll try that.
25  Using Arduino / Programming Questions / Re: Revolutions Per Minute Calculating Error on: June 19, 2012, 09:44:32 am
Ok now I'm getting somewhat more realistic numbers like 200 and 250 revs per second, but still those are the only 2 readings I'm getting.

Code:

//these are just some references for it to work properly
#include <StopWatch.h>
#include <LiquidCrystal.h>
//these are the microcontroller ports that an lcd screen is connected to, a status led, and the switch.
LiquidCrystal lcd(12, 11, 7, 6, 5, 4);
#define LED 13 //pin for the LED indicator (green)
#define Reed 3 //pin for the switch

//create a timer
StopWatch MySW;
//state of sensor 1 or 0
byte reedState=0;
//time between pass of magnet
float timeSincePass=0;
//revolutions per second
float RPS=0;
//revolutions per minute
float RPM=0;
//last state of reed switch on or off
byte lastReedState=LOW;
long lastDebounceTime = 0;
long debounceDelay = 50;

//just some setup stuff
void setup()
{
  pinMode(LED,OUTPUT);
  pinMode(Reed,INPUT);
  Serial.begin(9600);
  lcd.begin(16, 4);
  lcd.print("Your Revs/Sec");
}


void loop()
{
 
  byte reading = digitalRead(Reed); 
  //get the state of the sensor;
  //time since pass of magnet
  timeSincePass= MySW.elapsed();
  //set the lcd cursor to write on the second line
  lcd.setCursor(0, 1);

  if (reading != lastReedState)
  {
    // reset the debouncing timer
    lastDebounceTime = millis();
  }
 
    if ((millis() - lastDebounceTime) > debounceDelay)
  {
    // whatever the reading is at, it's been there for longer
    // than the debounce delay, so take it as the actual current state:
    reedState = reading;
  }

//if the magnet engages the switch
  if (reedState==HIGH)
  {
    //turn on status led for visual purposes
    digitalWrite(LED, HIGH);
    //convert milliseconds to seconds
    RPS=(float)1000/timeSincePass;
    //reset the timer storage int   
    timeSincePass=0;
    //reset the timer and start it again
    MySW.reset();
    MySW.start();
  }

  else
  {
    //turn off led otherwise
    digitalWrite(LED, LOW);
  }
  //convert seconds to minutes
  RPM=(float)RPS*60;
 
  //print the results to a screen
  lcd.print(RPS);
  lcd.print("  ");
  lcd.print(timeSincePass);
  lastReedState = reading;
}
26  Using Arduino / Programming Questions / Re: Revolutions Per Minute Calculating Error on: June 19, 2012, 09:42:21 am
Ooops sorry I thought I made that division change that he suggested Ill change it and get back to you.
27  Using Arduino / Programming Questions / Re: Revolutions Per Minute Calculating Error on: June 19, 2012, 08:48:03 am
Here's my updated code to include a debounce:

Code:

//these are just some references for it to work properly
#include <StopWatch.h>
#include <LiquidCrystal.h>
//these are the microcontroller ports that an lcd screen is connected to, a status led, and the switch.
LiquidCrystal lcd(12, 11, 7, 6, 5, 4);
#define LED 13 //pin for the LED indicator (green)
#define Reed 3 //pin for the switch

//create a timer
StopWatch MySW;
//state of sensor 1 or 0
byte reedState=0;
//time between pass of magnet
float timeSincePass=0;
//revolutions per second
float RPS=0;
//revolutions per minute
float RPM=0;
//last state of reed switch on or off
byte lastReedState=LOW;
long lastDebounceTime = 0;
long debounceDelay = 50;

//just some setup stuff
void setup()
{
  pinMode(LED,OUTPUT);
  pinMode(Reed,INPUT);
  Serial.begin(9600);
  lcd.begin(16, 4);
  lcd.print("Your Revs/Sec");
}


void loop()
{
 
  byte reading = digitalRead(Reed); 
  //get the state of the sensor;
  //time since pass of magnet
  timeSincePass= MySW.elapsed();
  //set the lcd cursor to write on the second line
  lcd.setCursor(0, 1);

  if (reading != lastReedState)
  {
    // reset the debouncing timer
    lastDebounceTime = millis();
  }
 
    if ((millis() - lastDebounceTime) > debounceDelay)
  {
    // whatever the reading is at, it's been there for longer
    // than the debounce delay, so take it as the actual current state:
    reedState = reading;
  }

//if the magnet engages the switch
  if (reedState==HIGH)
  {
    //turn on status led for visual purposes
    digitalWrite(LED, HIGH);
    //convert milliseconds to seconds
    RPS=(float)timeSincePass*1000;
    //reset the timer storage int   
    timeSincePass=0;
    //reset the timer and start it again
    MySW.reset();
    MySW.start();
  }

  else
  {
    //turn off led otherwise
    digitalWrite(LED, LOW);
  }
  //convert seconds to minutes
  RPM=(float)RPS*60;
 
  //print the results to a screen
  lcd.print(RPS);
  lcd.print("  ");
  lcd.print(timeSincePass);
  lastReedState = reading;
}
28  Using Arduino / Programming Questions / Re: Revolutions Per Minute Calculating Error on: June 18, 2012, 11:59:14 pm
I sort of made it into a reciprocal when I divided 1000 by the milliseconds which would be the same as dividing 1 by the seconds. Ex: 5 seconds = 5/1 1 divided by 5 = 1/5 opposite of 5/1. I think the math is right as far as i can tell. Constructive criticism would be appreciated to help me find the right solution.
29  Using Arduino / Programming Questions / Re: Revolutions Per Minute Calculating Error on: June 18, 2012, 11:52:01 pm
My intention was to measure the speed of a bike wheel as it turns in revolutions per second or minute and then calculate that to the actual speed using the wheel size. Also I tried using a debounce to make sure I wasn't getting the magnetic reed giving me 2 readings and I still have the same thing not the right reading. Any suggestions?
30  Using Arduino / Programming Questions / Re: Revolutions Per Minute Calculating Error on: June 18, 2012, 07:28:40 pm
Ok thanks that's a good idea. Ill look into it and get back to you if it doesn't work.
Pages: 1 [2] 3 4