Analog (2-axis joystick) input for moving servos with Raspberry Pi

Discussion in 'The Projects Forum' started by Chris_J, Mar 19, 2015.

  1. Chris_J

    Thread Starter New Member

    Mar 19, 2015
    5
    0
    Hi,

    I have a first time project which I hope is relatively simple overall but I have a few questions about how to get started.

    For context, I'd like to mount a camera on a photography hide (shed) with a pan/tilt options. From within the hide I'd like to be able to control the movement of the camera using a thumb-joystick instead of having to type commands. I'd also like to be able to attach a small screen to the Raspberry Pi to stream the image from the camera so I can see what's going on around the hide.

    Here is a similar project I found but with the movement of the camera being controlled remotely: http://projectsmax246.blogspot.co.uk/2013/01/webcam-over-3g-with-raspberry-pi.html

    I have a small touchscreen (https://learn.adafruit.com/adafruit-pitft-28-inch-resistive-touchscreen-display-raspberry-pi) that would be great to utilise if possible but here's where I get confused. The screen sits on the GPIO pins With the screen attached, does this mean I can't use any of those pins to connect any other peripherals?

    For example, this tutorial (http://www.raspberrypi-spy.co.uk/20...raspberry-pi-using-an-mcp3008/#comment-122448) using a joystick shows the need for the breadboard to attach to some of the pins. Would I be able to use something like that and the screen at the same time?

    I expect this is a pretty novice questions but I haven't been learning for long.

    Thanks for any suggestions.

    Chris
     
  2. MrChips

    Moderator

    Oct 2, 2009
    12,421
    3,355
    It is a doable DIY project but it depends on your level of expertise and experience.
     
  3. djsfantasi

    AAC Fanatic!

    Apr 11, 2010
    2,795
    830
    Just a thought I had while reading your post. With that touchscreen, couldn't you eliminate the joystick and use the screen as pan and tilt input?
     
    Chris_J likes this.
  4. Chris_J

    Thread Starter New Member

    Mar 19, 2015
    5
    0
    You know, I hadn't thought of that! With my limited knowledge, I'd guess that was a bit more advanced but on the flip-side, eliminates the need for the joystick as you say.

    In terms of what I'm trying to achieve then yes, it would fit the bill.

    Thanks for your input - happy to receive more pointers on either solution.

    Chris
     
  5. MrChips

    Moderator

    Oct 2, 2009
    12,421
    3,355
    Yes, I did think of the touch screen but that makes it much more complex.
    To control tilt and pan, you need a pot, 555 timer circuit and a servo, times two for tilt and pan.
     
  6. djsfantasi

    AAC Fanatic!

    Apr 11, 2010
    2,795
    830
    So the Raspberry Pi is only used as a remote screen to view what the camera is seeing? Pan and tilt are controlled by analog exclusively?

    I assumed you were reading the joystick position by the RPi and then controlling the servo by the RPi... Nevermind.
     
  7. Chris_J

    Thread Starter New Member

    Mar 19, 2015
    5
    0
    I might be wrong but the idea would be that the servos are hooked up to the RPi as well as the screen. The joystick provides the input, read by the RPi which then signals the servos. Whatever the camera sees is broadcast on the screen.
     
  8. djsfantasi

    AAC Fanatic!

    Apr 11, 2010
    2,795
    830
    No, what you describe is what I thought. To answer your original question, from the product page which you linked to, except for GPIO 24 & 25, all other pins are available. I can't tell from the pictures how mechanically they are accessed, but it seems to me to imply that they still can be used. GPIOs 18, 21, 22 and 23 are prought out to the pushbutton locations on the touchscreen board.
     
  9. Chris_J

    Thread Starter New Member

    Mar 19, 2015
    5
    0
    The screen comes with a 26 pin connector which I think I've seen referred to as a 'pass-through' therefore I think it's possible to use other GPIO pins which is great despite not having the full 40 on the RPi B+.

    I think it's time to get some components and have a play around.
     
  10. MaxHeadRoom

    Expert

    Jul 18, 2013
    10,507
    2,367
    I am not sure if anyone has come up with a simple stand alone version of the type of control you get with such as the Parrot drone, this uses any Android pad and as well as multi axis control by just tilting the pad etc, there are two cameras that relay's the image back via the wi-fi link.
    Max.
     
  11. Sensacell

    Well-Known Member

    Jun 19, 2012
    1,127
    266
    You could buy a pololu servo controller that accepts serial data as input, use the ras-pi to generate a serial data stream of pan tilt coordinates.
    You could read some analog pots with the ADC on the ras-pi to act as the joystick input. Use an analog camera and analog TV as the display, keep it simple.
     
  12. Chris_J

    Thread Starter New Member

    Mar 19, 2015
    5
    0
    Thanks for the advice. After a bit of reading, I think I'm getting an idea of how this would work.

    There are several tutorials online about how to get analog signals into the RPI using an ADC (). From there I guess it's a case of creating a program to use the values to control to the servos.
     
Loading...