Go Down

Topic: Using Tcl to steer servos? (Read 200 times) previous topic - next topic

Jyge

My son got a DIY robotic arm kit for Christmas. It got an arduino board, servos and couple of mini-joysticks. The instructions are ... well, non existing, but in the end I think you just plug in the joysticks, read the analog input and somehow output the analog output to the servos.

I have already built myself a joystick with teeny, so half of it is not that much of black magic for me. I haven't dealt with servos until now, but I think we'll manage.

My question is actually, that if I wanted to expand the whole thing a bit. I think it should be possible to get rid of the mini-joysticks and build a software interface, I would prefer Tk/Tcl, and control the servos directly with some software sliders on a GUI?

How do I accomplish this? Can I write some system variables from Tcl containing the position data and access that from Arduino and pass it to the servos? What would be the right way to interface the control-data?

Can I then, in the end, plug in the arduino board with the robot arm without need to start the arduino program? (just as I am doing it with my joystick already)

sterretje

#1
Dec 25, 2018, 08:15 am Last Edit: Dec 25, 2018, 08:16 am by sterretje
At the top of this forum section is Demo of PC-Arduino comms using Python

Just replace the python part by your Tcl/Tk application.

You can also read the updated Serial Input Basics (by the same author) to get ideas how to implement solid serial communication.

Quote
Can I then, in the end, plug in the arduino board with the robot arm without need to start the arduino program? (just as I am doing it with my joystick already)
Yes. Just be ware that most Arduinos will reset when you open the serial connection from your application; exception are those with native USB support like Leonardo, Micro, Due and Zero (and probably your teensy ;) )

Merry Christmas.
If you understand an example, use it.
If you don't understand an example, don't use it.

Electronics engineer by trade, software engineer by profession. Trying to get back into electronics after 15 years absence.

Go Up