Show Posts
Pages: [1]
1  Using Arduino / Installation & Troubleshooting / Java - A bad idea ? on: February 08, 2011, 03:39:11 pm
After earlier posts I've made regarding serial port locking and no satisfactory replies I've done a bit of trial and error attempts at figuring out what is going on.  Apparently many other people have the same problem as I do and there seems to be no good 'answer/solution'.  To reiterate, the problem 'seems' to be in the way JAVA's locking mechanism works.  This goes for Windows, Mac and Linux.  Once a serial port connection is established and a 'sketch' is uploaded the serial port is locked so no 'other application' can use it.  That sounds like a good idea but it means you 'may' not be able to user the serial console to observe any data being transmitted to the port by your application because the console needs to establish a connection but it can NOT as it (the serial port) is already locked.....  STUPID !!!  There needs to be a better locking mechanism so you don't get locked out of the thing you just uploaded.  Now I've spent days wasting my time trying to 'fix' this problem which would be far more productive if I could just concentrate on debugging my application.  As no one is able to clearly state how to address this many people will, no doubt, waste their time too.  After tinkering around I have manged to upload my sketch and get the console working, but only some of the times.  I've proved to myself that my sketch works and that I can now proceed with making it better and adding functionality but I'll have to fight this locking crap every step of the way.  Also, it seems that many other people have had this issue come up and they assume they've fried there board.  Almost though that too myself but....I bought an Atmel AVRisp MKII and gave it a whirl.  I was able to successfully re-install the bios to the chip !  So I knew there was nothing wrong with the board.  And I tested individual pins to verify that all were working.  Thus I persisted in overcoming this locking problem and still am trying to find a permanent solution.  Perhaps using Java's internal locking method isn't such a good idea and some other (perhaps platform dependant ) locking method would be better.  I don't know but I'm certain that this is a real issue with many Arduino users, present and future.  I'll continue to move forward, frustrated or not, as I have things to accomplish.  I think I'll even do that new Ubuntu install I've been putting off and see if I have better results than I've been having with my old tried and true openSUSE install.  As I've seen numerous other people with this same lock-file problem in the Ubuntu forums I don't have any great expectations that this will help much but I'll probably give it a try just to see (and because I've been meaning to try Ubuntu anyway--what with all that stuff going on with Attachmate/Novell..

Sorry for the long rant.  Just so frustrated with this lock-file garbage and not being able to achieve a satisfactory solution.  Fighting my Arduino board and serial port is NOT what I wish to have to spend my time on.  I'd rather report back to this group the success I've had in completing my live steam train semaphore signal project.  And I'm getting closer to that goal every pain staking step of the way.  As my club wants to convert the entire signal system over to a centralized system with a nice gui control panel I MUST overcome any serial port issues I'm having.  I will not rest until this is complete so you'll definitely hear from me again...  Other than this one issue I've been having fun learning how to use my Arduino and to refresh my knowledge of electronics.  I'm sure I'll have many more projects in the future and I intend to use this line of products (Arduino) for those.  Just a bit of a rough start, but I'll get past this.

Thanks for listening to my rant and I hope there is a solution for all of us frustrated lock-filled users...    smiley-roll

P.S.  Having fun anyway and thanks to all the folks who provide those on-line tutorials.  I'm learning a lot.
2  Using Arduino / Motors, Mechanics, and Power / Re: Gears for Stepper Motor Shafts on: January 27, 2011, 05:03:48 pm
When you order the gear it comes with the set screw.  But beware !  It's the hex wrench you'll need to tighten it up that'shard to find.  I needed a 0.9mm hex wrench and it needed to be exact.  Got it from McMaster/Carr where I have an account already.  With the small size of the hex wrench you'll need you'd be well advised to make certain you get one that isn't just close but rather spot on...

Not sure what size you'll need for the 1.5mm diameter bore gear you need but it may be the same...
3  Using Arduino / Motors, Mechanics, and Power / Re: Gears for Stepper Motor Shafts on: January 27, 2011, 12:29:47 pm
I found a great place for gears that's got exactly what you're looking for.  Here's a link to their page.  They have one of the best menu driven selection processes I've seen at online stores.  You just select by your shaft diameter (1.5mm) and whatever other parameter you need and you'll end up with the exact thing you want.  Quick delivery to.  They helped me out on my project and I'll definitely use them again.

That's the page to select the type of gear you want, not the home page.  You'll probably want one of the top two categories, most likely 'gears' but you might want to look at 'timing belts,pulleys,sprockets and chain drives' as well.  Anyway, they've probably got what you want.
4  Using Arduino / Motors, Mechanics, and Power / Re: Controlling motor with encoder feedback on: January 27, 2011, 12:41:52 am
Yes, I've considered the position sensor idea.  But I'm gonna give my method a try.  All that I need to do is write the software.  If I weren't such a newbie I'd have done it already.  I already have the capability to read the absolute position of the motor and now I just want to use that information to control its movement.  In fact, just sitting here for the last few hours I've already begun to write the program.  I just thought someone could help to set it up.  And this way I don't need any more hardware like sensors.  Just count the pulses until the motor turns the correct amount.  And keep track of the position for the next signal change.

Basically, the motor was cheap, came with an encoder & gearbox and all I need to do is hook it up to the semaphore shaft via a couple of gears and a belt and to the Arduino + MotorShield and I've got a complete system.  Small, compact and pretty rugged.  Plus, in the not too distant future we are looking to upgrade our entire signal system and the Arduino boards should make this a snap.  The fact that this is all off-the-shelf technology and we don't have to be concerned about replacement parts or proprietary designs/knowledge means we can use the system for years without worry....  Except for a couple of semaphore signals all th rest have no moving parts so one Arduino Mega could control quite a few signals and we could replace all the existing hardware for very little money.
5  Using Arduino / Motors, Mechanics, and Power / Controlling motor with encoder feedback on: January 26, 2011, 07:36:47 pm
I'm new to the forum and to Arduino as well.  I'm working on a project and have come a long way in the last 2 weeks or so that I've been working on it.  I'll describe what I've done so far and where I'm going with this as well as some questions regarding how to implement software to get started and then after some testing some additional software logic.  So here's what I've got.

I'm building a semaphore signal for my live steam train club, the Los Angeles Live Steam Railroad Museaum LALSRM....(  I'm using a motor/encoder/gearbox combination I read about here: (  I've changed the output gear to one I bought which is indexed and connects via a timing belt to another indexed gear on the semaphore rotation axis shaft.  I've got a 1:3 (12-tooth to 36 tooth) gear ratio.  So according to the article above the motor will make ~141 rotations per one rotation of the output shaft.  With this set up if I need to turn the semaphore from green to red I'll be rotating the shaft exactly 90 degrees.  Or from red to amber or amber to green 45 degrees.  With the gearing I've got that means the motor output shaft has to turn either 270 degrees (90 x 3) or 135 degrees (45 x 3).  At ~141 revolutions of the motor per revolution of the output shaft this translates to (270/360) x 141 =  105.75 motor revolutions total maximum. 

This is important because it means that we don't need to consider a large number of interrupts or missing encoder pulses.  I've done some basic test and found a few things out.  First, I using the Arduino Uno board with the motor shield from SparkFun.  I followed the tutorial and got two of the Faulhaber gearmotors running using the code example on the page (  Next I did a rough test of the motors strength and using a vice grip I held the motor and ran the example code.  I increased the time so the signal would keep running in one direction to be sure it would rotate from horizontal to vertical without stopping.  Using just the USB connection to my computer the motor had just enough strength to lift the semaphore arm !  So I plugged in the 9-v power supply that came with the beginners kit I bought from Adafruit.  With that the motor had no problem turning the signal...  As we will be using the 12 volt power from the track system I'm certain this little motor can do the job.  Also, I'm going to add bearings to the semaphore shaft set up as it has none now, just a bolt going through some metal collar.  The reduced friction will make it much easier for the motor to do its job..

I also read this article:
and duplicated it using the same pins on the motor shield connected to the encoder pins of the Faulhaber motor/encoder.  I increased the bit size for the count (int16_t) and turned the motor shaft by hand 100 rotations.  The serial console showed the count as I turned.  The count was flawless.  No missed steps !  Even rotating as fast as I could and the count was perfect.  At 141 rotations of the motor per one rotation of the output shaft I got 141 x 4 = 564 counts per revolution.  At 100 revolutions I got EXACTLY 56400 pulse counts ...  Perfect.

So I know I can control the motor AND read the encoder.  Now I need to do the following before final 'tweaks' are applied.  I need a program that will move the motor an exact number of rotations in the desired direction.  Anywhere from +105.75 to -105.75 rotations.  I'll start at 100% power (5v) to the motor and see how much I can cut that down using pwm before the motor struggles too much.  The reason for this is that we don't want the semaphore to move real fast as it's supposed to be authentic...

So I'd like to have a simple demo program that moves the signal in some test sequence.  So start at position A rotate +90 degrees, rotate -45 degrees, rotate -45 degrees, stop.  That will be a great starting point for the program and there is little else to do after that.

 I'll start with the motor just sitting on my desk.  After the basic program is working I'll hook it up to the semaphore.  I'm still working on how to mount the motor rigidly in the signal base, where the Arduino will also be.  Should be done in a few days with that and hope to have the basic program functioning by then.

Thanks in advance for any help with this.  My father, who is 80 years old got me to take on this project for our club.  He is in between cancer treatment/surgery and I'd love to at least get the demo complete before the next operation (probably in the next 2 weeks or so).  I've been working diligently to keep this project on track and I've learned a lot already.  I'm sure my program isn't all that complicated and with a little help I ca get this thing done quickly.

Anyway, thanks again, and I hope I didn't ramble too much.  I will supply whatever information anyone might want to clarify any points I might have missed.

Michael Soibelman

P.S.  Go easy on me, I'm a newbie here.
Pages: [1]