A Winter Break Exploration into AI-Driven Image Generation

We get a rather substantial winter break at SUNY Brockport, and I often use this time to do something “different”. This year, I wanted to explore image generation using AI (since everything AI is all the rage right now). Furthermore, I upgraded my computer recently and purchased a high(er) end graphics card. I got to thinking that running AI generation software locally might be a good test of my system, but needed a project. Then, I found this in my inbox:

I tend not to trust NY Times emails (if you trust blocked content, then any ads in the email are shown; however if I go directly to the website, my adblockers do their job). What is interesting is that the alt text for the image seems very AI-like. I wonder why a company focused on writing words needs to use an AI to generate a caption for an image they created (hopefully that is the case). It got me thinking: if they used AI to generate this caption, I would like to see what AI does with those words as a prompt to generate images.

I would not say that getting my computer set up for image generation was trivial; however, the documentation at huggingface has been extremely helpful with clear and concise examples. Knowing a bit of python – and knowing that ChatGPT can generate the code I don’t know, has made creating a simple locally-driven image generation app fairly straightforward.

Anyway, on to the results. I took the caption above and used that to prompt some image generation models. There are a bunch out there, including stable diffusion, open journey, and open dalle. I’ve got a version of each stored locally, and here’s what they came up with.

Continue reading

I learned three things today

I have been atypically quiet on my website lately. That’s largely due to the fact that running the makerspace is taking up a crazy amount of my time, including all of the time I would have devoted to making things. But this weekend, I’ll have a table at the Rochester Children’s Book Festival, and I felt it was time to pull out some projects for the table.

A few years back, I made The Pi Projector which is a Raspberry Pi connected to a cool projector screen dev board. I was pretty happy to see that it was working really well even after sitting for a couple of years, so I did something stupid.

I updated the software.

Yep, you know all those recommendations that you should always keep your software up to date to avoid security problems? Well, I’m of that camp. However, there’s another camp that says never ever upgrade anything that is important days before it is needed. That latter camp is very smart. Sure enough, immediately after updating, my projector stopped working.

Fortunately, I have this website, which is the only place I stored any type of documentation of the project. I found out how to do the install and where I obtained the original instructions.

Unfortunately, if you go to that website, you’ll see that the domain is for sale and no longer contains useful information. Ugh.

Fortunately, there is this thing called the Wayback machine, which through some complex form of computing trickery, has captured snapshots of over 850 billion web pages over time. Seriously, I don’t know how they do it, but this is amazing.

So I took note of the time stamp on the post where I showed off the projector, and found a snapshot. There, I noticed some code that belongs in a file called config.txt as well as some that belongs in rc.local. I’ll put those snippets at the end of this post not because they help the story, but because who knows if I’ll be able to find them again.

Unfortunately, this still didn’t do the trick. For some reason, the splash screen never changed on the projector, and it took a bit of debugging to figure out why (and by debugging, I really mean guesswork).

I found that in the rc.local command, the value 3 was related to the particular communication channel (called i2c bus) that the projector is using. When I looked at the i2c devices in the /dev directory, I didn’t see any labeled 3, but I did see one labeled 11. After giving that a try, things started working again.

So, what did I learn throughout this whole process?

  • Always keep notes of your projects, preferably in a format that is searchable so you can refer back to them years from when they are recorded.
  • Know how to search the web, including how to search the web that no longer exists using the Wayback Machine.
  • Never, ever, EVER, update your hardware days before you need them for a program. That’s just stupid. (But I’ll probably do it again.)
Read more: I learned three things today

Add this to config.txt

# Add support for software i2c on gpio pins
dtoverlay=i2c-gpio,i2c_gpio_sda=23,i2c_gpio_scl=24,i2c_gpio_delay_us=2

# DPI Video Setup
dtoverlay=dpi18
overscan_left=0
overscan_right=0
overscan_top=0
overscan_bottom=0
framebuffer_width=854
framebuffer_height=480
enable_dpi_lcd=1
display_default_lcd=1
dpi_group=2
dpi_mode=87

dpi_output_format=458773
hdmi_timings=854 0 14 4 12 480 0 2 3 9 0 0 0 60 0 32000000 3

Add this to rc.local – make sure you confirm that the right bus is chosen for the value after -y

pi@raspberrypi:~ $ sudo nano /etc/rc.local

...
sudo i2cset -y 3 0x1b 0x0c 0x00 0x00 0x00 0x13 i
sudo i2cset -y 3 0x1b 0x0b 0x00 0x00 0x00 0x00 i

exit 0

Lastly, here’s the wiring information.

Wiring

The wiring is not difficult, but there are quite a lot of connections to make (27 to be exact). It is important to take your time and double check every connection before powering on the Raspberry Pi.

Below, are the pins and their numbering on the EVM (source):

Here’s how they map to the Raspberry Pi’s GPIO:

I’ve added P2_6 (5V) via GPIO pin 2 to power the EVM from the Pi or vice versa. A bridge is then required on the EVM from P2_6 to J3 using the M-F jumper wire. The EVM’s 5V/3A power supply is plenty to power both devices.

Rekindling the Spark: It Begins with the MLK Boys Academy

I am currently reading a book about telling stories, so I’m doing a little experiment with my blog posts. Hopefully, they will be a bit more engaging, or perhaps I’ll just learn a bit more about effective communication. I do use AI to help get things started and learn ways of stating things I haven’t thought of. However, I’ve done enough editing of the generated text to call this my own.

Unless otherwise noted, all photos are credited to Sophia Timba

Recently, I was standing in the hallway of the SUNY Brockport chemistry building, watching a procession of thirty some students and a few of their teachers. They were taking part in the MLK Boys Academy, a program for inner-city students from Rochester to acquire life skills and explore various aspects of social and professional development.

My colleague, Carly, and I were tasked with hosting a one-hour workshop for the Academy, aiming to ignite their curiosity and passion for science through hands-on experiences. Since I recently started a Makerspace, “It Begins in Brockport” (IBiB), I wanted to incorporate makerspace resources. One of our recent acquisitions, a Maker Cart from TeacherGeek, provided all the materials we needed for this endeavor.

Continue reading

Setting sail

A quick update: I was interviewed by the local news (ABC channel 13) about a recent makerspace event where we had kids and their parents build some boats to try in the Erie Canal. Here’s the link to the story, so please check it out. I’ll edit this post later with the “rest of the story”. (Short answer, yes, all the boats did float – eventually – and two of them did make it across the canal.

https://13wham.com/news/local/brockport-kids-set-sail-in-science-building-boats-with-recycled-materials

IBiB: Building boats and making waves

If you are a regular reader, you know that I recently started a makerspace in Brockport called It Begins in Brockport (IBiB). We are only a month old and have come a long way in that short time. We’ve equipped our space – one of the studios at the Hart Art Gallery – with 3D printers (both filament and resin), an electronics workbench and a laser cutter. There’s also a CNC mill that is still a work in progress and we recently received a grant for a high-end vinyl cutter. On Friday, we received something truly special.

That’s a makercart (along with Kaitlyn and Mark) from TeacherGeek, a local company that makes STEM educational activities. The cart – valued at $8000 comes with about 15000 bits and pieces (gears, rods, frame, motors, connectors, switches, screws, and more) that can be used to engage students in well over 30 engineering activities.

Continue reading