Show Posts
Pages: 1 2 3 [4] 5 6 ... 17
46  Using Arduino / General Electronics / Re: Teach me how to USE Ohm's law on: June 23, 2012, 11:46:42 am
I know Ohm's law, have since I was 2. But, I don't know how to use it. All my experimenting life I have sought out the power supply I need, rather than make due with what I have. Well, no more. I need a power supply, 5V. I have all sorts of wall warts and old lappy bricks.

How do I get 5V from say a laptop brick that is rated 19V. I know it's a stupid question, but I can't be the only learning disabled one here.

The easiest way to do this is to make a power supply that takes 19V in and emits 5V. A handful of parts will do this.

It doesn't tell you how to use Ohm's Law, of course. But this project doesn't really require it.

The wall-wart will be rated for some amount of current; Ohm's Law can inform us as to how that could change with respect to the new circuit it will be powering.
47  Development / Other Software Development / Re: programming IDE on: June 23, 2012, 08:25:42 am

So now I was wondering if you guys can help me with some tips because im pretty mutch a beginner here.
For example I'm not very happy with the sketch IDE of Arduino is there a way for me to build my projects in a visual studio kind of IDE? are there other things I need to know?

I do have a long programming background but embedded programming is very new for me so any tips will help.

Start with the FAQ. Search for "IDE" and you will see two relevant starting points. Digest that and then come back here with follow-up questions.
48  Using Arduino / Project Guidance / Re: Is it possible to make the robot to turn X degrees and Move Y meters? on: June 22, 2012, 09:17:40 am
AWOL

I agree with you, two functions sounds a better approach.

As Mike Said, it is difficult to determine if it has turned or moved 100 meter. However, It may be possible to use digital compass for this as I heard that it is used to measure the rotation of objects like motors.

the other challenge might be the obstacle. for example, if it turned 45 degrees and moved 10 meters and sees a wall, still need to travel 90 meters after passing the wall. so it looks for a way to pass the wall. any recommendations in this point?

Kind regards

Look up "rotary encoders" and "Gray codes", as this is what is typically used to figure out distance and rotation.  Well, you will have to figure out the obstacle avoidance and wall-following stuff. But you are nowhere unless you know how many turns a wheel has taken, or in what direction a steering mechanism has turned you.
49  Using Arduino / Programming Questions / Re: Revolutions Per Minute Calculating Error on: June 19, 2012, 10:00:11 pm
Can someone please help me with this code. It is supposed to detect the revolutions per second on a bicycle wheel and then convert it to revolutions per minute. The magnetic sensor code works fine, the timer resets itself when it passes by, but no matter what speed or increment of time i wait to pass the magnet by again, it only comes up with 2 readings 5,000 and 6,000, which are not goods revolution per second readings. I expect to get some number like 230.14 or something random like that. My code is below. Any help is appreciated.


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;

//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()
{
  //get the state of the sensor
  reedState=digitalRead(Reed);
  //time since pass of magnet
  timeSincePass= MySW.elapsed();
  //set the lcd cursor to write on the second line
  lcd.setCursor(0, 1);

//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);
}

There was a lively conversation about this on another thread recently. If you _really_ need error correction, you might want to look into rotary encoding and Gray codes.
50  Using Arduino / Project Guidance / Re: Project PID Fan 24 Volt DC with input Sensor DS18B20 on: June 19, 2012, 09:56:32 pm
Hello all,
i have a problem
How to make PID Controller on Fan 24 Volt DC...
i hope someone teach me about schematic driver fan and programming PID.....

See here: http://arduino.cc/playground/Code/PIDLibrary

Google was instructive, too.
51  Using Arduino / Programming Questions / Re: Dual way serial communication on: June 19, 2012, 09:43:01 pm
ugh! anyone gonna help? ive busted my balls for 10 hours trying to figure this out.

An example that builds up to a duplex serial comms: http://itp.nyu.edu/physcomp/Labs/SerialDuplex

I'm not duplexing anything?

I'm getting the arduino to receive and send on two serial ports allowing two serialports to communicate with eachother

Serial TX: hello
Serial3 RX: hello
Serial3 TX: hi back
Serial RX: hi back

This is as basic as i can get the code but it dont work?
Code:
void setup()
{
   Serial.begin(9600);
   Serial3.begin(9600);
}
void loop(void)
{
  if(Serial.read())
  {
    Serial3.println(Serial.read() - '0');
  }
  if(Serial3.read())
  {
    Serial.println(Serial3.read() - '0');
  }
}



Ok, this is a pretty contrived (and, to me, not particularly useful) example.

But, why are you reading a byte and discarding it? Check out http://arduino.cc/en/Serial/Available
52  Using Arduino / Programming Questions / Re: Dual way serial communication on: June 19, 2012, 07:16:48 pm
ugh! anyone gonna help? ive busted my balls for 10 hours trying to figure this out.

An example that builds up to a duplex serial comms: http://itp.nyu.edu/physcomp/Labs/SerialDuplex
53  Using Arduino / Project Guidance / Re: [SOS] college project-CNC on: June 19, 2012, 10:39:30 am
thx for ur suggestion   smiley  ..but the electronic part different with what i gonna to use

I guess you got some homework to do, then!

No one is going to do your project for you. You need to spend a little time thinking about what you want to do, what are the essentials and what are the nice-to-haves, and then work from there. Come back here to ask specific questions about aspects of something you have tried already.

My advice is to prototype as you go, building things up on pieces. The link you were given is a great start because it shows you what you have to care about to make a basic CNC device.

Hint: asking for help on a forum is not the same as doing research or making progress on a project you will be graded on. What you are choosing to do can be a very large project, and there is a long road between idea and a working device. But it can be done.
54  Using Arduino / Installation & Troubleshooting / Re: Smoke of death on: June 19, 2012, 10:30:57 am
don't worry, sparkfun sell a smoke refill kit http://www.sparkfun.com/products/10622

That only works the beginning of April.
55  Using Arduino / Installation & Troubleshooting / Re: Arduino 1.0.1 Stuck in Windows 7 on: June 19, 2012, 09:53:10 am
Never mind! I' ve just moved the "arduino-1.0.1-windows" folder to Program Files and created a shortcut of the arduino.exe on the Desktop. It works just fine! Thank you for your time and help  smiley

Yeah, the Desktop thing on Windows is a little special now. It isn't just a plain folder anymore. Same with Documents and so on.
56  Using Arduino / Project Guidance / Re: Sensor for bicycle speed? on: June 19, 2012, 09:00:44 am

Don't measure by taking dirty readings off the rim! Measure an encoded disk attached to the spindle. The simplest arrangement is a single-bit on/off count, which works because, in this specific case, we really don't need to know when the "start" bit is, or what direction we are going in. Capture this with a common IR LED/IR phototransistor pair device (these are common in older optical mice) and you basically have a square wave you can extract useful information from. A lot of the specialty robotics places will have the parts to do this. Some motors have encoding built in so you can get feedback from them on direction, speed, etc.

Some are based on make/break with a disc that has regular holes in it. Others work by having encoded white/black patches that can be read by bouncing LED light off of them and reading that.

If you need to know more about the rotation, like direction, or you want to do error correction, use more than a single bit and extract a Gray code from a more complex encoded disc.

Do a web search for "Gray code" and "rotary encoding" to see what I mean. Very common and very well understood way of measuring rotation under all kinds of environments.

I would love to see an example, looking near the axles on my bikes I don't see a lot of options for mounting an encoder disk, of course I may just be obtuse!

Well, looking at my bike I think I could attach a stiff disc near the hub, directly to the spokes. Nylon ties would do in a pinch for prototyping. Then mount a reflective type LED/phototransistor pair to the lower fork aimed at the pattern. I'd want to do a little research to choose the appropriate light frequency they would operate on to minimize noise (if necessary). For a first pass I might paint/print a CD or DVD with the right pattern and try to fit that somehow.

But way back in my first reply I mentioned something I think would be really elegant: for those bikes with disc brakes, encode the pattern in the discs themselves, and build the reader into the calipers.
57  Using Arduino / Project Guidance / Re: Sensor for bicycle speed? on: June 18, 2012, 10:06:09 pm
Rotary encoded spindles can be reasonably isolated from ambient light -- this stuff is used in all sorts of real-life situations for industrial control. And, at its simplest form it is generating a single square wave (i.e., no real Gray code involved) so not much room for error. Even so, a Gray code, if used, gives you a fair amount of dependable error correction.

Yes, maybe, but since most rims are chrome (or other reflective material) and bikes are out in ambient daylight I don't think optical sensors are going to prove useful in that environment-solar glare at the right angle will easily diminish the difference between a black area and a white area to be beyond the sensitivity of the sensor designed to detect during lower ambient levels..  All of the optical sensors I have experience with have fairly controlled environments, for instance light shielding, extremely close proximate to the moving object, etc...  I just don't see that working without a lot of effort on a typical bicycle.

Don't measure by taking dirty readings off the rim! Measure an encoded disk attached to the spindle. The simplest arrangement is a single-bit on/off count, which works because, in this specific case, we really don't need to know when the "start" bit is, or what direction we are going in. Capture this with a common IR LED/IR phototransistor pair device (these are common in older optical mice) and you basically have a square wave you can extract useful information from. A lot of the specialty robotics places will have the parts to do this. Some motors have encoding built in so you can get feedback from them on direction, speed, etc.

Some are based on make/break with a disc that has regular holes in it. Others work by having encoded white/black patches that can be read by bouncing LED light off of them and reading that.

If you need to know more about the rotation, like direction, or you want to do error correction, use more than a single bit and extract a Gray code from a more complex encoded disc.

Do a web search for "Gray code" and "rotary encoding" to see what I mean. Very common and very well understood way of measuring rotation under all kinds of environments.

58  Using Arduino / Installation & Troubleshooting / Re: Arduino 1.0.1 Stuck in Windows 7 on: June 18, 2012, 08:13:53 pm
After some more frustration, I managed to get a new file in the folder which is called "launch4j" and it is a .txt file. This is the information in it:


CmdLine:   C:\Users\Σωτήρης\Desktop\arduino-1.0.1-windows\arduino-1.0.1\arduino.exe --l4j-debug
WOW64:      no
Working dir:   C:\Users\Σωτήρης\Desktop\arduino-1.0.1-windows\arduino-1.0.1\.
Bundled JRE:   java
Check launcher:   C:\Users\Σωτήρης\Desktop\arduino-1.0.1-windows\arduino-1.0.1\java\bin\javaw.exe (OK)
Add classpath:   lib\pde.jar
Add classpath:   lib\core.jar
Add classpath:   lib\jna.jar
Add classpath:   lib\ecj.jar
Add classpath:   lib\RXTXcomm.jar
Launcher:   C:\Users\Σωτήρης\Desktop\arduino-1.0.1-windows\arduino-1.0.1\java\bin\javaw.exe
Launcher args:   -Xms128m -Xmx128m -classpath "lib;C:\Users\Σωτήρης\Desktop\arduino-1.0.1-windows\arduino-1.0.1\java\lib\tools.jar;lib\pde.jar;lib\core.jar;lib\jna.jar;lib\ecj.jar;lib\RXTXcomm.jar" processing.app.Base
Args length:   200/32768 chars
Exit code:   1


Then I opened the notepad and typed in "--verbose:class" and saved it with the name "Arduino.ini" in the folder where the "arduino.exe" file is. But when I type in the Command Line:
cd "C:\Users\Σωτήρης\Desktop\arduino-1.0.1-windows\arduino-1.0.1\arduino.exe" Arduino --l4j-debug

and this is what I get: "The system cannot find the path specified."
Also I can't type two lines in cmd, just a single straight one...

Yes, you type a command and then hit Return. Then you type another and hit Return again.

(Did you really install to your Desktop? That's a bit odd...)

My mistake. The Arduino.ini file should contain "-verbose:class". Note only a single hyphen.

Though, truth be told, I don't think it will tell us more. That exit code of 1 tells us that there was a fundamental failure running Java.

What happens if you run:

C:\Users\Σωτήρης\Desktop\arduino-1.0.1-windows\arduino-1.0.1\java\bin\javaw.exe -version

All of this stuff should be properly localized, but you may as well create a test account on this system that has a user ID with only Latin-1 characters in it. Try running Arduino from that account.

Also, make sure you disable all real-time anti-virus protection processes. These will interfere with applications in all sort of confusing ways.
59  Using Arduino / Project Guidance / Re: Sensor for bicycle speed? on: June 18, 2012, 07:58:58 pm
How about something optic? On one fork, have a light shining, on the other a light receiver, on the spokes a set of holes that let light thru.
Light received can be digitally processed like pulses, or can be filtered like a PWM signal to make a smoother analog level. The higher the level, the faster the pulses are being created. Can then just monitor the voltage level for changes vs having to process all the digital pulses.

Optical sensors on a bike are going to present a signal conditioning problem.  The sensor has to be more complicated then a simple break beam sensor since the varying light levels will affect the behavior of the sensor.  If you want to go with optical, I can probably dredge up a circuit I used for a projectile sensor to deal with the same issue of varying ambient light. All of the sensors on my bikes (commercial) make use of magnets and hall effect sensors.

Rotary encoded spindles can be reasonably isolated from ambient light -- this stuff is used in all sorts of real-life situations for industrial control. And, at its simplest form it is generating a single square wave (i.e., no real Gray code involved) so not much room for error. Even so, a Gray code, if used, gives you a fair amount of dependable error correction.
60  Using Arduino / Project Guidance / Re: Sensor for bicycle speed? on: June 18, 2012, 01:06:29 pm
Which sensor would you recommend to measure bicycle speed very accurately?

A usual sensor is a reed relay, which gives a pulse, when a magnet passes. The magnet is attached in one spoke (of e.g. 32 spokes total).

But now I am interested in knowing the speed about 32 times during each revolution in order to find out small variations in acceleration e.g.due to pedalling. For my own bicycle only, no commercial product. Speed range 0 - 20 m/s, wheel diameter about 24 ". Rainy  or snowy days need not be considered, asphalt roads only. Reasonably easy to build and install at home. Programming can be complicated though.

One could put 32 magnets to the wheel, one for each spoke. But that would be clumsy, magnets are different in sensitivity and they have contact bouncing.

Which kind of sensor would you consider?

Off the top of my head, as I was /just/ thinking about this for my bike computer I'm designing.

You could make an optical rotary encoder that passes continually through a LED/phototransistor pair that tells you where on the wheel you are.

This is done a lot in industrial control, usually to measure angles and linear movement. I'm not sure if it would be able to keep up with the rates of speed we are talking about here (though you could just add another sensor if it was critical), but I see no technical reason why not. I'd have to actually try it.

For sure you would want to mount the sensor and formatted disk closer to the hub.

I'm not sure how much granularity you want, or can get, or need.

[Later]

If one planned for this when making disc brakes, they could get discs machined with the encoding they needed, and build this directly into the brake system.
Pages: 1 2 3 [4] 5 6 ... 17