During the Christmas holidays, I took the time to work on the Agayon. I hope that the mechanical parts are almost finished and I will be able to focus on the code in the following weeks/months.
Do as you’re told
A few years ago, I have been gifted with a PS4 controller to play on my Retropie Setup. These are quality controllers but Sony does not like makers. My model cannot be used with vanilla bluetooth drivers on my Pie. And for unknown reasons, the alternative driver ds4drv does not works for me. I purchased a 5m USB mini cable to not disappoint my lovely niece and nephew. They can plan with Supertuxkart for hours. But it's not the subject of this article. I plan to use the Agayon not only in my apartment but also to go on tour with it ! (let's dream a bit). Unfortunately, it is already quite heavy and it could be cool to drive it from my door to the car. I could dream again and imagine a system where it recognize me after a little bit of training like a dog or a case. It seems possible but why not use the controller at first. It should be easier and quick to implement. Moreover, the kids and friends seems to love the idea. So let's do it ! I will keep you updated when it is reliable and easy to use.
I have finally mounted the Lidar on the Agayon. The Raspberry Pi 2 was too slow to handle the data but the Pi 4 does well the job.
My living room
The following animation has been made with the animate.py script from the RPLIDAR repository.
Streaming
Last year I discovered the Raznot project and it inspired me. According to the readme, the RazTot is an easy DIY project which allows you to remotely control a roving security camera securely from your browser. After some tests, I decided to not use this project because the flask server and interface would not so nicely integrate with my R1D3 base code. I only use Janus Janus, a general purpose WebRTC server to stream from the robot in a generic web page for now. Unfortunately, my Microsoft LifeCam Studio does not produce a stream compatible with Janus. I need to transcode the MPEG-4 video stream to H264 with ffmpeg to see it in a browser. I hope to be able to release the code in the following weeks.
Converse is a JavaScript XMPP client that can be run in a web browser. Unfortunately, it does not support the XMPP extension (XEP) that allows to verify HTTP Requests via XMPP (XMPP): XEP-0070. So I decided to code a small plugin to provide this functionality.
After months of work on the Agayon, I can present some significant improvements ! This article is a little bit longer than the previous ones but it worth the read!
Software updates !
During the past few weeks, the code base of the Agayon has been updated. I forked my own project, r1d2 to update it. The new repository is named r1d3. I hesitated a long time before forking it. As the hardware base of the Agayon completely changed, I preferred to change the code name to maintain coherence between hardware and software.
As I made tests with SLeekXMPP to control the bot, I observed some problems with Gajim. The Ad-Hoc extension allows one to send commands to an XMPP bot. R1D3 displays the following menus and submenus (in french):
When I try to use the "execute" button, SleekXMPP start a new session and Gajim complains that the session identifier has changed. I reported the problem to SleekXMPP and its fork SliXMPP. The XMPP community is great and Maxime Buquet responded quickly. To quote him, there are two problems (see the bug report for the whole explanations):
Slixmpp shouldn't assume execute is the start of a command
I don't see a place in the XEP that says that next or execute can be equivalent to complete. What to do?
He sent an email on the "Standards" mailing list and some responses followed. It seems difficult to fix the protocol at the moment without breaking compatibility. Maxime proposed a patch to fix Slixmpp and it should work on SleekXMPP. For now, I just don't use the "Execute" button as "Forward" does the job. The depreciation of the "Execute action" is actually discussed.
New hardware !
The Agayon has now 8 LEDs and 6 switches. They are placed on a control panel.
The serial interface of the SHT7x is optimized for sensor readout and effective power consumption. The sensor cannot be addressed by I2C protocol, however, the sensor can be connected to an I2C bus without interference with other devices connected to the bus. Microcontroller must switch between protocols.
One ground to rule them all
I have been advised to use an epoxy base coated with a copper layer. The aim is to connect it to the negative pole of the battery. It is really useful because it decrease the wiring. The perfboards are fixed on metallics spacer bars to avoid shortcuts.
I2C Scans
I²C is a bus communication that allows multiple device to communicate with each other.
I2C devices are recognized by the Arduino (5V) and the Raspberry PI (3.3V) with the help of a level shifter.
user$ i2cdetect -y 1 0 1 2 3 4 5 6 7 8 9 a b c d e f00: --------------------------10: -------------------------- 1d ----20: 20 ------------------------------30: --------------------------------40: --------------------------------50: --------------------------------60: ---------------------- 6b --------70: 70 --------------
Gallery
"Scaffolding" with hot glue
During the past few months, my best friend has been my hot glue gun. I was skeptical at first but really much effective and fun. I used it to insulate some connectors. In Liège, we would say "mettre une noquette de colle" which translates to "put a knob of glue".
Evolution of the frame
A : Battery
B : Level shifter between Arduino (5V) and Raspberry Pi (3.3V)
C : Arduino Mega
D : Power lines and I2C (12V, 5 V, 3.3V, SDA 5V, SCL 5V, SDA 3.3V, SCL 3.3V)
E : Raspberry Pi (in his case)
F : Buttons and their pull down (3.3V or 5V depending on the GPIO)
G : LEDs
New (old) Oscilloscope
One of my colleague has been cleaning his lab, and he asked me if I was interested to have an old 20 MHz oscilloscope. I gladly accepted. It is a 34 years old Circuitmate 9020 (bought in 1985).
I will use it for I2C debugging and visualization.
Conclusion
The hardware is almost done. I am happy to have a nice reliable base. I hope to be able to drive it with my smartphone soon. I will continue the programming to add the mapping functionality and a nice demo mode.
Running a server on the internet is quite an adventure but it's not always easy to keep track of log files, security and potential threads. This article describes some actions carried out on this server to mitigate script kiddies.