Closed pilif0 closed 5 years ago
Garry suggested looking into the drivers of DC motors to see how power can be controlled.
I have managed to export six GPIOs (into /sys/class/gpio/
) by setting the lego-port's mode to raw
. These should correspond to the port's six pins. The problem is that due to permissions I cannot write to them to check that and later use them to provide the signal for the electromagnet.
We have the circuit planned out. It uses a chip to provide power to the motor based on a high/low signal. The chip we currently have borrowed for testing can only take 10 V out of the 12 V that the electromagnet is rated for. Until the pin is working, I am also not absolutely sure about the signal voltage, so we might look into getting a different version when ordering ours.
I have managed to gain control over the voltage between pins 3 and 5 of a lego port (0.0 V low, 2.9 V high). To replicate:
/sys/class/lego-port/port2
) to raw
./sys/class/gpio/gpio121
) is out
.0
or 1
to the value of GPIO 121 using sudo sh -c 'echo 1 > /sys/class/gpio/gpio121/value'
(for writing 1
).To allow us to write to the value file from Python at runtime, I needed to set up the environment:
setup.sh
script to the repo that sets the in3
port's mode to raw
and sets the GPIO121 value file permissions to root:gpio rw-rw-r--
.This way the setup script can be run from the start script to make sure the environment is prepared before running anything (or by hand when testing).
This way the current implementation of the electromagnet in #19 works after EV3 boot a running sudo setup.sh
without it asking for a password.
Split from #9. This issue tracks progress on the grabber electromagnet control.