Show Posts
Pages: [1] 2 3
1  Using Arduino / Audio / Stereo playback? on: February 28, 2011, 06:34:21 am
Has anyone built a stereo version of the waveshield?
2  Community / Bar Sport / Re: Visiting London - what to see? on: February 20, 2011, 04:44:35 am
Not a lot of people know you can get a guided tour of Parliament and a trip up Big Ben. Even if you're not into politics (like I'm not) it's still a very interesting experience.  Best not have an arduino and dangling wires in your rucksack as security / searches were similar to an international airport when I went. It also says book in advance....
http://www.parliament.uk/visiting/visiting-and-tours/tours/

http://www.parliament.uk/visiting/visiting-and-tours/bigben/

3  Community / Local Groups / Re: South Wales - UK on: February 20, 2011, 04:18:33 am
Hi,
I'm in Newport. Usually got an arduino project or three on the go.


Russ
4  Using Arduino / Project Guidance / Re: BLDC hdd motor with ESC on: February 19, 2011, 09:24:41 am
What are you trying to achieve with the motor? Just to get it running?

The 'pulse' from the motor just after applying power is an audio beep. The different beeps are feedback from the ESC to indicate its status.

The reason the motor speeds up and then slows down  is because the value 'val' passed to  myservo.write(val); is generated from the loop for (int i = 0; i < 180; i++){ which basically counts from 0 to 179 relating to min to max motor power. ie the motor pulses every 2 seconds because your sketch is controlling it this way.   smiley-sweat

Because you are attaching an analogue signal I guess you want the motor to speed up and slow down from a potentiometer?
I've reworked your sketch so it does this and added some annotation.

Code:
/*
DEMO sketch for arming  and running a generic ESC brushless motor controler from an Arduino and using a potentiometer to vary the motor speed.

Tested and working.
http://www.youtube.com/watch?v=V7gYbXBKhXs


19 Feb 2011
*/

#include <Servo.h>
 
Servo myservo; 
 
int val;                                   //Value for motor speed.
int analogPin = 3;                         //Potentiometer on pin 3
int servoPin = 9;                          //Servo on pin 9
int armValue=20;                           // "zero" position for arming ESC. As some wont arm with a '0' value fromthe arduino.

void arm(){                                //Arming sequence of sending a minimum or 'joystick zero' for 2 seconds to simulate radio gear is ON and operational. 
  myservo.write(armValue);
  delay(2500);
}
 
void setup() {
 
  Serial.begin(9600);
  myservo.attach(servoPin); 
  arm();
}
 
void loop(){
  int val = analogRead(analogPin);         //Make a analogue reading. This is from 0-1023
  val = map(val, 0, 1023, armValue, 180);  //Scale input to use it with the servo ie from the arming value to 180.
  myservo.write(val);                      //Send servo position - Motor speed to ESC.
  Serial.println(val);                     //Send servo
  delay(100);                              //pause for 1/10 second.
}



I also did a short video because I'm hung over and got nothing better to do of it working with a broken hard drive I was hoarding.


The status beep just after powerup is more prominent on a larger motor and can be heard in this video I did a few days ago.



Other points to note are:....

There should be three wires from the hard drive motor to the controller. If there are four wires have you correctly identified the centre tap? It will be the one made from 3 wires twisted together. This should be left unconnected as the ESC doesn't need it.

Experience also tells me that the ESC will not arm on a 0 servo position and a value of between 15 and 20 is needed (dependant on controller) I then use this value as zero motor speed.

Model RC system have no feedback so there is no way of getting the motor speed from the ESC. If you need the motor speed you will have to use the Arduino to either measure the motor rotation or monitor the electrical signal from one of the three phases powering the motor.

Hope this helps



5  Forum 2005-2010 (read only) / Troubleshooting / Re: serial port disabled in arduino ide on fedora 10 on: March 10, 2010, 06:47:04 am
Urmmm (I'm no expert you know :-/ )

Looks like the port is open now which is problem #1 solved. I'm not familiar with the new error.

I'm assuming you successfully ran through the set-up instruction in the playground?
http://www.arduino.cc/playground/Linux/Fedora

You selected the correct port in the Tools menu?
You selected the correct Arduinio board type in the Tools Menu?

I had some issues like this when I first installed Arduino in Fedora but usually tracked it down to a botched step in the setup.

6  Forum 2005-2010 (read only) / Troubleshooting / Re: serial port disabled in arduino ide on fedora 10 on: March 06, 2010, 06:24:21 am
I had this issue. For some reason the default settings in Fedora have the serial port disabled and you need to re enable it to use the arduino.

From what I remember you have to go in to
System -> Administration -> Users and Groups.

This should open the User Manager.
Select your user name and you should get the User Properties window open.

You need to then select the groups that will give you serial communication.  These are UUCP and LOCK.

I'm running Fedora 11 and also enabled DIALOUT duno if this is relevant to 10.


:-[ Just noticed there is a playground page explaining Fedora setup  smiley-wink
http://www.arduino.cc/playground/Linux/Fedora
7  Forum 2005-2010 (read only) / Troubleshooting / Re: Linux - Arduino IDE works but only as root on: November 15, 2009, 01:54:23 pm
I'm still relativity new to linux and had to jump through a couple of hoops before I got it to work.

Have you set the user groups for your account? From memory you need 'lock' and 'uucp'

I also found that if you saved a sketch in root account the files were then tagged with root ownership and I could no longer compile them when my main account. I've got a few of the standard examples that wont work for me any more because of this.  smiley-wink
8  Forum 2005-2010 (read only) / Syntax & Programs / Re: PID tuning "rules of thumb"? on: March 10, 2010, 06:17:41 am
When I made a servo motor I used the manual tuning description from the Wiki page on PID.  I only used P and I and like you didn't bother with D. I was aiming for positional control and you want speed control but they are both set points so I cant see why this 'rule of thumb' wont work.

Quote from Wiki page.
Quote
Manual tuning

If the system must remain online, one tuning method is to first set Ki and Kd values to zero. Increase the Kp until the output of the loop oscillates, then the Kp should be set to approximately half of that value for a "quarter amplitude decay" type response. Then increase Ki until any offset is correct in sufficient time for the process. However, too much Ki will cause instability. Finally, increase Kd, if required, until the loop is acceptably quick to reach its reference after a load disturbance. However, too much Kd will cause excessive response and overshoot. A fast PID loop tuning usually overshoots slightly to reach the setpoint more quickly; however, some systems cannot accept overshoot, in which case an "over-damped" closed-loop system is required, which will require a Kp setting significantly less than half that of the Kp setting causing oscillation.

To make things easy for myself I added extra potentiometers for the P,I values (I didn't bother with D) which enabled me to rapidly have a tinker and get he feel of it with the motor running. I read the pots 10 times a second and not at algorithm speed to minimise the loop speed change when disabling this extra set-up code. Once my motor was behaving as I wanted it I noted the values with a serial print back to the PC and then and set them as constants in the program code
Using the external pots allowed me to set the P and I values within about 5 mins after several unsuccessful evenings of guesstimating what they should be and recompiling.

I also adjusted the speed of the loop which has a significant impact on the PID algorithm.

Did you write your own PI code?
9  Forum 2005-2010 (read only) / Syntax & Programs / millis() and micros() and Interrupts on: September 23, 2009, 02:20:57 am
Been having some difficulty with timing the rotation of a motor shaft. Basically I need to trigger a response when the motor speed is a particular rpm. I have a hall effect pick-up to give a pulse every rotation but the duration of the pulse is in the order of 1ms so I'm detecting it with an interrupt. It all works OK however the response is a bit jittery.

I'm measuring the time with millis() and checking TPeriod within the main program loop
ie,
void Pulse() //ISR
{                                
  TPeriod=millis()-previousMillis;
  previousMillis = millis();                  // Start new timing period
}


 
I know that my problem is almost certainly because millis() is not incremented within an ISR but cant find much documentation as to whether or not micros() is also disabled.

Is it worth me simply using micros() and altering the timings by 1000 or is that equally doomed as a concept?
10  Forum 2005-2010 (read only) / Development / Re: ShiftRegLCD lib (LiquidCrystal 3-wire replacement) on: August 13, 2009, 08:24:08 am
Quote
Have you tried the "srlcd.setCursor(column,row);" method?
No, but I'll try to look it up tonight when I've got some free time.
11  Forum 2005-2010 (read only) / Development / Re: ShiftRegLCD lib (LiquidCrystal 3-wire replacement) on: August 12, 2009, 02:09:03 pm
Is it the sort of thing I could alter / try out if you pointed me in the right direction?
12  Forum 2005-2010 (read only) / Development / Re: ShiftRegLCD lib (LiquidCrystal 3-wire replacement) on: August 12, 2009, 09:33:54 am
Definitely one enable input. The data-sheet is not helpful in giving information about addressing the four lines or the memory map layout of the displayed characters.
 I've also looked up other data sheets for 20x4 displays and the ones I found also had a single enable input.
If its any help lines 0 and 2 go clear when initialised and lines 1 and 3 are blank so I guess they are not initialising?
When I get time later on I'll look up 40x2 displays in case this one is a 40x2 'folded in half'.
13  Forum 2005-2010 (read only) / Development / Re: ShiftRegLCD lib (LiquidCrystal 3-wire replacement) on: August 12, 2009, 05:42:58 am
After building the two wire version  with a surface mount 74HC164 on a 4X20 LCD I realised the code only accommodates a 1 line display.
Line 0 works well and that rolls over into line 2 but obviously cant get text to appear on lines 1 and 3. :-/  I've tried using begin() but it appears to not be used.

Has anybody got it to work for a 4 line display? or am I missing something obvious?
It would be a shame to undo all the work soldering it together smiley-sad


14  Forum 2005-2010 (read only) / Development / Re: Looking for info on running at 20mHz on: May 05, 2010, 06:23:42 am
I've used 20MHz crystals in a couple of stand alone Arduino applications and it was OK apart from running a bit faster. Going a bit faster shouldn't be a problem unless you had time critical delays, used the com port or the PWM output for servos etc.

15  Forum 2005-2010 (read only) / Interfacing / Re: Controlling A Brushless Motor on: February 11, 2010, 05:30:00 pm
I wrote this last November  about an experience I had installing a brushless ESC and motor into a museum display that controlled a model helicopter that ran up and down a pair of power wires. Sorry, but I dont have time to re-edit it for this topic thread but think my experience valuable enough to repeat what I said.

----------------------------------------------------------------------------
I am guessing the Novak ESC is a Model Brushless Motor Speed Controller? If not I've bashed out a whole load of info for nothing  smiley-wink

I've not used the Novak controller but guess they are all much the same. Anyway if you know how I got mine to work it might help. I've used a couple of Mystery RC 100A Brushless Motor Speed Controllers for a project I was contracted to do a couple of months ago. I didnt need the full 100A but couldnt resist the £15ish  it cost to get them from a Chinese Ebay shop   smiley-wink

I had some similar difficulty because the controller didnt respond as expected. ie it didn't give me MIN to MAX power over the 0 to 180 PWM range and a lot of the time it would not work at all. I spent a bout two solid days with a POT to PWM sketch and debugging with the PWM values being read out of the terminal to understand that a ESC is a bit more involved that I thought and eventually get it to reliably work with the Arduino.

I'm not sure if this is your problem but the controller has a whole bunch of paramaters / features that aid the model builder but made my job controlling it from an Arduino lot trickier and less straight forward.

The features that caused me some grief are;

# Throttle range self-adjusting
Most probably your problem. The controller interprets the PWM input at power on and sets a ZERO position from this. The problem is if you have a PWM that is out side its expected ZERO range it fails to start and assumes a SAFE condition until you cycle the power. ie it appears dead. This is done every time the ESC powers up so if you don't standardise your ZERO position you will not get consistent response from the ESC as it uses this as a reference to your PWM value and expected motor responce.

# Auto motor cutoff with reset
If the controller spots an abnormal condition, which could be anything, it shut the motor down until the power is cycled. ie it dies for no 'apparent' reason. I had problems with 3 meters of wire and enough voltage drop to trigger flat battery condition.  :-?

# Safe power arming program ensures motor will not run accidentally after turn on
If the PWM demand is not within the expected ZERO band or possibly fluctuating on power up it goes into a SAFE condition until the power is cycled. ie it appears dead.

The other feature that annoyed me was a minimum motor speed. ie the motor was OFF or spinning at some minimum speed which for my project and motor was a little bit to fast.   :-[ I bought a motor with a lower speed rating to solve this  smiley

My solution was to initalise the controller and use it as follows:
A] Set PWM signal at your ZERO position  ie low but not 0( I chose 30)
B] Supply power to Motor controller. (My Arduino switched the power with a relay)
C] Wait for Motor controller to initalise and set its ZERO to your ZERO position(It should beep, I waited 2 seconds)  
D] Motor will now respond to the PWM signal and spin above the minimum running speed (for me that was about 43 PWM but was different for a different motor)

You'll now have to work out what PWM value will max out the motor.

Keep the PWM signal above your ZERO value and below the max power and you should have it working. If the PWM goes out side this range I found it would shut down into SAFE mode again.

If you trigger a SAFE condition you have to reinitalise  the ESC and reset the ZERO value. ie steps A,B and C above. If you dont then your current PWM value becomes ZERO and you get in a mess.

Oh yes, and dont forget he schoolboy error of not having a common ground with the Arduino AND the motor controller. Without this you might not be giving it PWM at all   smiley-wink  got me a couple of times   :smiley

Hope this is more helpful than confusing and remember I wrote this about 3 months ago for a different question .  smiley-wink

PS I used an IR link between the Arduino and the ESC!
Pages: [1] 2 3