Notifications
Clear all

I R and the contol of a robotic arm

8 Posts
4 Users
1 Likes
379 Views
(@enigmajd)
Member
Joined: 1 year ago
Posts: 9
Topic starter  

Iwould like to control a robotic arm which has 12 possible settings using manual controls: up, down, left, right, horizontel rotation and on off (LED). I would like to do this with the use of IR control, using a IR remote and Arduino Uno. I have Played around with Bill' post on Youtube and I did a test run with one settting  only and would like to code for all off them.

Appreciate some help with coding and Uno?


   
Quote
robotBuilder
(@robotbuilder)
Member
Joined: 5 years ago
Posts: 2042
 

 

@enigmajd

I presume you mean this?

https://dronebotworkshop.com/using-ir-remote-controls-with-arduino/

Cannot help with the coding unless you post your code and the hardware setup you are using.


   
ReplyQuote
Inq
 Inq
(@inq)
Member
Joined: 2 years ago
Posts: 1900
 

@enigmajd,

You also might want to specify what kind of help you need.  You say you have one working.  Bill's demos are always well thought out and thorough.  If you understand the concepts from his video, it should be pretty much rubber stamping the first one over and over.  I'm sure many of us will be glad to help, but it would be helpful to understand what hurdle is keeping you from using Bill's example for all 12.  Yes, there are optimizations/techniques that will create smaller, more logical code, but it will be a great learning curve for you as a hardware/software developer going through that learning curve. 

I'm glad @robotBuilder has chimed in.  Correct me if I'm wrong, the Uno can handle 12 servos as is.  Either you need a Mega or there is some board that @robotBuilder told us about.  Some kind of servo driver board.  I thought I bookmarked it, but I can't find it now.

3 lines of code = InqPortal = Complete IoT, App, Web Server w/ GUI Admin Client, WiFi Manager, Drag & Drop File Manager, OTA, Performance Metrics, Web Socket Comms, Easy App API, All running on ESP8266...
Even usable on ESP-01S - Quickest Start Guide


   
ReplyQuote
THRandell
(@thrandell)
Brain Donor
Joined: 3 years ago
Posts: 224
 

Hi @enigmajd

I’ve been using IR emitters and receivers on robots for a while now and I think that this article by Lady Ada is a good place to start.  I’ve implemented the code from this article on an Arduino clone board and it worked without any problems.  I think that you could use her technique to figure out 12 IR encodings for any remote you have on hand.  Here’s a link to the article.

https://learn.adafruit.com/ir-sensor/overview

I’m also a fan of the Vishay line of IR products.  Here’s a link to their IR receivers designed for remote control.  Digit-Key, Mouser, Pololu and Sparkfun all sell them.

https://www.vishay.com/en/ir-receiver-modules/

Finally, I’ve used this board, driven by a Nano, to control a slew of servos on a Hexapod.

https://www.adafruit.com/product/815

 

Good Luck   Tom

To err is human.
To really foul up, use a computer.


   
Inq reacted
ReplyQuote
(@enigmajd)
Member
Joined: 1 year ago
Posts: 9
Topic starter  

Thanks  for the support. I will provide more material shortly and hope it throws some ligh on what I'm

attempting to accomplish with the project. I will post the code I copied from Bruce's article as mentioned above 

and a photo of the robitic arm I atttemting to control. This project is for a grandson from a grandiose grandfather.


   
ReplyQuote
(@enigmajd)
Member
Joined: 1 year ago
Posts: 9
Topic starter  

Here is the very basic code I am working with. Intention is to assign a robotic arm instruction to a button on remote control. At the moment any button pressed will turn on the robotic arm LED.

Do I find the individual hex value for each button and then use a case function to step thru

the code.

If I could get some support into how to start, I would appreciate it.

Fortunately I have a lot of patience

 

#include <IRremote.h>

int RECV_PIN = 11;
int OUTPUT_PIN = 4;

IRrecv irrecv(RECV_PIN);
decode_results results;

void setup()
{
pinMode(OUTPUT_PIN, OUTPUT);
pinMode(11, OUTPUT);
irrecv.enableIRIn(); // Start the receiver
}

int on = 1;
unsigned long last = millis();

void loop() {
if (irrecv.decode(&results)) {
// If it's been at least 1/4 second since the last
// IR received, toggle the relay
if (millis() - last > 1000) {
on = !on;
digitalWrite(OUTPUT_PIN, on ? HIGH : LOW);
}
last = millis();
irrecv.resume(); // Receive the next value
}
}

 

 

IMG 3597 (1)

   
ReplyQuote
robotBuilder
(@robotbuilder)
Member
Joined: 5 years ago
Posts: 2042
 

@enigmajd

In your IDE copy your code then in your post click the code button. Paste to the resulting Code window and click the OK button.

To enlarge an image, right click image and choose Open link in new window.

codeButton
#include <IRremote.h>

int RECV_PIN = 11;
int OUTPUT_PIN = 4;

IRrecv irrecv(RECV_PIN);
decode_results results;

void setup()
{
  pinMode(OUTPUT_PIN, OUTPUT);
  pinMode(11, OUTPUT);
  irrecv.enableIRIn(); // Start the receiver
}

int on = 1;
unsigned long last = millis();

void loop() {
  if (irrecv.decode(&results)) {
    // If it's been at least 1/4 second since the last
    // IR received, toggle the relay
    if (millis() - last > 1000) {
      on = !on;
      digitalWrite(OUTPUT_PIN, on ? HIGH : LOW);
    }
    last = millis();
    irrecv.resume(); // Receive the next value
  }
}

 


   
ReplyQuote
robotBuilder
(@robotbuilder)
Member
Joined: 5 years ago
Posts: 2042
 

@enigmajd 

I am familiar with this toy robot arm.  It does not use servos. You will need a hbridge for each motor.  I seem to remember a usb controller interface for this arm to be controlled from a PC.  I couldn't see any simple way to add position encoders to the arm joints so decided it wasn't suitable for autonomous computer control.

 


   
ReplyQuote