0

currently working on a project with detecting objects via a Camera Module and controlling motors based on the camera detection (if object is in sector A, move motor B down, etc.) using Python. The code itself works on the Pi but due to lots of parameters, the frame freezes once the first motor movement is initialized. In order to overcome this, we would like to let the code run as following Laptop: - Code itself via PyCham - Object detection via Webcam - Detect object reading the coordinates, based on the coordinates, the motors should move up and down (the code itself works already) - Send command to the Pi initiating the motor movement

Raspberry Pi: - Connected via RS232 to the Laptop (with the respective shield) - Receive the command from the Laptop initiating the motor to move in the respective way

The question is now how to best communicate between the Laptop (PyCham environment) and the Pi using the RS232 interface. My understanding is, that the setup above is the most convenient. The object detection itself is made on the Laptop and we "only" have to send commands to the Pi running the motors in the intended way but I frankly speaking do not know how these commands can be given to the Pi.

Any recommendations or complete different approaches?

Thanks

0

Why not just network the Pi and control it from the laptop using pigpio or gpiozero?

  • As stated, if we work on the Pi itself (connect a monitor), the frame freezes as the camera output is done via the Pi itself. So using pigpio, will this use the performance of the laptop streaming the camera output of the Pi? The main intention is to overcome this frame freeze which occurs running the code via the Pi itself – Arne Schrader Aug 21 '18 at 15:21
  • The pigpio script would be running on the laptop. It would be sending commands to the Pi to manipulate the GPIO. It is pretty much you are proposing other than the commands are sent over the network rather than over a serial link. – joan Aug 21 '18 at 16:13
  • Ok also read a bit about it and it sounds as this is the solution, but somewhere found that I can only put the pins into 1 and 0, so voltage or no voltage. Is it possible to execute full commands, so for example use the if function (object detection running the script on the laptop) and once this applies, write the dedicated pin, control the motor A with it and move certain steps up? – Arne Schrader Aug 21 '18 at 16:55
  • You can do pretty much what you want. There are plenty of examples at abyz.me.uk/rpi/pigpio/examples.html The same Python scripts can be run on the Pi or over the network, no changes are needed. – joan Aug 21 '18 at 17:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.