
This server program turns a Raspberry Pi into an EZ-B V4.
VERY IMPORTANT:
Although Raspberry PI is a fantastic small computer can't replace low level micro-controllers, is not a Real Time device.
For specific low level operations e.g. PWM, I2C, SPI, Analog ports you will need additional add-ons i.e. Bonnets, HATS or serial devices.
Connecting cables or devices should be done offline
Raspberry PI is not an Arduino or an EZB-controller, does not have mechanisms to handle small short-circuits i.e. resistors between the headers and the micro controller ports.
Is a 3.3v logic device, in general, applying 5 V to an input that is not tolerant to 5 V may damage the microcontroller circuitry.
Yes and is very sensitive too touch: The Raspberry Pi board has exposed circuitry and electronic components which are subject to irreparable damage or destruction by static electricity.
You don't have to see, hear or feel a static discharge. Damage can be done without knowing it.
Regarding the software:
Copyright (c) 2019 Pedro Pereira
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
The server is open source code and is written in Python although I have a love-and-hate relationship with Python language, two annoying things: it's not statically-typed language (not good for people with Dyslexia or fat fingers:)) and uses indentation to start or end blocks (so yes a single space can break your code) nevertheless it's easy available.
Required components:Code:
sudo apt-get install python3 python3-pyaudio
Clone the source code repository on your raspberry pi home folder:
Start the server:Code:
cd ~/
git clone https://github.com/ppedro74/BlueberryServer.git
If everything is OK this is an expected output:Code:
cd ~/BlueberryServer/Blueberry.Server.Python/
python3 Main.py
you can see the Raspberry PI IP: 192.168.18.88 and two ports 10023 and 10024 replacements for the original EZB Port's 23 and 24.
The server is ready to accept connections and it will quit if you press ENTER.
Start EZ-Builder:
Press the Antenna and you will see your hostname IP and port press the Type: EZ-B
This is an expected debug output:
Add a camera control (Don't worry if you don't have one):
Note 1: the connection button will turn green and will be green as long you have a connection with the server.
Pick the Camera type
If you don't have a RPI camera .... A fake camera image showing a frame counter will be displayed.
I succeeded in launching the server and connecting ARC and the PiCam. The good news is the camera works very well, with all the fun stuff (color tracking...), with no latency.
I have also succeeded in adding D0 & D1 servos, even if I don't know what to do with it :D.
I still cannot use a Digital control to switch a LED, but i don't know if it has been implemented yet...
I will test it furthermore tomorrow (it is late now in France)
Without additional hardware, you have fake/dummy servos you can imagine them working
Yes is implemented. I added a version 4 to explain that capability, bear in mind the ports you used are available through the existent mapping.
I've Buster, updated. Please run the updates & upgrades.
Code:
EZ-Builder:
RPI3 Setup 1:
RPI4b Setup (With additional hardware: Google Voice Hat):
Both setups use the same D4,D5,D6 ports.
Wiring:
Yellow = 3v3,
Red = Gpio4
Green = Gpio5
Blue = Gpio6
Bear in mind RPI does not have resistors between the SOC ports and the headers like EZB.
The RGB breakout https://www.robotshop.com/en/rgb-led-breakout.html has 3 resistors and can be connected to 5v or 3v3.
The digital ports works ! I have successfully switch on my LED on my pi through ARC for the first time.
For the servos, now that the fake ones work (:D), I will try the generic PCA9685 board I have. I will play a little with it today....
Finally, I have an error when I enable audio support (the speaker-test was OK):
Code:
Thanks a lot for this great BlueBerry
If you have changes the above pull request may fail, Please copy or memorize the changes done e.g. activating the audio, and when you are ready run:Code:
the above commands will revert any local changes, then run (again):Code:
After this pull the audio is disabled (commented) so you will need to enable the audio.Code:
Let me know if it works for you too.
However, I cannot use the the speech synthesis control. ARC tells me that "This control is not supported on this operating system". I think it is because I use ARC on the pi with mono, right ?
I will try with ARC on my win10 PC (not available right now...)
Very fast camera stream, an no connection issues on my Rasberry Pi 3!!
But on my Raspberry Pi Zero the Camera is not being recognized...
1218-root-ERROR-Error loading PiCameraController ex=Failed to enable connection: Out of resources
I should mention, that it is the AIY Vision kit, so the camera is being routed thru the VisonBonnet!
P.S. I had to install psutil to get the whole thing working...
sudo pip3 install psutil
Let's say you have a USB and a normal Cam for the RPI and you want to switch.
Bear in mind the Raspberry PI cpu performance is even less than an old Intel Pentium, the reason why performs well video operations is due to a special combination of codecs and hardware design for example the Raspberry PI Camera blows away a regular USB camera.
Camera board vs. USB camera:
https://www.raspberrypi.org/forums/viewtopic.php?t=85899
Nevertheless I'll came back to this topic.
update your repository (check version 6 details)
then you can run:
videocaptureindex is used to specify the camera device, in my setup index 0 is the raspberry pi camera and 1 is the usb camera.Code:
you can troubleshoot your setup:
install the following packages:
then you can list the video devices:Code:
1) Output of a RPI 4 with USB camera:Code:
the USB camera index is 0Code:
2) Output of a RPI Zero with PI Camera and USB camera:
The USB camera mounts two devices but only the first one videocaptureindex=1 is valid.Code:
if you want you can obtain more details regarding a video device:
Code:
It works perfect.
I have a strange behavior with the server when picamera is enabled. As soon as I launch the server, the camera video occupies all the screen on top of every windows. The video is on all virtual desktops, as if it was a wallpaper, but on top of everything.
The strange thing is that if i do a screen capture, the camera video is not captured... It is the same if i take control of the pi via realvnc, i don't see the video on the host computer.
Do you have any idea of what is is happening?
Thanks
Fredebec
Fixed. Please update your local repository: (git pull)
I left the camera preview active by mistake, when you have the preview enabled the PI overlays the camera feed on top of HDMI image output, is pure hardware, that is why you can't capture is not in the gpu memory.
I was sure that you would have the solution :-)
Now I have to find what happens with the video stream in the last version of ARC (https://synthiam.com/Products/Releases/Beta-Release-2019-12-31-00-18952)
By the way, I tested the pca9685 for servo control under ARC and it works like a charm. I am going to test the Pimoroni pan&tilt in the next few days...
Thanks again for this great Blueberry server !
Only second post made on here, so i'm still a Newbie.
Not sure if i am missing something, but whenever i click on the links above that say to download version X (in this case version 6), all i get is a zip file and in the zip file is just a text file called version6.txt
Am i missing something?
Cheers.
The author of this ezb driver created a howto with step by step in the top of this page. Once you download the zip, the instructions to install it are above. Hope that helps!
I would recommend an arduino or something as an ezb instead though. I feel that using a raspberry pi as an ezb is a waste of processing capability. Take a look at the ardunio stuff if that suits your needs better. Although the raspberry pi does give camera capabilities. But most people just use a usb camera anyway cause of convenience and cost
Yeah, might change tack and look at an arduino instead and see how i can mount a NUC running ARC on my robot.
And don't forget..... Bird IS the word :-)