<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Ismael Peregrina on Medium]]></title>
        <description><![CDATA[Stories by Ismael Peregrina on Medium]]></description>
        <link>https://medium.com/@ismael.peregrina?source=rss-c594a66e6815------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*Yk3SVmSXD-gnAcVh.jpg</url>
            <title>Stories by Ismael Peregrina on Medium</title>
            <link>https://medium.com/@ismael.peregrina?source=rss-c594a66e6815------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 14 Nov 2026 22:26:01 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ismael.peregrina/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[OpenAI Meets Homebrewing: Building a Raspberry Pi-Controlled Brewmaster.]]></title>
            <link>https://medium.com/@ismael.peregrina/i-made-my-first-porter-beer-with-the-help-of-jarvis-openai-raspberrypi-d8b49ce84c08?source=rss-c594a66e6815------2</link>
            <guid isPermaLink="false">https://medium.com/p/d8b49ce84c08</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[beer]]></category>
            <category><![CDATA[homebrew]]></category>
            <category><![CDATA[raspberry-pi]]></category>
            <dc:creator><![CDATA[Ismael Peregrina]]></dc:creator>
            <pubDate>Mon, 16 Dec 2024 05:00:23 GMT</pubDate>
            <atom:updated>2025-01-06T22:12:19.554Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AER16FeRXMDtUbeR52Wyfw.jpeg" /></figure><p>Ever tried brewing beer? It’s a bit like conducting a 5-hour chemistry experiment, except at the end, you get to drink the results!</p><p>But here’s the thing — when you’re new to brewing, there’s this constant voice in your head asking, “Was this supposed to be second step or was it third? For how long am I supposed to wash the grains?” Temperature control, timing, and technique all play crucial roles in determining whether your brew turns out to be a delightful porter or something that makes your friends politely say, “Oh… interesting.”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*e44FKwa8Zvcxc3roDTTGUg.jpeg" /></figure><p>So I decided to put my pocket-sized AI assistant to the test — a little gadget I created using a Raspberry Pi Zero and a camera. I already wrote about <a href="https://medium.com/@ismael.peregrina/gemini-vision-raspberry-pi-for-the-visually-impaired-e41123fd401e">building this vision-enabled AI assistant</a> that can see, chat, and analyze whatever you show it. I call it the PeregrinEYE (I couldn’t resist the pun).</p><p>I wanted a way to get real-time feedback on my brewing process. Think of it as having an experienced brewmaster looking over your shoulder, but instead of a human, it’s an AI that never gets tired of your questions (and doesn’t judge your rookie mistakes).</p><h4>How PeregrinEYE Works</h4><p>The system is built on a Raspberry Pi Zero with a camera, and it’s designed to be super user-friendly. You just point to the direction of whatever you want to get some insights from and press the buttom.</p><p>I programmed it with two main interaction modes:</p><ol><li><strong>Single Click</strong>: Takes a picture and uses a default brewing-specific prompt to analyze what’s happening in your brewing process.</li></ol><p>This is the prompt used for the assistant</p><pre>unified_prompt = &quot;&quot;&quot;You are an AI assistant helping with brewing a porter beer. Analyze brewing images and comments, then provide brief, actionable feedback. Your responses should be easy to read and understand in a busy kitchen environment.<br>Recipe (20L batch)<br><br>Malts: Malteurop 2 row (4.50kg), Barley (0.113kg), Brown malt (0.230kg)<br>Hops: Cascade (34g, 60min), US Willamette (14g, 60min)<br>Yeast: BRY-97<br>Mash: 14.5L water, 77°C<br><br>Response Format (Keep it brief! 3-4 sentences total)<br>Direct Answer: If a question is asked, answer it immediately and clearly.<br>Current Stage: Identify the brewing stage ( Grain grinding<br>Mashing<br>Lautering<br>First wort boiling<br>Hop additions<br>Wort cooling<br>Fermentation<br>Bottling/Kegging).<br>Quick Tip: One sentence on a key consideration for this stage.<br>Observation: Comment on what you see in the image (1-2 sentences).<br>Recommendation: Offer a specific, actionable suggestion based on the observation.<br><br>Guidelines<br>Always address direct questions first with a clear, concise answer.<br>Be concise and direct. Avoid unnecessary explanations.<br>Focus on practical, immediate advice relevant to the current stage.<br>If unsure, ask a brief clarifying question instead of speculating.<br><br>Remember, your advice will be read in a busy kitchen. Keep it short, clear, and actionable and relevant to the  questions if asked.&quot;&quot;&quot;</pre><p><strong>2. Double Click:</strong> Activates voice recognition so you can ask specific questions about what you’re seeing + takes picture and sends it all to LLM</p><p>So the AI’s responses are structured to be clear and actionable, following this format:<br>- Direct Answer (if a question was asked)<br>- Current Brewing Stage<br>- Quick Tip<br>- Observation<br>- Recommendation</p><h4>The AI Actually Knows Its Stuff!</h4><p>Here’s where it gets interesting — the AI caught things I would have missed. Let me share a couple of memorable moments:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/650/1*7q0MNVAr9H3OVlX8-Mg7bA.png" /></figure><p>This was exactly what I needed to hear! Even though I hadn’t explicitly asked about the color, the AI recognized that a first-time brewer would want to know if their wort color looked right. It’s these kinds of intuitive observations that made having an AI brewing buddy so valuable.</p><p>Moving on, during the sparging process, I asked about using 80°C water(because a friend of mine told me to) and got this response:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/650/1*UvqgikZbA3LcS_3_0R3x7A.png" /></figure><p>And you know what? The AI was right! The finished porter did end up slightly more bitter than intended. While it worked well for this style, it was a noticeable deviation from the recipe.</p><p>Another time, during mashing, without any specific question from me, the AI proactively advised:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/637/1*No9iTgAw52d6-ogTFHoBLA.png" /></figure><p>This kind of preemptive advice about keeping the lid closed was exactly what some newbie brewer needs!</p><h4>The Technical Bits (But Not Too Technical)</h4><p>If you’re interested in building something similar, the core code and setup instructions are available in my previous article: [Gemini Vision Raspberry Pi for the Visually Impaired]. The main modification for the brewing assistant was:</p><ul><li>Crafting a specific prompt that understood brewing processes and could give structured, actionable feedback</li><li>Additional two button press functionality.</li><li>Using OpenAI instead of Google gemini</li></ul><p>Additionally I saved images and LLM outputs into a no-sql DB (mongo db) and then expose the whole process on a website here, just click the “load data” button in the link below and it will retrieve all steps, pictures in the brewing process:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/992/1*2wOe07lRIos_MMIHVO7MWw.png" /></figure><p><a href="https://beer.peregrinai.tech/">PEREGRIN.EYE</a></p><h3>Conclusion</h3><p>Building an AI brewing assistant might seem like overkill for making beer, but it turned a potentially stressful first brewing experience into an educational and fun process. Not all outputs from the LLM were useful though , some were just descriptive boring outputs , of common sense , but hey at least it did not messed the recipe. Plus, the beer turned out pretty good! The best part? The same setup can be adapted for any process where you need real-time visual feedback and expertise.</p><p>Cheers! 🍺</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d8b49ce84c08" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Gemini Vision + Raspberry Pi for the visually impaired.]]></title>
            <link>https://medium.com/@ismael.peregrina/gemini-vision-raspberry-pi-for-the-visually-impaired-e41123fd401e?source=rss-c594a66e6815------2</link>
            <guid isPermaLink="false">https://medium.com/p/e41123fd401e</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[gemini]]></category>
            <category><![CDATA[raspberry-pi]]></category>
            <category><![CDATA[image-to-text]]></category>
            <category><![CDATA[visual-recognition]]></category>
            <dc:creator><![CDATA[Ismael Peregrina]]></dc:creator>
            <pubDate>Fri, 06 Sep 2024 21:27:33 GMT</pubDate>
            <atom:updated>2024-09-09T17:54:34.932Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B4mRqj4R-cZuAUJ_YOOxeA.jpeg" /></figure><p>AI-powered audio guidance for the visually impaired. Explore your surroundings, identify objects, and navigate with confidence</p><h3>Inspiration</h3><p>As a programmer, I spend countless hours staring at code. One day, eye strain forced me to confront the world with blurry vision. This experience highlighted the profound impact of sight on our daily lives. It sparked a question: could AI, the very technology that caused this temporary setback, become a tool to assist when my vision needed a break?</p><p>Since I have been working on another project called <a href="https://medium.com/@ismael.peregrina/open-ai-autogen-raspberry-pi-autoberrypi-part-1-8107b3ceb531">AutoBerry Pi </a>, I decided to use it by adding a camera and a sound bonnet that will allow me to interact with an LLM and my surroundings to create something that could help the visually impaired understand their environment.</p><p>It is important to mention that I am aware this concept already exists; there is a very cool concept video of a man, using ChatGpt, receives assistance navigating a street.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F4sd7mMcm7jc%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D4sd7mMcm7jc&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F4sd7mMcm7jc%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/efbd5b426f961606882dff9562d8b672/href">https://medium.com/media/efbd5b426f961606882dff9562d8b672/href</a></iframe><p>I am not trying to compete with that; this project was conceived before that video came out and is driven purely by my love for testing LLMs with devices along my journey.</p><h3>What it does</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FsweDjI6Nu__JcSBSWerBg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ln0x-jG9-fF2yEyUdtKnhg.jpeg" /></figure><p>Here’s what it can do right now:</p><ul><li><strong>Image Description: </strong>Take a picture anywhere with sufficient light, and peregrinEYE will instantly describe the elements in the image from your perspective, providing rich details. It saves both the picture and the audio description as an MP3 for later reference.</li><li><strong>Coming in days:</strong> Interactive Guidance: Within days, peregrinEYE will take things a step further. Simply tell it what you’re looking for in the captured image, and it will provide audio instructions to help you reach the object, navigate around obstacles, or interact with your surroundings.</li></ul><h4><strong>How It Is Built</strong></h4><p><strong>Image Description Engine:</strong><br>We utilize the Gemini vision model to analyze pictures taken by the device and generate detailed descriptions. The prompt is extremely important in shaping the quality of the output. The basic prompt we are currently using gives us moderate to good results:</p><pre>prompt = &quot;&quot;&quot;You are a digital assistant designed to provide visual feedback for blind <br>individuals, helping them navigate their surroundings. Upon receiving an image, describe <br>in detail the key objects and structures, including their relative positions and contextual <br>information. Your responses should be concise, clear, and informative, <br>enabling users to orient themselves effectively. Additionally, learn and adapt to frequently <br>visited places to provide personalized guidance. Be natural in your responses, and focus on <br>providing valuable assistance to empower your users in their daily navigation.&quot;&quot;&quot;</pre><p><em>Update:</em> The preview model is no longer being used. The code now requires an update from 1.5-flash to:</p><pre>model = genai.GenerativeModel(model_name=&quot;gemini-1.5-pro-latest&quot;)</pre><p>Although the Gemini vision model offers decent results, it is not the best for this type of project, as it sometimes generates inaccurate descriptions (“hallucinations”). This could likely be improved with better parameterization and fine-tuning of the model.</p><p><strong>Text-to-Speech (TTS):</strong><br>We are using Python’s Google Text-to-Speech (gTTS) engine, which converts the descriptive text into clear audio for users. gTTS is a simple-to-use library that allows you to create unlimited amounts of speech, making it a great alternative to paid TTS services. With gTTS, you can convert any text into speech, including longer pieces of text. While there may be usage limits for some cloud-based TTS services, <strong>gTTS does not currently require any paid API</strong> or additional features for the purpose we’ve been using, allowing for free and unlimited speech generation.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fw.soundcloud.com%2Fplayer%2F%3Furl%3Dhttps%253A%252F%252Fapi.soundcloud.com%252Ftracks%252F1911745493%26show_artwork%3Dtrue&amp;display_name=SoundCloud&amp;url=https%3A%2F%2Fsoundcloud.com%2Fismael-peregrina-920697154%2Fperegrineye-response&amp;image=https%3A%2F%2Fsoundcloud.com%2Fimages%2Ffb_placeholder.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=soundcloud" width="800" height="166" frameborder="0" scrolling="no"><a href="https://medium.com/media/e460da0777f321a82753154f9d45e3ea/href">https://medium.com/media/e460da0777f321a82753154f9d45e3ea/href</a></iframe><pre>from button_library import Button<br>import subprocess<br>import os<br>from PIL import Image<br>from audio_library import AudioRecorder<br>from gtts import gTTS<br>from pygame import mixer<br>from dotenv import load_dotenv<br>import glob</pre><p><strong>Hardware:</strong><br>The core components of the system include:</p><ul><li><strong>Raspberry Pi Zero 2W</strong>: A compact and affordable microcontroller at the heart of the system.</li><li><strong>Adafruit Voice Bonnet</strong>: Used for high-quality audio input and output, ensuring clear communication between the user and the device.</li><li><strong>UPS Lite</strong>: Provides a reliable power supply for uninterrupted operation.</li><li><strong>Raspberry Pi Camera</strong>: Captures images for real-time analysis by the image description engine.</li></ul><p><strong>Programming:</strong><br>Python serves as the primary programming language to integrate the various hardware components and libraries, ensuring smooth interaction between the camera, vision model, and text-to-speech system.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1003/1*ToJQxCy_KpqmWywRSk5XmQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/679/1*b7exxNyYHGuDKDKuJMzKzA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/679/1*EGaVcgrt0432KtwuggNgWQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7Vj8nNZDpSgru56-9h9bSg.jpeg" /></figure><h3>Challenges we ran into</h3><h4>Lighting Sensitivity:</h4><ul><li>Poor Lighting Performance: As expected, Gemini Vision’s accuracy diminishes significantly under poor lighting conditions. This leads to an increase in hallucinations and inaccurate object identification.</li><li>Optimal Lighting Conditions: The model performs best with well-lit images, demonstrating greater precision and fewer hallucinations.</li></ul><p><strong>Update:</strong> After changing the camera, I noticed a significant improvement in image quality, which greatly enhanced the model’s performance. Therefore, I recommend avoiding this camera: <a href="https://www.amazon.com.mx/Freenove-C%C3%A1mara-Raspberry-soporte-ajustable/dp/B08Q34FKFY?th=1">Freenove Camera</a> and instead opting for the original Raspberry Pi camera: <a href="https://www.amazon.com.mx/raspberry-Pi-M%C3%B3dulo-c%C3%A1mara-megap%C3%ADxeles/dp/B01ER2SKFS/ref=sr_1_1?__mk_es_MX=%C3%85M%C3%85%C5%BD%C3%95%C3%91&amp;crid=13DZL4ZDIGBXX&amp;dib=eyJ2IjoiMSJ9.Mxhfs_WA7iaePlX6SDpgDnSgvjlZ2Mn7bNiUn_asJCFpnorLwL6UufQEJFnksAiulqnr2AVI_IircQMtv7R4B9GEU5k2mxDoFxhvpqt4QaPeKa7LGdrln2Ke0aG90J1he_yv16jO8plQO-YfY11chC_7lKW9OP6eComX2pg5sixN9eGheeVgx9INRQdMvWBzo3j3ROsuGtitNf5xkRtl3Xo5AMyOwg3I2ego9SwlfAnJf0xrXoGlVLPBvlsCEybB-tzST1CweL7teN6YX2zkaehNCM6XCbL1lpmvuc-mcxw.3Ue4zkdjD5rof1Rhf2ktVTTb-iLWUh2H7Q_R_HGtLc0&amp;dib_tag=se&amp;keywords=raspberry%2Bpi%2Bcamera&amp;qid=1725649753&amp;s=electronics&amp;sprefix=raspberry%2Bpi%2Bcamera%2Celectronics%2C155&amp;sr=1-1&amp;ufe=app_do%3Aamzn1.fos.242f5c11-6cfd-40d6-91f6-be3d1974080c&amp;th=1">Raspberry Pi Camera</a>, which has provided much better results.</p><h4>Hallucinations and Inferences:</h4><ul><li>Object Hallucination: Gemini Vision sometimes identifies objects not actually present in the image. This often involves objects typically found in the scene’s environment but absent from the specific picture. For example, it might infer the existence of a counter behind a shelf, even without visual evidence.</li><li>Public Figure Misidentification:<br>In one instance, the model incorrectly identified a Mexican public figure, <em>Lily Téllez</em>, on a billboard, despite her absence from the image. This suggests a potential bias toward associating prominent figures with certain locations, contexts, or even colors. I still don’t fully understand how it could misidentify Lily in the picture. While the image is related to politics (which is accurate, even though the people in it are not political figures), the only obvious clue seems to be the word “VOTA,” which means “vote.”</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YPCVAZZhyGr4gOy0gt5Lfg.jpeg" /></figure><h4>Distance and Detail:</h4><ul><li>Close-up Image Accuracy: Gemini Vision exhibits better performance when analyzing close-up images. The details are more discernible, resulting in fewer hallucinations and more accurate object recognition.</li><li>Challenges with Distance: Performance declines as the distance between the camera and the subject increases. Details become less clear, contributing to misinterpretations and hallucinations.</li></ul><h4>Multitasking Management:</h4><ul><li>A significant ongoing challenge lies in managing multiple services simultaneously. This includes voice generation, AI API calls, button and microphone inputs, and ensuring a fast response time from the AI.</li></ul><h3><strong>What’s Next?</strong></h3><h4>Here’s what’s planned for future updates:</h4><ol><li><strong>Microphone Support:</strong><br>The next step is to make the prompt dynamic, adapting to the specific needs of the user interacting with the device. With the microphone integrated into the audio bonnet, this is possible, allowing real-time customization of prompts based on user input.</li><li><strong>Connect API to Save Images, Requests, and LLM Outputs:</strong><br>I plan to create an endpoint that saves the images, user requests, and LLM-generated outputs. This will enable me to build a comprehensive record of interactions with the device, potentially transforming into a useful encyclopedia of user-device interactions.</li><li><strong>RAG Integration (Retrieval-Augmented Generation):</strong><br>I aim to integrate a module that allows the device to retrieve data from another API, enhancing its ability to understand and interact with images by accessing external knowledge sources. This will help provide more context and improve the accuracy of image interpretation.</li></ol><h3>Conclusion:</h3><p>It’s honestly been a blast wandering around the supermarket, pointing at random things, and seeing what the LLM thinks it’s looking at — sometimes it’s spot on, and other times, well, not so much! But that’s all part of the fun. This little device has so much potential beyond just playing around. Imagine using it to get nutrition info from food pics, identifying tags in a busy warehouse, or even tracking your health and healing progress. There’s a lot this thing could do, and I can’t wait to see where it goes next!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-zeIDcW7Hpc2n38rAAfe8g.jpeg" /></figure><h4>Code:</h4><p>PEREGRINEYE : <a href="https://github.com/peregrinAI-tech/PEREGRINEYE">https://github.com/peregrinAI-tech/PEREGRINEYE</a></p><p>AutoBerry Pi: <a href="https://github.com/peregrinAI-tech/autoBerryPi">https://github.com/peregrinAI-tech/autoBerryPi</a></p><p><strong>Note:</strong><br>Sorry for the mess in the code! The main code is in <strong>main.py</strong>, and I tried to organize each library into its own file. Some of the other files are just useful for testing individual components like audio, camera, mic, etc. It’s a bit of a work-in-progress, but hopefully, it still makes sense!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e41123fd401e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Open AI + Autogen + Raspberry Pi = AutoBerryPi — Part 1]]></title>
            <link>https://medium.com/@ismael.peregrina/open-ai-autogen-raspberry-pi-autoberrypi-part-1-8107b3ceb531?source=rss-c594a66e6815------2</link>
            <guid isPermaLink="false">https://medium.com/p/8107b3ceb531</guid>
            <category><![CDATA[raspberry-pi]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[openai]]></category>
            <category><![CDATA[autogen]]></category>
            <dc:creator><![CDATA[Ismael Peregrina]]></dc:creator>
            <pubDate>Thu, 07 Mar 2024 04:07:36 GMT</pubDate>
            <atom:updated>2024-09-27T14:47:45.915Z</atom:updated>
            <content:encoded><![CDATA[<h3>Open AI + Autogen + Raspberry Pi = AutoBerry Pi -Part 1</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KAGXFcCTyXUCQx7IBSY0FQ.jpeg" /></figure><p>So, after years of being glued to screens — watching movies, crunching numbers as a data scientist, and weaving data magic as an engineer — my eyes have officially gone on strike. Swelling, dryness, headaches — you name it, I’ve got it. It’s like they’re telling me, “Enough with the staring contests!”</p><p>This got me thinking. How can I continue doing the AI work and investigation that I love, minus the eye agony? There’s got to be a way to code without feeling like I’m in a desert staring contest, right?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mmktmY3F7RGpmaSJpG-_RQ.jpeg" /></figure><p>Then, I watched the November conference from OpenAI, where an engineer demonstrated talking to ChatGPT through his phone, complete with code interpretation and knowledge retrieval.</p><blockquote>It was the ideal tool for coding, except for one major change: they disabled running code in the cloud with the next update.</blockquote><p>Gone were the few days of simply saying ‘do this and run it.’ The latest update shifted the responsibility back to the user for testing. This meant once again juggling multiple screens, engaging in the tedious cycle of copy and paste, copy and paste, and then, when inevitably something went awry, embarking on a frustrating quest to troubleshoot errors. Ugh.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NhwJ3ja74StHNt3uF9nMcA.png" /></figure><p>So… what if I could create a device like the one we see in the movie ‘Her’, but for work? A device where I could just press a button and start talking, letting it handle all the coding, testing, debugging — all the heavy lifting for me. No screens, no strain, just me talking to this thing about how it should manage all the coding.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cdlCoIdka8XfIfmHYInSmA.jpeg" /></figure><p>I know, I know, there’s this shiny new thing called Rabbit.Tech. Pretty cool, right? But here’s the thing — I’m not looking to dive into a tech showdown. What I’m seeking is something a bit more… simple, minimalistic, and personal. So, I grabbed a couple of Raspberry Pi Zero 2 Ws, an e-ink 2.13” screen, a UPS Lite, Python, and Autogen, and started to explore how far I could go.</p><p>Consider this <strong>Part 1</strong> of a series where I’ll share every step, stumble, and success along the way. Let’s begin with the building blocks — the list of components that are laying the groundwork for this project. The aim is to create a device that’s designed to program itself, execute the necessary scripts, and even tackle its own dependencies if needed.”</p><h4>List of components:</h4><ul><li><a href="https://www.amazon.com/Raspberry-Quad-core-Bluetooth-onboard-Antenna/dp/B0CCRP85TR/ref=sr_1_3?crid=3TE3KZ2D4WYPY&amp;dib=eyJ2IjoiMSJ9.7uwaVS6VlIyCOjU6bSCtimLJztUEj1R7GFaRwXk6WHlWrDRzbTeOdGo7RMfSkGMRmqYig8GirdYHuSYLsSba3mP99OhwwcqpNVxgg6Lfm2Okd9SkQVKk9vBOhvurgKy2cepOAaPus9h0WQY2zZgEdmKIL0H4m4xQhgCaRHdyq4JYyIHWkI9w94qSM4Tra6zU5Kqyc5Jm6MbJnciHn-UYySh0goXnyrK_w_4Xsw_Pgy0.m8UQIC6tVAxTNfB56I-mIwOxRFrWE12_b7MNREhrI9k&amp;dib_tag=se&amp;keywords=raspberry%2Bpi%2Bzero%2B2w&amp;qid=1708632875&amp;sprefix=raspberry%2Bpi%2Bzero%2B2w%2Caps%2C110&amp;sr=8-3&amp;th=1">Raspberry Pi Zero 2 W (with Quad-core CPU,Bluetooth 4.2,BLE,onboard Antenna,etc.)</a></li><li><a href="https://www.amazon.com.mx/dp/B07Z1WYRQH?ref=ppx_yo2ov_dt_b_product_details&amp;th=1">2.13inch E-Ink Display Hat V4 Version, Black/White Two-Color 250x122 Pixel E-Paper Module for Raspberry Pi 4B/3B+/3B/2B/Zero W/WH/Zero 2 W/Jetson Nano SPI Interface, Support Partial Refresh</a></li><li><a href="https://www.amazon.com.mx/dp/B0BSQJCYL2?psc=1&amp;ref=ppx_yo2ov_dt_b_product_details">V1.2 UPS Power Hat Board, para Raspberry Pi Zero UPS Lite Power Board, 400mA Cargando 1000mAh Batería</a></li><li><a href="https://www.amazon.com/Kingston-32GB-microSDHC-microSD-SDCS/dp/B079GTYCW4/ref=sr_1_3?crid=1GF6Y7AFH3UQA&amp;dib=eyJ2IjoiMSJ9.DJlGM6qfTEoaIWYnjVLXvlRFqWHRyDmrOAZC7xYlE5PQCUiRmQahrkKOwyKJsfMcoA75xoYc43ptLvVyisTShid3jyOrsKTOrkAj3It95XQ3ecJmiJiTugj0-Bx4RSSl9qzoT_jD7OVL5DxtrNWb8Mtv3NhunWAvJdDQriiepjRSZkpkU3nKatbB_eF2D90Cg2EFuxtuHSMC1t8qos0Wyuw5FVJI5w8GRQVx4udyjrY.A0MQ2Rm2nwer6tM2o-2oKxwuTPNsCdto8n9EaCrNm_g&amp;dib_tag=se&amp;keywords=32%2BGB%2Bsd%2Bcard%2Bkingston&amp;qid=1708633156&amp;sprefix=32%2Bgb%2Bsd%2Bcard%2Bkingston%2Caps%2C102&amp;sr=8-3&amp;th=1">Kingston Canvas Select 32GB MicroSDHC Class 10 MicroSD Memory Card UHS-I 80MB/s R Flash Memory Card with Adapter (SDCS/32GB)</a></li></ul><p>However, I’d suggest opting for something other than the UPS Lite. When you try fitting the<strong> UPS Lite</strong> onto the Raspberry Pi, you’ll notice it doesn’t sit quite right. The issue stems from the battery placement, which<em> is sandwiched awkwardly between the Raspberry Pi’s board and the UPS</em> terminals. Instead of sticking with the Lite, my advice would be to go for the <strong>Pisugar S</strong> specifically for Raspberry Pi.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tkQO3HVApSz59sAdqsX0DQ.jpeg" /><figcaption>You can see the UPS lite is not leveled correctly when PI mounted on top</figcaption></figure><h3>The Basics: Laying the Groundwork for Your Raspberry Pi Project</h3><p>Before diving deep into the heart of this project, it’s crucial to get comfortable with the basics. If terms like Python and Linux sound foreign to you, or if the idea of installing an operating system on a tiny computer seems daunting, don’t worry — you’re not alone. Mastering a few foundational skills will make the journey much smoother and more enjoyable.</p><p><strong>Python and Linux Basics</strong>: If you’re not already familiar with Python programming or navigating Linux, I highly recommend starting there. Understanding basic commands in both Python and Linux is essential for this project. There are plenty of resources online to get you up to speed. A quick search for “basic Linux commands” and “Python for beginners” should point you in the right direction.</p><h4><strong>Installing Debian on Your Raspberry Pi</strong>:</h4><p>The first practical step in our project is to install Debian on your Raspberry Pi. Debian offers a stable and versatile foundation for our work. For a clear, step-by-step guide on how to do this, check out this helpful YouTube video:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F9fEnvDgxwbI&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D9fEnvDgxwbI&amp;image=http%3A%2F%2Fi.ytimg.com%2Fvi%2F9fEnvDgxwbI%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/7858d1ec35f82041163efa911f66a9ad/href">https://medium.com/media/7858d1ec35f82041163efa911f66a9ad/href</a></iframe><p>Remember to install Raspberry Pi OS Lite; avoid the full version. It’s almost counterproductive given the limited resources available on your Zero 2W. We’ll be connecting to the Raspberry Pi through SSH, which I’ve found to be the easiest method for the tasks we need to accomplish. If you missed installing SSH during initial config (like I did) dont worry , I explain later with some commands how to enable it.</p><h4>Getting to Know Autogen:</h4><p>Autogen will play a pivotal role in our project. It’s a tool that can significantly streamline our coding and scripting work, it is basically open ai code interpreter in the palm of your hand. To get a head start, I recommend familiarizing yourself with Autogen, especially how to use its Agents and how to install it on a standard computer. Here’s a great video to kick things off:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FvU2S6dVf79M%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DvU2S6dVf79M&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FvU2S6dVf79M%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/e921e82379cffc77916fb9e5093a0313/href">https://medium.com/media/e921e82379cffc77916fb9e5093a0313/href</a></iframe><h3>Lets begging with coding and configurations:</h3><h3>Step 1: Basic Setup</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*NNCub5P-NMjPU96KbjSP2w.jpeg" /></figure><p>With your Raspberry Pi booted up(Follow the video instructions above) and you’ve logged in — using a connected monitor, USB, and keyboard or trough SSH if you already configured it — it’s time to lay the groundwork for your project. This step involves updating the system to the latest software, installing essential tools like Git for version control, and configuring the Raspberry Pi for SSH access, which is crucial for remote development and management.</p><p>Update System and Install Git</p><pre>sudo apt update<br>sudo apt upgrade -y<br>sudo apt install git</pre><p>Use htop to check for available memory and space, which helps in managing your resources effectively.</p><pre>htop</pre><p>Enable SSH for Remote Access</p><ul><li>Allowing SSH access to your Raspberry Pi is essential for remote command execution. Well be connecting to RBP trough SSH exclusively</li></ul><pre>sudo raspi-config  # Then navigate to &quot;Interfacing Options&quot; -&gt; &quot;SSH&quot; -&gt; &quot;Yes&quot; to enable.<br>sudo reboot        # Reboot to apply changes.</pre><p>Add a New User and Grant Privileges</p><ul><li>Create a new user for customized access and grant admin privileges if necessary.</li></ul><pre>sudo adduser newusername  # Replace &quot;newusername&quot; with your desired username.<br>sudo usermod -aG sudo newusername  # Add the new user to the &#39;sudo&#39; group for admin privileges.</pre><p>Additional Commands for Device Management</p><ul><li>These commands are useful for checking connected USB devices, kernel messages, and sound devices.</li></ul><pre>lsusb  # Lists USB devices connected to your system.<br>dmesg | grep usb  # Filters kernel messages to show only those related to USB devices.<br>ls /dev/snd/  # Shows recognized sound devices.</pre><p>Note: Before proceeding with these steps, ensure you’re familiar with basic Linux commands and Python, as these skills will be necessary throughout the setup process.</p><blockquote><em>From now on, all subsequent steps should be performed via SSH. This means connecting to the Raspberry Pi through PowerShell or any other terminal capable of using SSH. Establish the connection with commands like:<br>```<br>ssh user1@nameofyourraspberry<br>```</em></blockquote><h3>Step 2: Installing Virtualenv (Optional but recommended)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/765/1*7vgc4P51_XBHjM9d4CXI9w.jpeg" /></figure><p><strong>Purpose</strong>: Virtual environments are essential for Python development, especially on a resource-constrained device like the Raspberry Pi. They allow you to manage project dependencies separately and avoid version conflicts. The use of virtualenv and virtualenvwrapper offers lightweight and efficient solutions for this purpose. In our case we will not be using different versions of python, only 3.9 which comes preinstalled with the Debian image(raspi os) any other version which is above 3.9 will also work</p><p>Install it on your Raspberry Pi using the following command:</p><pre>sudo apt install virtualenv</pre><p>Once installed, create a new virtual environment for your project with:</p><pre>virtualenv environment_name</pre><p>Activate the virtual environment with:</p><pre>source environment_name/bin/activate</pre><p>Virtualenvwrapper is an extension of virtualenv that provides additional commands for easier virtual environment management. Install it with:</p><pre>sudo pip install virtualenvwrapper</pre><p>Add the following to your .bashrc or .profile to create environment variables:</p><pre>nano ~/.bashrc<br>export WORKON_HOME=$HOME/.virtualenvs<br>source /usr/local/bin/virtualenvwrapper.sh<br><br>#After modifying the file, load the changes with:<br>source ~/.bashrc</pre><p>These tools are excellent for keeping your Python projects on Raspberry Pi organized, allowing you to install different package versions for each project without affecting others. Moreover, the use of virtual environments prevents package conflicts and facilitates the replication and deployment of your projects on other systems.</p><pre>#Create an environment with mkvirtualenv:<br>mkvirtualenv openinterpr<br><br><br>#Check the installed version of virtualenvwrapper with:<br>mkvirtualenv - version<br><br>#To deactivate the environment, run:<br>deactivate<br><br>#To re-enable it, run:<br>workon flashylights<br><br>#List all available environments with:<br>workon # <br>or <br>lsvirtualenv<br><br>#Delete an environment with:<br>rmvirtualenv flashylights<br></pre><blockquote><em>From this point forward, you should always use a virtual environment to install modules and do your script testing</em></blockquote><blockquote><em>mkvirtualenv autogen</em></blockquote><blockquote><em>workon autogen</em></blockquote><h3>Step 3: Installing wiringPI</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/187/1*A-00ysT6FZKGoi_Q_1d_iA.png" /></figure><p>WiringPi is a GPIO (General Purpose Input/Output) interface library for the Raspberry Pi. This library is written in C and mimics the Arduino wiring system to a great extent, which makes it easier for people familiar with Arduino to start working with the GPIO pins of the Raspberry Pi.</p><p>Before installing WiringPi, you need to install `lgpio`, a library that allows you to interact with the GPIO of the Raspberry Pi, akin to Arduino functionality.<br>```<br>pip install lgpio<br>```</p><pre>#**Update and Installation Steps:**<br>#1. Update your Raspberry Pi to ensure all existing packages are up to date:<br><br>sudo apt-get update &amp;&amp; sudo apt-get upgrade<br><br>#2. Install Git, as it&#39;s necessary for cloning the WiringPi repository:<br><br>sudo apt-get install git git-core<br><br>#3. The original WiringPi repository is no longer available. Instead, clone the WiringPi repository from GitHub:<br><br>git clone https://github.com/WiringPi/WiringPi<br><br>#4. Navigate to the cloned directory and compile and install WiringPi:<br><br>cd WiringPi<br>./build<br><br>#5. Verify the installation of WiringPi to ensure it&#39;s installed correctly:<br><br>gpio -v<br></pre><p>These steps will install the latest version of WiringPi on your Raspberry Pi. After installation, if you need further assistance or encounter issues, consider looking for alternatives to WiringPi or consulting specific Raspberry Pi forums for more detailed advice.</p><p>You could also skip this step until you have executed step 4 and 5 and ask autogen to install Wiring Pi , it will do all the work for you.</p><h3>Step 4: Installing Autogen</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*r7-b0ykfmcBDi0fRl-2wuQ.jpeg" /></figure><p>We will leverage Autogen for all our configuration and coding needs that are possible. This includes not only script creation but also libraries to interact with screens, audio, debugging, and more</p><p>In this article , we will not touch the basics of Autogen framework, neither OPEN AI Assistants , Agents , Group Chat, API Usage etc, its a very extensive topic that would require a full article by its own. I would strongly recommend that you get familiar with these topics prior to next steps, you can read about the basics in <a href="https://medium.com/@coldstart_coder/conversing-code-unleashing-collaborative-ai-with-the-autogen-framework-a5b04d94b6fd">Unleashing Collaborative AI with the Autogen Framework</a>, and if you want read about function calling you can read <a href="https://medium.com/@coldstart_coder/autogen-essentials-function-integration-for-smarter-agents-7c3b4a0fdc12">AutoGen Essentials: Function Integration for Smarter Agents</a>. We will be using both.</p><pre># Installing Autogen and python-dotenv<br><br>pip install pyautogen<br>pip install python-dotenv<br></pre><p>And that is pretty much it ,next , clone the testing code for this project from my GitHub page <a href="https://github.com/peregrinAI-tech/autoBerryPi">https://github.com/peregrinAI-tech/autoBerryPi</a> After clonning the repository change the .env file with your Open AI api key, this is your unique identifier to consume Open AI service. You can do this with the command:</p><pre>nano .env</pre><pre>#Location in repository<br>autoBerryPi/<br>├── .env</pre><p>Then you can run the first script with python</p><p><em>python singleAgentCoder.py</em></p><pre>#Location in repository<br>autoBerryPi/<br>├── autoPiCoder/<br>│ ├── singleAgentCoder.py</pre><p>If you receive this screen, that means you are successfully running autogen in your raspberrypi.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fILYS0GUqUY19zsq1F8ULw.png" /></figure><h4>Error Handling</h4><p>If by some reason autogen wont recognize your open ai api key , then move the .env to the same directory where you are running the python code.</p><p>If while trying to run your autogen scripts you encounter this error:</p><pre>from autogen import AssistantAgent, UserProxyAgent, config_list_from_json, GroupChat, GroupChatManager<br>ImportError: cannot import name &#39;AssistantAgent&#39; from &#39;autogen&#39; (/home/aimless/.virtualenvs/openint/lib/python3.9/site-packages/autogen/__init__.py)</pre><p>Or this error:</p><pre>61, in generate_oai_reply<br> response = client.create(<br> File &quot;...lib/python3.9/site-packages/autogen/oai/client.py&quot;, line 225, in create<br> raise ERROR<br>ImportError: Please install openai&gt;=1 and diskcache to use autogen.OpenAIWrapper.</pre><p>You will need to uninstall and reinstall autogen:<br>```<br>pip uninstall pyautogen<br>pip install pyautogen<br>```</p><p>If you receive an error like this:</p><pre>&#39;You exceeded your current quota, please check your plan and billing details. <br>For more information on this error, read the <br>docs: https://platform.openai.com/docs/guides/error-codes/api-errors.&#39;, <br>&#39;type&#39;: &#39;insufficient_quota&#39;, &#39;param&#39;: None, &#39;code&#39;: &#39;insufficient_quota&#39;}</pre><p>It’s because you need to prepay for the service. Not sure why OpenAI made this switch recently — probably a “give me money” move. But yeah, now you’ve got to load up your account with funds before you can start using their API.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ogjl6FewEUX-8fRM0Xw1kw.png" /></figure><h3>Step 5: Setting Up Autogen Agents for Script Creation</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*wK7uJn866ZEdBfsP.png" /></figure><p>Lets talk about budget first. I’ve been experimenting with Autogen and RaspberryPi for some time and have identified two efficient ways to configure the Autogen agents for different needs and budgets in raspberry pi.</p><h4>A. Minimal Budget Configuration</h4><blockquote>For those looking to minimize costs, you can set up your system <strong>using only a proxy and an engineer agent.</strong> This lean configuration allows you to work within a tight budget since fewer agents mean lower costs from the OpenAI API.</blockquote><p>Benefits of a Simple Configuration:</p><ul><li>Cost-Efficiency: By limiting the number of agents, you spend less on API calls.</li><li>Simplicity: Fewer agents mean a simpler setup, which is ideal for straightforward tasks or small-scale projects.</li><li>Speed: <strong>With only two agents</strong>, the system can operate faster, making it ideal for rapid development cycles.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1wu69q7H-Ayv4VgSu-Gtgw.png" /></figure><p>Utilizing only one agent and a proxy ,keeps the API costs significantly lower. This approach is particularly advantageous for those who are experimenting or have a limited scope where complex code generation is not necessary.</p><h4>B. Comprehensive Configuration</h4><blockquote>For those seeking the highest quality in code generation, testing, and code modification or improvements, a setup <strong><em>with four agents — engineer, executor, planner, and critic</em></strong><em> </em>— is the way to go. However, this configuration can be quite costly, especially when using GPT-4 for all agents.</blockquote><p>Advantages of a Full Agent Setup:</p><ul><li>Quality: More agents contribute to a robust code generation process, potentially leading to higher-quality outputs.</li><li>Testing and Improvement: Having dedicated agents for execution, planning, and reviewing (critiquing) the code helps in thorough testing and iterative improvements.</li><li>Complex Projects: This setup is more suited for complex projects where nuanced code generation and optimization are crucial.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Y-7DWy_-4M3WFJMIntS6RA.png" /></figure><p>The second graph illustrates the higher costs associated with a more comprehensive agent setup. Despite the increased expense, the value comes from the depth of analysis and the quality of code produced, which can be vital for complex and critical projects.</p><p>So I would suggest you start first experimenting and creating scripts with one agent and a proxy (<strong>option A — singleAgentCoder</strong>) , in order to minimize the budget used, but if you want to use a more complete team of AI agents that work creating code , testing and correcting use the one with 4 agents (<strong>option B — 4AgentsCoder</strong>)</p><pre>#Location in repository<br>autoBerryPi/<br>├── autoPiCoder/<br>│ ├── singleAgentCoder.py<br>│ ├── 4AgentsCoder.py</pre><p>The secret here, just like in everything with A.I. is the <strong>prompt engineering</strong>. The prompt for the singleAgendCoder that has been giving me great results in interacting with the PI as well as for code generation is the follwoing:</p><blockquote>‘’’You are a highly skilled expert in Bash scripting and Linux system administration, with a particular talent for working with Raspberry Pi devices. Your expertise extends to seamlessly installing critical modules and software packages on Raspberry Pi systems. Moreover, you possess a keen ability to troubleshoot and resolve coding errors efficiently. Additionally, you excel in configuring Raspberry Pi systems to meet and exceed user interaction expectations, ensuring an optimized and user-friendly experience.’’’</blockquote><p>So just fire up singleAgentCoder.py with</p><pre>python singleAgentCoder.py</pre><p>And ask for autogen to do something , it ll start programming with all the code created in a folder named “coding/”</p><h4>AutoBerryPi in Action: Letting it manage wifi configs</h4><p>So, we are ready to start using autogen in our raspberry pi : I had this idea to make my Raspberry Pi smarter about WiFi. You know how annoying it is to switch WiFi networks manually when you move from place to place? I thought, why not have the Pi do it for me? All I needed was a Python script that could read WiFi names and passwords from a text file and get the Pi to connect automatically depending on the wifi available.</p><p>Just in case you’re not familiar, the Raspberry Pi handles all its WiFi connections through a configuration file called wpa_supplicant.conf. Editing this file manually requires following a specific format, which can be a bit of a headache if you&#39;re not used to it.</p><p>I kicked things off by running singleagentcoder.py, and after getting past the initial hellos, I dove in with the prompt below.</p><blockquote>Create a python script that reads from wifiConfList.txt in the microsd and read the part that starts with SSID PASSWORD then takes the values from that file that are related to the wifi name and password (which will be given like SSID PWD and then you replace all that list with the correct format that is needed in the /etc/wpa_supplicant/wpa_supplicant.conf in order to go trough the wifis to connect. Remember this file is used by debian to connect to wifi s. You might need to add an example wifi conecction to the .txt you can use this one Mywifi and Sherlock.02 , do not restart de conection , just create the python script then lets test it and then we will read the end file to see changes</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HDs6sUffXAUoh6x9JNAMPg.png" /></figure><p>Autogen’s pretty smart; it comes up with a plan and lays it all out for you. If everything looks good, just smash that enter key, and it’ll kick things into gear, running all the steps it just laid out. Seriously, the enter key will become your best friend.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/735/1*JNjU0yi73zHhYd0LzjeP0w.jpeg" /></figure><p>A few taps and a bit of tweaking here and there, and boom — Autogen crafted this nifty script. It’s a real gem, effortlessly updating the wpa_supplicant.conf with the WiFi details from a text file I’ve got stashed with all my network info. This is what autogen coded:</p><pre>wifidaemon/<br>├── wificonf.py</pre><p>The AI threw out the idea of turning this whole setup into a daemon. That way, it’d kick into gear automatically every time the Raspberry Pi starts up. It even tossed in the suggestion of pulling the text file from a separate partition on the microSD card, making it super easy to update with new WiFi networks directly on the card. I’m thinking of diving into how to get that all set up in an upcoming article</p><h3>Step 6: Operator here.</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ErMA0s0abOKhqQQsF6LVjw.jpeg" /></figure><p>Alright, this brings us to the last part of this article. What we’re aiming to do is set up one Agent to be all ears, always ready to listen to the reasoning of the other agents, inputs and outputs and comunicate all this to the user trough the waveshare screen. We’ll try to get the Agent to show up as much as possible, or at least as much as the display function on the WaveShare Screen will allow. That’s the plan for this last part. Let’s dive in and bring it to life.</p><p>Open the Raspberry Pi terminal and enter the following command in the config interface.</p><pre>sudo raspi-config #Choose Interfacing Options -&gt; SPI -&gt; Yes Enable SPI interface</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*iXoNj94UrEvXU7Mfy8yzgA.png" /></figure><p>Now, lets use Autogen to let the PI autoinstall itself everything it needs to enable the eink display.</p><p>Just fire up the singleAgentCoder.py, and have a chat with our agent about getting the WaveShare 2.13 up and running.</p><p>Start off by asking, “Hey, do you know about the WaveShare 2.13 E-Ink display?”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*A_IuEnCHn7yXkQ8kOrbnUw.png" /></figure><p>All you’ve got to do ask for it to install the waveshare, nudge it in the right direction, and bam — it takes care of the installation all by itself.</p><p>In case you are not able to make it autoinstall correctly, you can use instructions provided by manufacturer <a href="https://www.waveshare.com/wiki/2.13inch_e-Paper_HAT_Manual">https://www.waveshare.com/wiki/2.13inch_e-Paper_HAT_Manual</a> , but as you can see those instructions are somewhat intrincated.</p><p>Now that the initial setup is done, it’s time for a quick test to make sure everything’s in place. Go ahead and run the Waveshare example I’ve got on my GitHub, or grab it directly from the Waveshare homepage. If all’s well, you should see your Waveshare screen spring to life with some changes.</p><pre>#Location in repository<br>autoBerryPi/<br>├── scripts_with_Operator/<br>│ ├── waveshare/<br>│ │ ├── examples/<br>│ │ │ ├── epd_2in13_V4_test.py</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XdVrj_bpFEGX3t4Q3WDHUA.jpeg" /></figure><p>So, now that we’ve got the basics down, it’s time to get our hands dirty and actually make something cool. We’re gonna build the operator, a basic one at least. Our plan is pretty straightforward: we’ll move the entire Waveshare folder into the coding folder, right where singleAgentCoder.py is set up and have Autogen to focus on epd_2in13_V4_test.py, asking it to dissect and summarize the script for us.</p><p>Armed with an understanding of how that script interacts with the Waveshare screen, we’ll guide Autogen to take that knowledge and forge a new script.</p><p>Okay, here is the walk through I had with Autoberry Pi. This will give you a taste of how a typical auto-install session might play out.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-RmgNVv7Ai1IaRDI-VmdfA.png" /></figure><p>Here’s the rundown: you kick things off by pointing Autogen at a file, asking it to give it the once-over. Next up, you tell it to yank specific functions from that code. Say there’s a chunk you want to work on separately — tell Autogen, and it’ll pop that part out into a new file. It’ll give the new code a whirl, but heads up, if it hits a snag, Autogen will bail.</p><p>When that happens, don’t sweat it. Just check out where things went sideways. Fire up Autogen again, point it to the file where it dropped the ball, and have another go. Rinse and repeat as needed.</p><p>After a bit of back-and-forth, tweaking here and there, Autogen really pulled through. It crafted this slick display_in_waveshare2_fixed.py script. It’s pretty neat—it not only throws messages up on the WaveShare e-Ink screen but also smartly handles overflow text. If there&#39;s too much text for one screen, it shows the first part for about five seconds, then flips to the next &#39;page&#39; to show the rest, like an e-reader.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HVpWrecupfPDvwPlqWB_Jg.jpeg" /></figure><p>By plugging this script into various agents, I came up with some interesting scenarios for logging or letting the user know whats going on inside the raspberry</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/747/1*J7_y3u1LYMfpV-jeESB0lA.jpeg" /></figure><p>You can take a look at these test scripts that use the operator here:</p><pre>#Location in repository<br>autoBerryPi/<br>├── scripts_with_Operator/</pre><blockquote><em>I used this configuration for my next project adding a camera and object recognition</em></blockquote><p><a href="https://medium.com/@ismael.peregrina/gemini-vision-raspberry-pi-for-the-visually-impaired-e41123fd401e">Gemini Vision + Raspberry Pi for the visually impaired.</a></p><h3>Conclusion:</h3><p>Wrapping up everything we’ve talked about, it’s clear we’re just scratching the surface with this project. We’ve made strides in communication with AutoBerry Pi, laying the groundwork for more complex interactions, like chatting directly with the device — definitely something we’re eyeing for future updates.</p><p>For now, our playtime with AutoBerry Pi is all about exploring its interactions with Linux systems and identifying its limitations. A crucial focus is on managing the overflow issues when too much context causes a break — this is high on our fix-it list.</p><p>So, stay tuned. There’s a lot more tinkering and testing ahead. Thanks for joining me on this journey into the world of automated scripting and display functions.</p><p><a href="https://www.linkedin.com/in/ismael-peregrina-70b86913/">LinkedIn</a></p><p><a href="https://github.com/peregrinAI-tech/autoBerryPi">Git Repository</a></p><p><a href="https://github.com/DonPeregrina">Personal Github</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8107b3ceb531" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ChatGPT, la AI, ayuda a mi hijo a pasar el examen final de “Conceptos y Dilemas Éticos” de…]]></title>
            <link>https://medium.com/@ismael.peregrina/chatgpt-la-a-i-7c40836a3a4a?source=rss-c594a66e6815------2</link>
            <guid isPermaLink="false">https://medium.com/p/7c40836a3a4a</guid>
            <category><![CDATA[chatgpt-chatbot]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[ia-en-méxico]]></category>
            <category><![CDATA[chatgpt3]]></category>
            <category><![CDATA[educación]]></category>
            <dc:creator><![CDATA[Ismael Peregrina]]></dc:creator>
            <pubDate>Sat, 21 Jan 2023 03:42:48 GMT</pubDate>
            <atom:updated>2023-01-21T13:07:10.968Z</atom:updated>
            <content:encoded><![CDATA[<h3>ChatGPT, la AI, ayuda a mi hijo a pasar el examen final de “Conceptos y Dilemas Éticos” de preparatoria</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Xb42J4OBFGUkrCGTt-WA2A.png" /></figure><p>Mi hijo y la A.I. (ChatGPT) obtuvieron una calificación de 90/100 en el examen final de la materia de Conceptos y Dilemas Éticos de preparatoria, una materia que mi hijo cursó con una montaña rusa de emociones que incluyó enojo, frustración, hastío, pero también sorpresa, curiosidad e interés.</p><p>Según sus palabras “La materia en si esta padre porque discutimos situaciones, dilemas y hasta filosofia seguido de mesas de discusiones donde pensamos en las implicaciones éticas, morales y científicas de las situaciones expuestas. Pero los exámenes parecen ser de una materia completamente diferente, el profesor nunca aterriza la dinámica de la clase con el tópico que tenemos que estudiar, las opciones multiples parecen ser todas iguales, y al final … ¿De qué carajos me va a servir en la vida reconocer las diferencias sutiles entre los dilemas inframorales de los infrahumano?”</p><h4>Simplificando el trabajo tedioso e … ¿inecesario?</h4><p>Como ingeniero y con mi formación en ciencia de datos, siempre he tenido una mayor afinidad por las ciencias exactas desde mi etapa como estudiante. Por lo tanto, entiendo completamente la frustración y el enojo que se siente al tener que estudiar materias consideradas por el como de “relleno”. Dado que este era el último examen del semestre y mi hijo estaba ya frustrado, harto y dispuesto a rendirse y reprobar el examen, decidí aprovechar esta oportunidad para probar los límites de abstracción y comprensión de ChatGPT.</p><p>Lo que hicimos a continuación fue muy sencillo, le dimos las preguntas del examen tal y como venían escritas en su examen y observamos si la IA entendía que tenia que hacer en cada uno de las preguntas. No le dimos ninguna instrucción extra ni le enseñamos lo que esperábamos de resultado. A continuación, se presentan 4 preguntas en las que utilizamos ChatGPT para resolver el examen.</p><h3>Primera pregunta: Una pregunta sencilla con una buena respuesta</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/921/1*_Y8UJZSc7SCByXHwJV-UDA.png" /></figure><p>Impresionante como pudo responder con la respuesta correcta junto con una explicacion del por que. Hasta ahorita todo bien, y aun y cuando la busqueda de <em>valor moral</em> en google no es exactamente la misma definicion que la de la pregunta, tal vez hubieramos podido extrapolar lala con lo que enontramos.</p><p><strong>Google 1er resultado</strong>→ <em>Se define el </em><strong><em>valor</em></strong><em> moral como la significación social positiva, buena, en contraposición al mal, que orienta la actitud y conducta del hombre hacia el obrar bien, ordenando sus juicios sobre la vida moral y las acciones derivadas de éstos.</em></p><h3>Segunda pregunta: Una pregunta simple, con una respuesta muy bien fundamentada y muy completa</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/921/1*vLz-d45l3vq8aDsBLbnlSw.png" /></figure><p>De la misma manera si buscamos en google “criterio axiologico de la filosofia” encontraremos lo siguiente:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/871/1*zujKVEs9eFWvA_N8dFRPBQ.png" /></figure><p>De ahí podemos inferir que la respuesta correcta es “Valores”. Nada sumamente extraordinario hasta ahora. Lo que es interesante es que ChatGPT no solo nos da la respuesta, sino que nos explica el por qué y nos justifica por qué las otras opciones no lo son las correctas</p><h3>Tercer set de preguntas: Donde se obtiene una respuesta mediante la abstracción de información de terceros</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/921/1*2qeqzdjh1wuI53AMF4fG4Q.png" /><figcaption>En esta respuesta le pregunté a mi hijo si estaba seguro de que la IA estaba en lo correcto, a lo que respondió: ‘Sí, está en lo correcto, porque Tomás de Aquino era un sacerdote, ya me acordé, y es la única respuesta donde aborda la religión como parte de la amistad’</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/921/1*jLaa01atL2GgbwR7yg-Lbg.png" /></figure><p>Para mí, aquí es donde comienza lo realmente sorprendente. La IA logra utilizar un concepto o caso expuesto para despues poder sintetizar, con una sola oración, la similitud entre la visión de un tercero (en este caso Santo Tomás de Aquino y Platón) y el caso hipotético. Y no solo eso, sino que además justifica su respuesta con base al conocimiento previamente aprendido. De la misma manera, justifica por qué las otras respuestas no pueden ser correctas.</p><h3>Cuarta pregunta: La única pregunta donde la IA comete un error que parece más bien un descuido</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/921/1*zqAZ02L2nXB49qD8UMjC3Q.png" /></figure><p>El error o descuido ocurre en el momento de dar su respuesta final, la cual es IIEII, se equivocó en dos letras, la respuesta correcta es IEIIE. Parece un descuido ya que en la explicación de la elección para cada uno de los puntos, explica correctamente a qué letra corresponde cada respuesta (IEIIE), entonces, solo se equivocó al inicio, dando la respuesta final como si se hubiera apresurado a darla.</p><h3>Conclusion</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hCcu3YGc-obzaIJeozZavA.png" /></figure><p>Mientras mi hijo estaba sentado allí, mirando la pantalla del ordenador que mostraba las respuestas de la IA, una realización se le hizo evidente. La máquina no solo estaba proporcionando respuestas, sino que también estaba explicando los conceptos más complejos y abstractos de una manera que nunca había visto antes. Las respuestas no eran simplemente regurgitadas de un libro de texto,sino que eran el resultado de una comprensión completamente profunda.</p><p>Mi hijo no pudo evitar comparar la explicación de la IA con las proporcionadas por su propio maestro, y se sorprendió al descubrir cuán más clara y concisa eran las explicaciones de la IA. Sintió como si finalmente hubiera entendido el tema, de una manera en la que nunca lo había hecho antes. Fue golpeado por el pensamiento de que, tal vez, la máquina había superado no solo a él y a sus padres en la comprensión del tema, sino incluso a su propio maestro.</p><p>Fue un momento humillante, sin duda, pero también uno iluminador. Mi hijo no podía evitar pensar en las implicaciones de esta nueva realidad, y cómo esto afectaría su propia educación y futuro. ¿Será esto la nueva norma? ¿Las máquinas continuarán superándonos en la comprensión y la resolución de problemas? Todo lo que sabía con certeza es que él ya no es el dueño de su propia educación, sino más bien un estudiante de las máquinas.</p><p>Notas del autor humano:</p><ul><li>Espero que el artículo despierte tu curiosidad para querer usar ChatGPT y probarlo en algun aspecto de tu vida y lo mejor de todo , todavia es “gratis”. Aqui está la liga — <a href="https://chat.openai.com/chat">https://chat.openai.com/chat</a></li><li>ChatGPT revisó la dicción, precisión y ortografía de todo el artículo, así que si hay quejas ya sabes a quién hacerlas.</li><li>Las conclusiones fueron creadas por ChatGPT, impersonando a Friedrich Nietzsche.</li><li>Las imagenes fueron creadas por otra AI (MidJourney) al darle a leer parrafos y oraciones de este articulo — <a href="https://midjourney.com/home/?callbackUrl=%2Fapp%2F">https://midjourney.com/home/?callbackUrl=%2Fapp%2F</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7c40836a3a4a" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>