Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

how can I control servo motor by java program in Netbeans

Status
Not open for further replies.

Jhobby

Newbie level 4
Joined
Aug 29, 2010
Messages
6
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
Singapore
Activity points
1,351
Dear All,

I am rather new user in this forum. I would like to know how can I control servo motor by java program in Netbeans. I want to do as below link. Pls see.
https://www.youtube.com/watch?v=w1nFx_w-RsU
https://www.youtube.com/watch?v=hWc2xZZvvQ0
I have no experience in Microcontroller but I learned assembly language. This is not familiar with me. Can I program with java instead assembly language for PIC or Atmel? Which microcontroller shall I use PIC or Ateml? How can I learn step by step? If you know about it or you have some link to do, pls help. I honestly say I don't know how to use NanoVM in Netbeans.

Regards & Thanks,
Zaw
zawtunkyi@gmail.com
 

How much time do u have 4 learning? If u have enough time try learning PIC microcontroller. I dont know any thing about Java but i can help u in assembly or c. u can use MPLAB IDE to generate hex file 4 PIC UC.
 

You have 2 different problems. First you have to know how to make communication with COM port with Java. Thats simple. The second problem is to make a uC to control a servo what i consider more complicated if you never had any kind of experience with uCs. But its not hard. I would start with just the uC system as you don't need a computer interface to start first tests. Than after you have a minimum experience with uC, you can make it communicate with java program. With no experience at all with uC i would recommend you to make a simple circuit at a breadboard with couple leds and make them blink. With a programmer on your hands and if you have some experience on programming with ASM or C you should be able to get experienced with uC programming in one day. Than you have to study the circuit you are going to use to make the uC to control some specific motor you have on your hands. Do not try to make the computer interface until you are sure you know how to make PIC to control the motor. After that i would suggest you start working with the communication. Make your java application send some specific command to uC that is going to blink some led, do not try something very complex until you are sure that you are receiving exactly what you are sending. Finally you have to create a specific protocol for you application.

Thats all

Cya
 

I find this whole discussion fascinating in that why would anyone want to control servo motor via java in netbeans?

to me, there is a reason that people invented toasters so that you don't have to toast your bread in your dishwashers.
 

Dear All,

Thank you very much for your suggestion.

How much time do u have 4 learning? If u have enough time try learning PIC microcontroller. I dont know any thing about Java but i can help u in assembly or c. u can use MPLAB IDE to generate hex file 4 PIC UC.

Ayazahmed,

I learned PIC microcontroller with assembly language. I have not so much experience in MPLAB but I just know it can generate hex file and override on IC. If I want to change the controller of the condition, I need to again override the program on IC and I can't control directly at GUI on computer. So I would like to try with Java.

You have 2 different problems. First you have to know how to make communication with COM port with Java. Thats simple. The second problem is to make a uC to control a servo what i consider more complicated if you never had any kind of experience with uCs. But its not hard. I would start with just the uC system as you don't need a computer interface to start first tests. Than after you have a minimum experience with uC, you can make it communicate with java program. With no experience at all with uC i would recommend you to make a simple circuit at a breadboard with couple leds and make them blink. With a programmer on your hands and if you have some experience on programming with ASM or C you should be able to get experienced with uC programming in one day. Than you have to study the circuit you are going to use to make the uC to control some specific motor you have on your hands. Do not try to make the computer interface until you are sure you know how to make PIC to control the motor. After that i would suggest you start working with the communication. Make your java application send some specific command to uC that is going to blink some led, do not try something very complex until you are sure that you are receiving exactly what you are sending. Finally you have to create a specific protocol for you application.


Sink0,

Now I am learning how to make communication with COM port with Java. I am not very sure what you mean uC? Please explain me. I have done a simple circuit at a breadboard with couple leds and make them blink with PIC assembly language. I want to directly control delay blink time with computer but I don't know how to communicate with PC. How can I start my java application and create a specific protocol for sending some specific command to uC or some signal to delay blink time? It is the basis of that I want to know.

I find this whole discussion fascinating in that why would anyone want to control servo motor via java in netbeans?

to me, there is a reason that people invented toasters so that you don't have to toast your bread in your dishwashers.


Millwood,

I poor English. Please advise clearly. Thank.

Regards,
Zaw
 

uC is microcontroler. If you are using PIC lets talk PIC. You are going to need a MAX232 to create a level conversion from TTL to RS-232. Yo are going to use the UART of you PIC to make the communication. Try looking at google, you are going to find lots of schematics showing how to connect a PIC to COM port. At Java side you should look at javax.comm API. Unfortunately java is not the best programming language to deal with external hardware so you might find some problems but the code itself is quite simple. It would be much simpler with C++.

Cya
 

uC is microcontroler. If you are using PIC lets talk PIC. You are going to need a MAX232 to create a level conversion from TTL to RS-232. Yo are going to use the UART of you PIC to make the communication. Try looking at google, you are going to find lots of schematics showing how to connect a PIC to COM port. At Java side you should look at javax.comm API. Unfortunately java is not the best programming language to deal with external hardware so you might find some problems but the code itself is quite simple. It would be much simpler with C++.

Cya

Dear Sink0,
Thank you for your explanation. OK now I am trying to learn about CART and javax.comm. Last few year ago, I have been learning about C++ but it is difficult to build GUI. Java is more easy for me. That why I more interest in Java.
 

How is it going with netbeans and with the motor control? I did a similar project a couple of years ago, so I can help if you are still interested.
 
  • Like
Reactions: Jhobby

    Jhobby

    Points: 2
    Helpful Answer Positive Rating
Dear Avante,

Glad to hear. I so interest it and still learning. However, I haven't successful this project. I would like to create hobby CNC router by using my own program. Firstly, I just want to know how to control servo motor using with Java's program. If you are possible, may I know which servo motor I shall use. I really appreciate your help.

Thank you so much.

Regards,
Zaw
 
Last edited:

I cannot answer the question of what type of servo you need. At least you have to choose a servo that has the torque needed for you app.
Now when I searched for my old days projects I found that I wrote the GUI on visual basic, But this is not a problem because I have written a couple of applications in Netbeans that use the serial port for communication with external devices.
The project consists of a PC-based GUI, and microcontroller. From the serial port of the PC you do not have a TTL voltage level, end that's where you need a converter. The best way in my opinion is to use a USB to serial TTL cable (TTL-232R-3v3 for a 3v TTL level). This cable has the converter embedded in the USB connector, so you have less things to worry about, smaller circuit, if it is a requirement and the cable can be used for many other developments. The con for using the cable is the cost.
The microcontroller for controlling the servo can be any microcontroller, desirable with a USAR function, and a capable of generating PWM. I used a ATTYNY 2313 which is replaced now by
As I look at the code, I see that I have a timer running at 1000kHz generating PWM.
The minimum angel is when the timer is loaded with 450 which Isink generats a pulse with the 450*2/1000000=0.90ms, and the max is at 1050*2/1000000=2.1ms. My control signal resolution is1050-450=600steps at 1us per step (but this is not the resolution of the servo). The top value of the timer is 10000. Thus the period of the signal is 10ms (100Hz) or 20ms (50Hz), I cannot remember now, and the pulse varies between 0.9 and 2.1ms. Given pulse width range can be exceeded, when using the buttons on bottom of the application, and the servos could be damaged.
68_1296529616.jpg
Let me know how what decision you take so I would be able to help..
 
Last edited:

Hi, thank very much Avante. Actually, I confess you, I just know the basic of electronic and not so clear about timer generating PWM. I am thinking to use USB to serial TTL cable (TTL 232R 3V3) and PIC 16F84 with C programming for controlling the servo motor. This project is my hobby project and just learn for the basic of automation. That why I don't have any toque and speed, and then I want to get the measuring of the servo moment and degree. If you are possible, may I know the schematic of the PCB board and the list of the electronic component. Now I am going to make GUI like this "Servo Testing".

I just found for **broken link removed**

Thanks & Regards,
Zaw
zawtunkyi@gmail.com
 

I find this whole discussion fascinating in that why would anyone want to control servo motor via java in netbeans?

to me, there is a reason that people invented toasters so that you don't have to toast your bread in your dishwashers.

Millwood,

I poor English. Please advise clearly. Thank.

I think its clear enough, its clear by your original post that you know good English. You don't sound like a beginner to me.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top