A20 and motors

Started by empedokles, October 24, 2013, 05:36:25 PM

Previous topic - Next topic

empedokles

Can I control a motor with the A20 using python responding to sensor input? How hard is this if I know some python?

empedokles


blejku

Virtually everyone .. even combustion :-)

empedokles

Without C code?

Tutorials needed.

blejku

Just look for the GPIO .. Well, but ok.

A20 issues on pin 7 slot 3 is high / low. By the way, the LED will flash. I think that enough is enough for you


#!/usr/bin/python
#-*- coding: utf-8 -*-
# Migamy dioda wbudawana olimex

# biblioteki
import A20_GPIO as GPIO
import time
# Zdefiniowane portu LED
# GPIO.PINx_y

# x - nr gniazda - socket
# y - nr pinu - pin

LED = GPIO.PIN3_7

# inicjalizacja GPIO
GPIO.init()

#ustawienie jako wyjscie - seting as output
GPIO.setcfg(LED, GPIO.OUTPUT)

def main():


        GPIO.output(LED, GPIO.HIGH)
        time.sleep(1)
        GPIO.output(LED, GPIO.LOW)
        time.sleep(1)


while 1 == 1 : main()

empedokles

#5
So I won't need anything else than this library for motors, sensors? A link would be neat (I found it over the blog).

blejku

http://olimex.wordpress.com/2013/08/21/python-gpios-module-for-a20-olinuxino-micro/

Depends on what the sensors. But overall the python will are many at this time.
Do you have any experience with electronics?
Motor directly can not be controlled. What is needed is called. current amplifier. For example, transistor
Look for the Raspberry Pi projects. The principle is the same so it may be easier and cheaper to just use the Raspberry

Tom

Sensors will have to be read manually though, because there still is no interrupt driven solution for the a20.

empedokles

No experience with electronics. Is there no simple way to use Python for sensors and motors? Maybe I'm better off with an Arduino uno and some grove-sensorshield. But I would have to learn that C syntax.

What is meant with "have to be read manually"?

martinayotte

There are lot of factors to consider, depending the project you have in mind.

First, what kind of motor ? stepping motor or DC motor ? which torque/power do you need ?
Stepper are more easy to control since they don't really need much feedback loop except limit sensors for positioning, but they usually less powerfull and more expensive than DC for the same torque.

Second, your sensor ? what kind of sensors do you have in mind ? limit sensors ? position sensors ?
Third, do you wish speed control ? many kind of feedbacks can be collected from a motor, that's why we call those motor controllers as "servos".

In some case, you probably end up with hardware servo, because CPU won't be able to process it properly if it is busy doing many tasks, so, you can have, for example, several small controllers such Arduino-Nano, one for each motor, and your Olimex board simply sending orders to those controllers.

Hope this help,
Martin

pete_l

Quote from: empedokles on October 30, 2013, 12:56:03 AM
No experience with electronics. Is there no simple way to use Python for sensors and motors? Maybe I'm better off with an Arduino uno and some grove-sensorshield. But I would have to learn that C syntax.

What is meant with "have to be read manually"?
If that's all you need to do: have a sensor that controls the speed / direction of a motor, then yes - an Arduino would be a good choice. An A20 (or any Linux board for that matter) is overkill for an application like that and is quite complex, too.
However, if you need more - say to have a web interface and to control a motor over the internet and maybe log its activity, then an A20 would be a good choice.

empedokles

QuoteFirst, what kind of motor ? stepping motor or DC motor ? which torque/power do you need ?

Probably stepping-motor (this is what others recommended). It's for a screw conveyor (wood drill in a pipe) to convey food (cat/dog dry food size). 40cm circumferance.

QuoteSecond, your sensor ? what kind of sensors do you have in mind ? limit sensors ? position sensors ?

Ideas: RFID. Motion sensor. And button push. But flexible for anything. The idea is the birds should get food if they do some action.

QuoteThird, do you wish speed control ? many kind of feedbacks can be collected from a motor, that's why we call those motor controllers as "servos".

I don't understand feedback. Does it collect resistance?

QuoteIn some case, you probably end up with hardware servo, because CPU won't be able to process it properly if it is busy doing many tasks, so, you can have, for example, several small controllers such Arduino-Nano, one for each motor, and your Olimex board simply sending orders to those controllers.

There is only one motor I guess. What is the benefit of a additional Arduino if ARM isn't realtime? It still won't be realtime controlling the motor with the Arduino, wouldn't it?

empedokles

Found this:
http://www.youtube.com/watch?v=b4uhh_j8uR0

(Unfortunately there are no good Olimex-Howtos on Youtube)

empedokles

Quote from: Tom on October 30, 2013, 12:18:20 AM
Sensors will have to be read manually though, because there still is no interrupt driven solution for the a20.

What do you mean by that? There are sensors available that can be used with the Raspi. Why won't this be possible with a Olimex A20?

blejku

This means that the program will be a little slower and more complicated. Sensors need to query and not wait until the report change. That's all.