Introduction: MeArm.Joystick Software En

Origin : Phenoptix's Pocket Sized Robot Arm.

FB , HomePage

DIY manual

- There are 37 programming lessons, good for beginners and veteran. Students from elementary school can use S4A or Ardublock or mBlock. There are also lessons available based on C language. One can learn without programming skill.

- Please go through step A, B and C to install necessary software and driver.

- Please go through step D and E to install drag-and-drop style languages. (S4A or Ardublock)

- You can restore factory default any time by uploading meArm.ino any time in Arduino IDE.

- Feel free to download all of the lessons at a time. (30 lessons.zip , will be available after the end of crowdfunding)

- Restore meArm.Joystick to factory default, please upload meArm_bt.ino(with Bluetooth) or meArm.ino in Arduino IDE.

A) Arduino IDE

B) Necessary driver:

Windows:

Double click Arduino_driver.exe

MAC:

1) double click ch34xInstall.pkg

2) For Yosemite (OSX 10.10), please open terminal and input via the below instruction. Reboot after that.

sudo nvram boot-args="kext-dev-mode=1"

Linux:

Follow the instruction of readme.txt in CH341SER_LINUX.zip

C) Setup Arduino IDE

Windows:

1) System-Device Manager-Ports (CH-340 is is COM3 in this example)

2) Choose "Arduino UNO"

3) Select correct port. (COM3)

4) Select "Arduino as ISP" as programmer

MAC:

1) Application-Tools-System Info (Plug in meArm.Joystick and ensure "USB2.0-Serial" is there)

2) Choose "Arduino UNO"

3) Select "dev/tty.wchusbserial410"

4) Select "Arduino as ISP" as programmer

D) S4A

1) Download and replace S4A.Image at S4A installation folder.

Windows : C:\Program Files\S4A\S4A.Image

MAC : Macintosh HD/Application/S4A/S4A.Image

2) Open Arduino IDE, upload S4AFirmware15_meArm.ino to meArm.Joystick

E) Ardublock

After Arduino installation, please copy "ardublock-beta-20140828.jar" to:

Windows 7 : C:\Users\lienhungcheng\Documents\Arduino\tools\ArduBlockTool\tool\ardublock-beta-20140828.jar

Windows XP : C:\Program Files\Arduino\tools\ArduBlockTool\tool\ardublock-beta-20140828.jar

MAC: /Users/lienhungcheng/Documents/Arduino/tools/ArduBlockTool/tool/ardublock-beta-20140828.jar

(Please replace "lienhungcheng" with your user name.)

F) Manual : meArmJoystick-en.pdf

Step 1: Turn on the Light.

We can use C/S4A/Ardublock to control meArm.Joystick.

A) S4A

(1) Open S4A application.

(2) Drag and drop as the blocks.

(3) Click "Green Flag" and the LED on the bot will light up.

B) Ardublock

(1) Select Tools/Ardublock

(2) Drag and drop as the blocks

(3) Press "Upload to Arduino"

C) C

(1) Open _01.ino

(2) Press "Upload"

PS. The pin of LED is 3 (12 in S4A). It will light up if the value is HIGH. You can open ".sb" in S4A, ".abp" in Ardublock or ".ino" in Arduino IDE to get the same result.

Step 2: Turn Off the Light After 3 Seconds

To turn it off, we only have to set the pin to "LOW" or "OFF" after delaying 3000 milliseconds.

Step 3: Flash It

Since you are able to turn the LED on and off, why not flash it? Now let's flash it at every 1 second.

Step 4: Variable

Assuming we are changing the flashing frequency from 1 flash per second to 1 flash per 0.2 seconds, we would have to change the delay time many times. If we use Variable, we only have to change Variable one time to get the job done.

Step 5: Variable (continue)

Since we have variable, why not vary it again? Let's try add/minus/multiply/divide
mytime = mytime / 2;

mytime = mytime * 2;

mytime = mytime + 100;

mytime = mytime - 250;

Step 6: Print Out Variables

Since variable is so efficient, we should handle that as best as possible. We can use the below instruction to print it out.

Step 7: If I Am True

"If" statement is widely used in everyday life. For example, if it rains, bring an umbrella. If it's windy, wear a coat. If the condition is true, we do some kind of action.
"If 10 is greater than 1, turn on the LED."

Since 10 is great than 1, so the LED will light up.

Step 8: If + Variable

We normally use Variable with If statement. In this lesson, "light" variable could be a current light value from the sensor.
int light = 5;

if (light < 10)

{

digitalWrite(3, HIGH);

delay(1000);

}

Step 9: "Boolean" Is a Friend of "If"

In last lesson, if "(light < 10), we call it "True." If not, we call it "False."

True and False are both Boolean. We do a certain action if the Boolean value is True, and do others if False.

Step 10: Left Turn or Right Turn (if-else)

Since there are 2 kinds of Boolean value, the statement usually looks like "if-else."
if (true)

{

left turn

}

else

{

right turn

}

Step 11: Left Turn or Right Turn (if-else) Continue 1

"if-else" statement is frequently used with variable.

For instance, "if variable can be divided by 3, then blabla…"
("|" is modular)

if (num | 3 == 0)

{

digitalWrite(3, HIGH);

} else {

digitalWrite(3, LOW);

}

Step 12: Left Turn or Right Turn (if-else) Continue 2

Since "if-else" is so important, let's do more practice.
Can you figure out how to write the statement "if odd, flash LED 1 time, else flash 2 times?"

Step 13: Loop : Capable of Doing Repeated Boring Things

Besides "if-else", another fantastic work computer can do is "loop." It's capable of doing repeated and boring things.
For example, let's flash LED 5 times.

Basic format in C language : "for (int i = 0; i < 5; i++)"

Step 14: Use Loop to Add From 1 to 100

Let's practice how to add from 1 to 100 with loop.

Step 15: We Can Also Only Add Even Number Within the Loop.

"Loop" is so powerful. Let's try to add only even numbers within 1 to 100.

Step 16: "Step" of Loop

The idea of step of the loop is to do action once per "step" times.

So we can it to add only even number with step 2.

Step 17: Can We Use "step" to Find Out Total Sundays in a Year?

The key of this quiz is to set the "step" value.

Step 18: Loop (continue): Do Something Forever

Loop statement is so important in most programming language. So there is another variation of this statement "while." The key of the "while" statement is to do forever if the condition is met.

Step 19: Loop (continue) : Standard Form

In order not to hang up the system, we usually add a condition in the while loop. So the while loop will stop when the condition is False.

Step 20: Flash the LED Forever

The while loop is best to do something unchanged repeatedly. This lesson is to learn how to flash the LED forever.

Step 21: Function : a Set of Statements in a Blackbox

To make the code tidy, programmer used to utilize "Function" to run a set of statement as a blackbox. This blackbox is so-called "Function" or "Subroutine." We will learn how to use Function in this lesson.
PS. Only Arduino C and Ardublock support "Function" capability. S4A doesn't.

Step 22: Function + Loop : Let's Flash the LED 10 Times.

After wrapping multiple statements into Function, we can treat this special Function as a statement. Hence we can put the Function into a loop as well. Let's see how to flash LED 10 times by using Function and loop.

Step 23: Loop Inside the Function

Not only can we run Function within a loop, we can run loop within a Function as well.

Step 24: Parameter of a Function (Only C Supports, Ardublock Doesn't.)

"Function" is so powerful. For instance, we can provide a parameter when run a Function. In this example, we will pass a parameter to a Function to flash the LED X times.

Step 25: Can We Pass Multiple Parameter to a Function?

No only can we pass parameter to a Function, we can pass multiple ones as well. For example, we can pass 2 parameters. One is for the times of flash while the other as the frequency.

Step 26: More Challenging

A Function with parameter is so powerful. So give a try and see if you can work out a Function to add from 1 to number y. So if we want to add from 1 to 100, we can just call "Sum(100)."

Step 27: Servo at a Glance

From this lesson, we are going to learn how to control meArm.Joystick. Since you have run through previous lesson, you can get the idea how to control the bot quick.
The mechanic arm is driven by 4 servos. We only have to set the pin number and angle of the servo, and Arduino will do the others for you. The angle is ranged from 1 to 179. Please be careful that you don't turn the servo to an angle out of range. This will harm the system and servo. Please pay special attention that don't drive the screws in too tight. As it will also be harmful to the system if the servo can't turn to a specific angle due to this reason.

Step 28: Turn the Servo Slowly From 1 to 179 Degree

Since the range of the servo is 1~179, let's rotate the bot degree by degree.

Step 29: Let's Try the 2nd Servo With an Angle From 45 to 145 Degree.

The 2nd servo is to control meArm.Joystick forward and backward. Let's rotate it from a 45 to a 145 degree.

Step 30: Let's Try the 3rd Servo With Angle From 90 to 179 Degree.

The 3rd servo is to control the direction of up and down. Let's rotate it from 90 to 179 degree.

Step 31: Let's Try the 4th Servo With Angle From 0 to 50 Degree.

The 4th servo is to control the claw. Let's rotate it from 1 to 50 degree.

Step 32: Read the Value of Joystick

There are 2 joysticks with 2 directions(left-right, forward-backward) of each joystick. So we need to monitor 4 directions through analog pins A0, A1, A2 and A3. The value of each analog pin is from 0 through 1023. In this lesson, we read value from A0 and print it out through the serial port.

Step 33: Let's Divide the Value of 0~1023 Into 3 Parts

The reason is to detect the user operation of the joystick. If the value is greater than 612, it says "bigger," if less than 412 it says "smaller," otherwise says "middle."

Step 34: Combine Joystick and Servo

Let's combine the joystick and servo by adding or minusing the servo degree based on joystick direction.

Step 35: Array : Collect Similar Things Together

Since we are reading value from 4 joysticks and controling the degrees of 4 servos, we can use Array to store similar values in an "Array" variable. So the code will look tidy.

Step 36: Combine Everything Together and the Bot Will Be Under Your Control

To fully control the bot, we need to use all the programming skills we learned from previous lessons. We won't go through each line of code. Try to study the code and you can understand it after short period of time.

Step 37: Auto Mode

Since we knew how to control the servo, we can make the bot to automatically do something if we can set the angle of each servo in advance.

Step 38: Restore the Factory Default

You can restore the bot to factory default by uploading meArm.ino in Arduino IDE any time. If you have any problem, please add me as a friend "Lien Ted" in Facebook or email me at ted99.tw@gmail.com. Or join the forum in joyarm.weebly.com.

Comments

author
Will2MakesStuff made it!(author)2014-11-24

Made me want one! Really nice instructable, great level of detail.

author
Fission+Chips made it!(author)2014-11-23

This is so amazing! Your code explanation is great, the design looks so modern and innovative... you deserve a high five for your awesome work! This looks like such a great educational kit, and seems so cool I want to get it! Totally nice job.

author
ted99tw made it!(author)2014-11-24

Thanks, Fission. It's great that you like it. :)

author
DavideG19 made it!(author)2016-09-08

Hi Ted,

I'm looking for PLA drawing of robot and in your page I didn't find any file.stl. Where can I find it?
Thanks in advance
Davide

author
edwardbarnabas made it!(author)2014-12-11

I did it. Thanks, Ted!

About This Instructable

8,415views

55favorites

License:

Bio: maker for educational kit since 2014
More by ted99tw:MeArm With ElectromagnetControl Esp8266 Over the Internet - for Taiwan Hinet ADSLArduino KickStarter Bell
Add instructable to: