Saturday, March 29, 2025

free speech isnt free

 This thought has popped into my head at random times, but in particular when I read an article like this one:

https://www.theverge.com/news/637228/madison-square-garden-james-dolan-facial-recognition-fan-ban

If you don't agree free speech isn't free, next time you see your boss go tell them off. 

Free speech isn't free from repercussions. I guess that means free speech is only free from government retribution and not from ....what's the right word....civil retribution?

I can only imagine the way you can have the idea of free speech truly freely is by being anonymous otherwise if someone connects it to you, there can be benefits and drawbacks.

Thursday, March 27, 2025

apples

 A few months ago maybe, I thought, I should eat more apples, cause if an apple a day keeps the doctor away why not?

I discovered a curious side effect.... My heartburn problems subsided a lot. Like very noticably so.

I will admit I've been trying to eat healthier in general, this year in particular so that's also a factor, but even if I eat something and I start to notice heartburn, an apple later and I'm feeling great 

This may not work for everyone but it has been honestly life changing so if you get heartburn, I'd say....give it a try (unless you're allergic), what's the worst that happens, you eat a few extra delicious apples?

Wednesday, March 26, 2025

generative AI, and knowledge work

 I read an HN (comments) on the impacts of generative AI on critical thinking...https://news.ycombinator.com/item?id=43484224


I have thoughts up front....yes there is likely a loss of the inquisitive nature of some things. I think, I don't need to think too much about this until the AI fails then I'll figure it out. But then again, at some point maybe AI will stop failing, and then we have a utility. 


Just because a calculator can add numbers doesn't automatically remove our critical thinking in math, but as I'm writing this I do think....how much of math is doing things that calculators are doing or using critical thinking to either solve proofs/etc or design computing systems to solve proofs, or conjectures or whatever. 

So what does that mean for generative AI? 

I also sometimes think about things like this as forms of abstractions. Like because we can write in python it changes the critical thinking we can and do, do, because we don't need to worry or care about which assembly operation we need to perform to move some data to memory or whatever, we just say, python do, and it does. Does that make us think less critically? Maybe? But also maybe not? Maybe it gives us other things to think critically about. 


I do plan to read (or listen) to the PDF referenced by the HN link, maybe I'll have different opinions after that.

Tuesday, March 25, 2025

always ready presenting

 I'm the last like 3 weeks I have been asked to present by 3 different people. (2 of the request made today lol)

This got me thinking..it's probably a good idea to have a ready made presentation I can use at a moments notice.

The problem is that it's always nice to talk about different topics or different things about a particular topic (not rehashing) so another thought is just always be taking notes in almost a PowerPoint form, so that when asked you're like 50-75% there, you have the content, make it look pretty and good to go.....

I've done a little of this, I just need to continue to be good at staying on top of having presentations always ready.

Do you have this problem? How are you prepared? Do you just say no? (Which I also have a tough time doing ;))

Monday, March 24, 2025

10 unusual uses of Large Language Models

It's high time I mention large language models here.

I'm sure you're aware, or have heard of them, however large language models are a transformer based approach of using Machine Learning, trained on large large corpuses of text, (think all of reddit, or all of youtube captions,etc). Which now are able to answer a considerable number of questions.  (Including coding/etc).

Ignoring all the ethical concerns (which of course there are lots, and we can talk about them later).

Here's where things get fun. I wanted to talk about unusual (to me) cases of LLM's I've used. So here goes!

1. I have asked LLM's to build me a playlist of songs that are popular for various times. (And subsequently asked it to write code to search my library for songs, which it failed to find well, I may try again with a local LLM and pass the song names in as groups, and see if that does better).

2. Upload a picture of my shirt, ask it to give me ideas how to tweak it with cricut iron-on's to make it unique, but also fit the theme.

3. Plan out stops or recommend places to visit for a trip. (Basically a trip advisor)

4. I used ChatGPT to figure out what airports to fly out of for various universities. (As part of my Conferenceships Chair Role for acsac.org)

5. Make lots of little apps. Ever googled QR code generator? How about extracting audio from a video? Yep pretty easy with ChatGPT to create a basic server and front end.

6. Rewrite Christmas songs to be silly?

7. Double Check doctor diagnosis/supplemental questions for doctors visit!

8. Aid in making a commercial detection algo using ffmpeg

9. Copy/Pasted a schedule into ChatGPT and asked for a ics (calendar) file....and surprise it worked great!

10. Asked it to plan out my lawn care activities for the year, and make a calendar file to load to my phone so I know when to do what!

 

What else do you use it for?

 


Mr beast??

I came across this a while back (maybe also from hacker news) https://drive.google.com/file/d/1YaG9xpu-WQKBPUi8yQ4HaDYQLUSa7Y3J/view

 It's an interesting read and makes me wonder how much of what he claims about video retention applies to written communication. Specifically proposals. My goal is to try some of the techniques, and see if my proposals are viewed as better or not :).

 I'm also interested in taking a Mr. beast approach to proposals to read and see what makes a proposal successful and worth funding.

Another interesting comment in the doc says something along the lines, if you don't keep learning new things you will run out of things to draw from. So always be discovering/consuming new things. 

Anywho I think it's a worthwhile read that almost leaves you out of breath by the end with how aggressive things feel. I think it's a mindset you can approach to many fields not just youtube creation for Mr. beast. Being out of breath is Not necessarily in a bad way, but just is.

Sunday, March 23, 2025

acting

 

All the world’s a stage,
And all the men and women merely players;
They have their exits and their entrances;
 

I used to wait tables at Pizza Hut (yes they had dine in, and yes they had waiters/waitresses, crazy right?) and I often thought about how I felt like there were parallels with what I did to acting. The goal being to take my customers out of the every day, and create a space where they don't have to worry or think about anything but enjoying themselves at the meal. You ask how they are doing, perhaps you truly deeply cared what they said....but if you didn't, you acted like you did.

 
 
Now I do work in tech, and many times I feel like I don't fit in, people think I know things that I don't, that I'm an expert in some things that I'm not. There is of course the phrase fake it till you make it, which gives me similar vibes to the above. Sometimes you have someone that really is truly and deeply an expert in things, but often, we are just people who have had some experiences in a topic and that's all people need. Sometimes you just have to get outside your own brain and just act like you know what the heck you're doing....and do it.

I've done this a lot in the past, and it's worked out well, lately it's been feeling like, why are people coming to me, I'm not an expert.....but I guess maybe I am in some ways that I just can't and won't acknowledge. Time to step out of that mindset and own what I am and do and am capable of.

Saturday, March 22, 2025

sometimes doing random things is ok

 

I went on a trip recently and I was of course making last minute updates to my DMS driving app.

By default I have 2 modes, normal daytime mode which is just a boring bootstrap table of black text, with alternating white and gray cell colors per row....very boring.

 Then I have a night mode it is entirely black background with a darkish green text, ....for night time...

I've been thinking for a while how can I make this work better on cell phones. I have a few problems if I have too many columns, then the text has to be tiny to see anything and we'll....if you're driving, trying to glance at something tiny in the car is not ideal. I asked ChatGPT to help me out.....it's far from done, but it's progress. I asked for it to make me a page that changes the font randomly (I don't even know what the default font is but who cares let's try other things), changes the background of the page to a random color and changes the font to a random color.... I didn't review the code too much because if it didn't work I haven't default modes, and its a display page so it's not modifying the underlying database or code, so low risk, potentially......some amount of reward.

Here is an example of the randomly generated page. (Oh I also had it add a save option so if I really liked it I can continue using it, the save option kinda works but that's a story for another day).


 

I know I know, the colors are appalling, but if I'm being honest, it's legible, somewhat, so I don't mind, plus I can just hit refresh page and it'll give me a new color scheme.

I'm planning on running with this, and fiddling with my display, I have 2 columns that are the most important, and other columns that would be 'nice'. I also have more content that I'd like to have, maybe some kind of what food is nearby that automatically pops up either within 10 miles of a place, or maybe if the time is of arrival of a city is within 11-1pm so we can easily see what's in the area. Maybe using LLMs as a semi family preference filter for kinds of food.

I'm just gonna say it, sometimes doing random things is a good thing, it inspires new ideas and things maybe you hadn't thought of before. Try to put a little more intentional randomness in your life.


(Funny side note, for a bit I would be working on multiple projects with roughly equivalent priority, so I would just take out a 50 cent piece, which is of course more fun than a quarter, dime, nickel, or penny, and flip it, heads I work on problem X tails I work on problem Y. Was a fun way to have a bit more randomness, and also reduced my decision making requirements).


Have a great day!


(I'm trying to get into the habit of blogging more again)


Friday, March 21, 2025

fungibility

Money fungibility has a lot of valuable properties.  I want to talk about one silly idea I thought about. What if money wasn't fungible.

I was reading an article about patent trolls today on hacker news. It mentioned naming and shaming these patent trolls, but what if money wasn't fungible, what if we had pihole for money, with blacklists, white lists, and overrides.

What if tomorrow I could grab a list and say, I won't accept money from, or purchase from a business who accepted money from a particular person (or list of people)....effectively cutting them out of society at least....somewhat. if enough people said, I won't accept the dollars that the trolls used, then businesses would have to decide, are there enough people who will accept the money, or will they end up with useless dollars and eventually have to block them out as well.

While it can be fun to think of these ideas I am actually really glad we have fungible money. This example can be extended in lots of ways, and can really make a mess of things. What if you accidentally let it slip you voted for a particular law, and enough people didn't like the law. Could the above happened to you, etc. 


Phew, I'm glad cash is fungible.....

This ignores credit cards, or other forms of money that we currently use. I wonder if anyone has built these kind of tools for CC payment processing.....probably not the cc companies, but they prob have lists of some sorts, though it's in their best interest for everyone to spend $$ because they capture value on every transaction.


*To be fair, that doesn't mean some of these things can't be done with fungible money, it would likely just be at a small scale, or would require considerably effort and is just not even a little realistic.

slurp slurp slurp

 So I got bored the other day, and thought, I wonder if my website is in chatgpts model......so I started asking about onaclovtech, and sure enough my main page is on there. 


This got me thinking, a. You might be able to build a bit of a personal archive of (hopefully not PII) things that you can then reference later if they update models to current updates. This is kinda neat.  I did see something on hacker news recently talking about this personal archive but that would possibly work best for local LLMs what they were talking about


I've also wondered about building a form of an attached knowledge base that I can reference, such as preferred foods, etc, so if/when the option of pre ordering or ordering for delivery happens, maybe I can just say, hey can you order me food from X and it'll just know, yes he likes this. I don't stray a ton, but one could argue if I said, I've had x,y,z then it can infer maybe I'd try something new each time.  Maybe give me a hey, you haven't tried p, or q, wanna give one a try? 


Lotta potentially interesting things if it can reference your knowledge base, something I'd like to get better at developing!!

Friday, February 28, 2025

General Purpose to Special Purpose

I've been working on DMS, my driving management system. It's a "basic app" with a primary goal, tell me how far each of the cities are along the route when I'm taking a road trip. 


I started with using Google Distance Matrix API, however after a heavy usage month and having to pay, I thought, I have computers, maybe I can find a way to do that myself. Enter Open Street Maps. Cool, but well.....I am gonna need ram.

OpenStreetMap - Wikipedia
Historically, I used a raspberry pi for the whole operation. Actually scratch that, in the beginning I was using Python everywhere and single page apps, which meant I didn't need my own host, but I also had to go keep checking in on that app, and decided I'd go local.

Ok, back on topic, the title of this post is General Purpose to Special Purpose, and well this is to talk about my journey of using more general purpose compute than was necessary, and slowly but surely shrinking it to my special purpose needs.

If you look up the requirements to run the Open Street Maps Routing Machine (OSRM) , for the USA, it's something less than 64 GB but over 50 GB which, if I am being honest...is a bit bigger than my raspberry pi has in ram (Raspberry Pi 4 with 4 GB of ram). 

As a rule of thumb, the RAM needed to run OSRM is about 5x the file size of the map you are using. So for a map of the USA us-latest.osm.pbf that is 9.3 GB in size, you'll need about 50 GB of memory*

 My first iteration was to use my laptop to host both OSRM, and Nominatim, a lat/lon to city and vice versa lookup tool. This worked for my needs, but means I gotta lug that monster around and waste energy and all that stuff....so what to do, what to do.

Well first up. Was trying to figure out if I can use different databases. Like what if I sorted out that I'm only going to be in one state the entire time so I would only need to load one state worth of data. Sure, that'll save me some memory, but what if I'm crossing multiple States now? We're starting to get into territory where we're taking up a lot of space again. It's still significantly smaller than the entire United States but still problematic.

This is where things get really interesting to me. You see you can carve polygons out of this data. In fact, that's all that's being done when we get a subset of the entire world. It's just a polygon cut out of it.

Then, I got to thinking what if I took the route that I'm planning on going and cut that route out. That would be significantly smaller so I tried it. It didn't work. Just to be clear, I'm not saying it couldn't work. I'm just saying that it didn't. So what I did was add a 50 mile border around my entire route. This still saved me tons of memory and enabled me to work within the bounds of my Raspberry Pi's memory.

 

Region

Disk Space Size**

Estimated Ram

United States of America

10.2 GB

51 GB

US Midwest

2.0 GB

10 GB

US Northeast 

1.5 GB

7.5 GB

US Pacific

152 MB

760 GB

US South

3.5 GB

17.5 GB

US West

2.8 GB

14 GB

Colorado

304 MB

1.5 GB

Utah

134 MB

670 MB

My route crossing 5 states

648 MB

3.2 GB

My route crossing 5 states (using route polygon)

439 MB

2.1 GB


What is also interesting is if I pre-plan all my routes that I'm planning on using ahead of time I can trade hard drive memory for RAM memory. When I'm ready to take a particular trip I just swap out the database and I'm off and running. And let me tell you I can throw a big hard drive on a Raspberry Pi.

If you look in the table above you can see that for me to cross 5 states, I was able to do it in 439 MB of hdd space as opposed to the unoptimized version taking up 648 MB. This doesn’t seem like a lot but when you multiply that delta by 5 it’s a lot.


 

I should also note, While crossing 5 states and just loading those states up, would fit in the Pi’s memory, we also need to be able to run nominatim, which requires around 1GB of RAM. I did try to use the route polygon carved version for Nominatim but I was having lots of issues finding lat/lon < -- > city mappings which my tool really needs.

By shrinking the data we went from using a general purpose solution to a special purpose solution and it was able to work for our needs.

I hope you enjoyed hearing about my journey!

* https://blog.afi.io/blog/hosting-the-osrm-api-on-amazon-ec2-running-osrm-backend-as-a-web-service/ 

** Source: https://download.geofabrik.de/north-america/us.html

Monday, January 13, 2025

Home Served Apps

I have discovered, there are lots of sites/tools I like to use but I don't want to have, to download, etc.

I call these simple apps, I think you see these everywhere, want to shrink a pdf? Sure either install some tools locally, figure out syntax, or find a sketchy page and try that (in the meantime uploading your pdf to some website, no idea what they do with it).

In comes.... the AI assistant to the rescue. 

I spent the better part of my christmas break making simple apps that I need and don't need to go to a public site to, using chatgpt as my assistant.

For example. I needed to convert a png to svg.... sure there's online options, but I don't want to have to use them. I also don't want to have to recall the command options for each of these. So I made a converter.local site (in my home network) and now I can just go there, upload an image, and it'll return an SVG.

Here's the list of tools/sites I've made that make life just so much easier. And a link to something "simliar" (mine usually don't look as pretty but they just work)

  • youtube downloader site (https://yt1d.com/en16/)
  • png to svg (https://convertio.co/png-svg/)
  • shrink a pdf (https://smallpdf.com/compress-pdf, https://github.com/aklomp/shrinkpdf)
  • extract audio from video (https://biteable.com/tools/extract-audio-from-video/)
  • podcast host/feed (I don't even know here what is similar)
  • Perform K-Means on pixels
  • Extract all colors to their own image


Tuesday, April 16, 2024

Portable Car Media Server

***

This is a work in progress post, it has most of the content of what I did, but it's after the fact, and I haven't replicated it to ensure it works exactly as described, but you should have enough info to accomplish what I did!

***

 

(Note I have Amazon Affiliate links below FYI)

I decided to build a portable Jellyfin Server. I wanted my kids to be able to login and watch shows as needed while we were driving and thus started going down the path.

I bought a travel router from amazon. I came across this on HackerNews a while back, and liked the idea, which is where this all started.

We used it on our last road trip and it worked quite well.

Parts required (I used stuff I had around, so the links below are largely placeholders for you to try, with the exception of the travel router and power bank, I did buy those).

1 Usb-A to Usb-micro cable

1 Usb-A to Usb-c cable

1 Power Bank

1 Raspberry Pi (I selected 3b+ as it's what I had lying around)

1 SD Card (If you already have a pi up and running, you may not need this)

1 GL-MT3000 (Beryl AX) Pocket-Sized Wi-Fi 6 Wireless Travel Gigabit Router

1 Storage usb drive

1 Shutdown Key (Or just find a spare usb device you can bring along)

1 Storage Case (Totally optional)

Key Stages:

  1. Get Pi Setup and running (Assumed you have set this up)
  2. Get Jellyfin installed on Pi
  3. Setup USB Drive for media
  4. Get nginx installed on Pi
  5. Static IP on Travel Router
  6. Get Adblocker running on Travel Router with Redirect
  7. Get USB Shutdown Key Created


Installing Jellyfin

https://pimylifeup.com/raspberry-pi-jellyfin/

Ultimately I just searched install jellyfin on raspberry pi and it just worked.

Setup USB Drive for media

TODO: More details on how I setup with the USB drive.

Installing nginx

https://engineerworkshop.com/blog/setup-an-nginx-reverse-proxy-on-a-raspberry-pi-or-any-other-debian-os/

Ultimately we will follow the above however there are some details that are a bit fuzzy for me. It has you edit this

sudo nano example.com.conf

file, however my system wasn't setup like that,  so instead of that I used default (likely this command):

ln -s /etc/nginx/sites-available/default /etc/nginx/sites-enabled/default

From there we need to update:

sudo nano /etc/nginx/sites-available/default

to contain this:

server {
	listen 80;
	server_name jellyfin.car.com;
	location / {
	proxy_pass http://localhost:8096;
	}
}

This means that we will redirect a request coming in for jellyfin.car.com to the jellyfin server. You can replace jellyfin.car.com with whatever you want, but that's what I used.

I specifically used localhost, because when I was doing setup, I was on my main wifi, so when I swapped between wifi's as long as I had the request coming in via jellyfin.car.com (on my main or the travel wifi) it handled correctly.

Static IP

https://docs.gl-inet.com/router/en/3/setup/gl-e750/more_settings/#static-ip-address-binding

This should generally be what you need to do. Figure out your mac address, and then put in a static IP there. I think the default IP range is 192.168.8.x so I set my pi to something like 192.168.8.31.

Get Adblocker running on Travel Router with Redirect

https://medium.com/@life-is-short-so-enjoy-it/homelab-adding-local-dns-entry-into-adguard-home-arpa-and-pushing-to-clients-from-udm-se-8493253830e5

Next we are going to turn on the adguard (A sweet feature of the travel router), and point the redirect to our pi!

Specifically we are going to do the section called add local DNS entries into Adguard.

I put in 

192.168.8.31 jellyfin.car.com

(instead of their arpa example)

Now when I visit jellyfin.car.com on the wifi that router is on, the adguard will look that URL up, and then return the pi's ip address, which in turn, means that it will connect over NGINX on port 8096

 

Get USB Shutdown Key Created

http://blog.onaclovtech.com/2024/03/usb-shutdown-key.html

Finally, we will setup a USB shutdown key, this makes it so when we are ready to shutdown for the day we can kill our pi, and unplug power after maybe 30 seconds.

You can use any old usb device I have an old 32 mb usb key (my first perhaps?) that I am using, I labelled it Shutdown Key.


Results

 

Once you have this setup, you can kick it off, the system should last on the battery bank more or less 5-7 hours (maybe more, maybe less, depending on use).

Alternatively you can buy two banks, and then just run the router on one, and the pi on another. 

Finally you "could" possibly just run your router off the USB power in the car, so you don't need the power bank at all, however I didn't test that out, I think the router can handle power interruptions, the pi generally can get finnicky on that, so I wanted a way to be in control of that which is why it's on a power bank, so if I shut the car off I don't accidentally forget to gracefully power the pi off, and kill it in the middle of my trip.


***

This is a work in progress post, it has most of the content of what I did, but it's after the fact, and I haven't replicated it to ensure it works exactly as described, but you should have enough info to accomplish what I did!

***


Friday, March 22, 2024

USB Shutdown Key

While building up a raspberry pi system recently I needed an easy way to shutdown the device without having to ssh into it.

I had an idea pop into my head, what if I plug in a usb drive and maybe it automatically runs a script on the usb key, or something and powers the device down.

Well after a bit of googling it turns out.... you can use udev rules to do what I want, and no need to put anything on my drive.

This is the process.

First, you figure out the vendor ID and the product ID of the usb key. 

The way I did this was by running lsusb and noting the devices, since this is a raspberry pi, the list was short.

I then plugged the usb drive in, and ran lsusb again. I noted which device it was.

Then I ran lsusb -v to get the values for idVendor and idProduct. 

I then copied them into this line (remember not to include the 0x), in the applicable spots. 

ACTION=="add" , ATTRS{idProduct}=="2168" , ATTRS{idVendor}=="0ea0" , RUN+="/usr/local/bin/my_shutdown_script.sh"

I then placed that line into this file:

sudo nano /etc/udev/rules.d/99-usb-shutdown.rules

Next, I edited /usr/local/bin/my_shutdown_script.sh to contain the following:

#!/bin/sh sudo shutdown -h now 

Finally I ran 

sudo chmod +x /usr/local/bin/my_shutdown_script.sh

on the file and rebooted, just to make sure everything was stable.

Now when I plug in the usb drive, bam, it just shuts down.

Thanks to this post for the details they used, which was exactly what I did with the minor note that I used lsusb -v (they just mentioned using lsusb ;))! 

https://www.reddit.com/r/linuxquestions/comments/yiw13c/trying_to_create_a_udev_event_to_safely_shutdown/

Saturday, December 30, 2023

2023 Donations

In case anyone is interested or needs ideas this is the list of Non-Profits I donated to this year.

I'm making it a goal of increasing my donations by 3% each year. (This is the first year I was intentional about that decision)

Signal -- https://signal.org/donate/

Pihole -- https://pi-hole.net/donate/#donate

Ronald Mcdonald House -- https://rmhc.org/

Farama Foundation -- https://farama.org/donations

MIT -- https://giving.mit.edu/form/#/ (I searched for opencourseware)

 

Archive.org -- https://archive.org/donate

 

EFF -- https://supporters.eff.org/donate/year-end-challenge--DB

 

Explora -- https://www.explora.us/become-a-member/donate/ 

 

To Write Love on her arms -- https://twloha.com/donate/

 

 

This is my current list, I need to donate more, but will have to do some looking to see what else I'd like to help out with!

Wednesday, December 16, 2020

Raspberry Pi and Circuit Playground Express Temperature Logging using Python

So I tried searching for the above title and well, it gave me this as the top result:

https://learn.adafruit.com/circuit-playground-express-serial-communications/overview

This one wants us to us a USB to serial device and hook up to the physical serial pins, but we are connected via USB, so I was a bit frustrated.

The rest of the search results weren't much better. 

So lets start with, connect your circuit playground express to your raspberry pi. Make sure you can see the folder to plop files into. You might have to hit reset to put it back in the mode.

I did come across this finally: 

https://learn.adafruit.com/circuitpython-made-easy-on-circuit-playground-express/circuit-playground-express-library

So we will start there, you can follow along from the start, but the instructions keep pushing to use the mu editor, which I didn't attempt to do as I wasn't sure how it would actually log data for me. Following the instructions ignoring that amounts to updating our board with the circuitpython, once that was on the board we had the following page:

https://learn.adafruit.com/circuitpython-made-easy-on-circuit-playground-express/temperature

I then pushed code.py which contained the following:

"""This example uses the temperature sensor on the Circuit Playground, located next to the image of
a thermometer on the board. It prints the temperature in both C and F to the serial console. Try
putting your finger over the sensor to see the numbers change!"""
import time
from adafruit_circuitplayground import cp

while True:
    print("Temperature C:", cp.temperature)
    print("Temperature F:", cp.temperature * 1.8 + 32)
    time.sleep(1) 
source: https://github.com/adafruit/Adafruit_CircuitPython_CircuitPlayground/blob/main/examples/circuitplayground_temperature.py

OK now our board should be outputting temperature data, great. How do we view it?

Now there is a process to view the content on the board not found in the series of steps, instead I came across that here: 

 https://learn.adafruit.com/welcome-to-circuitpython?view=all#whats-the-port-2977243-1

Which we use to find the port our device is communicating over:

 ls /dev/ttyACM*

Then from there we can test out we can see the data. This tells us to use screen (so you might need to apt-get install screen).

 https://learn.adafruit.com/welcome-to-circuitpython?view=all#connect-with-screen-2977916-10

screen /dev/ttyACM0 115200

when I ran the ls command above mine returned /dev/ttyACM0 so yours will *likely* do this unless you have other stuff connected, additionally 115200 is the speed with which to communicate.

This at least got me to the point of making sure I can see the temp. If you get connected via screen you should have to hit Ctrl+d and it'll start showing temps. If it's not it might tell you to hit reset then it'll start running, so do that. If that didn't work, you might need to check the instructions up to this point and make sure you followed them. When you are done with Screen Ctrl+A should get you out.

Ok so we have data through screen but that doesn't help us if we want to save the data. This is where python comes in.

I tried connecting using python earlier but had no luck, it would just print a newline over and over, which wasn't much help, but here is the thing after seeing that we needed ctrl+d to get the temp data, something clicked. We need to send a ctrl+d.

here is how I got it working.

#!/usr/bin/env python
import time
import serial
import sys
import datetime

ser = serial.Serial(
    port='/dev/ttyACM0', # remember earlier we discovered mine is ttyACM0
    baudrate=115200
)
ser.write(b'\x04') # This mimics the Ctrl + D
time.sleep(5) # Wait a few moments for the Ctrl+D to take effect, it'll print a few messages and start telling us temps.
tmp = ser.readline().strip('\n') # One of the messages that gets printed we don't care about so we throw it away.

print (sys.argv[1]) # Check we have a filename
while True:
    tmp = ser.readline().strip('\n') # Read the serial data and toss the newline.
    f = open(sys.argv[1], 'a') # Open our output file
    f.write(str(datetime.datetime.now()) + "," + tmp.split()[2] + "\n") # Print the current date/time and the temp (in F) to the file.
    f.close() # Close the file each time so it writes.
    time.sleep(10) # I collect the data every 10 seconds, you could wait a minute or 10 minutes if you like


One constraint I'm uncertain of is if we wait 10 minutes to read the serial, does it read it at the time, or does it read the "last unread" line? I'm not worrying too much right now but will look into it eventually.

One final note, in the above, I only print out the F temp so my python only accounts for that, so you adjust your temp printing so it matches what you want.  


Thanks for following along I hope this helped!



Thursday, November 26, 2020

Charity Event

Greetings,

I'm going to be playing Super Metroid for a charity event coming up on December 5th, 2020. I will be playing starting around 8:15am EST. I expect the gameplay to take about an hour and forty-five minutes at most.

If you'd like to watch you can see more details at www.dogpoundexpo.com this will include a schedule of events, and list of runners.

You can find out more details about the charity here: https://www.dogpoundexpo.com/charity



You can view the official twitch channel for the event here: https://www.twitch.tv/meddadog

I will be donating up to $250 matched to any donations during my run. So if you want to see me parted with $250 join and donate!

If you want to follow me I'm on https://www.youtube.com/channel/UCfkc2ygXwub-1pUj_Nq6hPg/ and twitch.tv/TysonRuns.

Thanks, 

Tyson

Friday, December 21, 2018

Deep Learning For Security Cameras Part 1

This is part 1 of a series of posts on my experience trying to build a object detection setup for my home security cameras. Here I'm going over some preliminary results and talking about the history to this point. I plan to graph my results and look at what I have in future posts.

Deep Learning is all the rage these days. I get it, the idea of letting a computer extract out features and find things is amazing. I love it. In fact while, working on my Masters at Georgia Tech I took any Machine Learning class I could get my hands on and the Reinforcement Learning course that was also offered. They were AWESOME and they really opened my eyes to how a lot of this stuff worked.

A few months back I started with using darknet and the tiny YOLO approach. I setup an RTSP server on my raspberry pi in python to pull images and wanted to see how it did, I experimented on a few images, but to my surprise, (although in retrospect, unsurprisingly) it failed.... pretty bad. The first attempt it actually saw the car on the side of my yard, which was utterly amazing. I ran it again mere minutes later and it never saw the car again... after multiple attempts. Of course this was all running quite slow, if I recall on the order of 60 seconds per image. I decided that as long as there was some kind of "motion" that zoneminder detected then I could have it process on that. I was slightly less concerned about realtime than I was about just simply notifying me at some point in the future if something odd was going on.

I decided that over the holiday break I would try to work on this detector more. I started downloading all my camera data (which is really not all that old), and it turned out I had about 65GB of image data from motion captures using zoneminder. First off, sharing that is difficult if I wanted to with anyone to work on this, so I am working on pairing it down, it is at least broken down by camera, so I should be able to divy it up that way.

I decided to try out using the image recognition to even detect anything out of these images as a first pass. I got everything setup and used https://www.tensorflow.org/tutorials/images/image_recognition
I modified it to run through an entire folder, it then spits out 3 different files. First is a mapping of image -> human string, score and index. The index is used for looking up the human string in the mapping. The second file is a listing of the index with all images which had that index (didn't matter the score as long as it was in the top 5). Finally, I output the index to human string mapping, so I could easily look things up. The files are named image_filtering_analysis, image_filter_mapping, and image_filtering_by_class. I opened up the image_filtering_by_class and looked up the first thing I saw, which was 160. This translated to "wire-haired fox terrier". This was a view of my driveway and I thought....well I mean I suppose that might be possible.

wire-haired fox terrier

Ok so first one is not very awesome. Though to be really fair, I looked up the confidence score and that one got 0.016631886. Interestingly these were the top 5 scores.

  • submarine, pigboat, sub, U-boat, 0.27390754
  • patio, terrace,  0.064846955
  • steam locomotive, 0.040173832
  • fountain, 0.023076175
  • wire-haired fox terrier, 0.016631886
I looked up what some of the labels were in the dataset they used. I didn't see any just plain "car" labels. This is just odd to me. I will likely have to re-train on my data, but for now I need to figure out a way to find common features.

So of course improvements could be to require the scoring to at least reach some threshold, so suppose we set it to 50%, this would prevent seeing that particular failure. Searching through my data (which by the way hasn't finished running). It found another version of the same image above but called it a patio, terrace with over a 90% confidence. In fact the image with the highest confidence was also labeled a patio, terrace. Here it is.
patio,terrace
I can only speculate that the poor pixelated images on the left is well me, looking at it closely it sort of looks like a body. It's in the images for a few frames and it appears there are arms. I am pretty sure I was bringing a package in that day.

I wonder if someone could (maybe me ;)) build a form of a feature detector much like is used in CV, but instead of being trained to a specific task, it's generic. This might enable a way to group common features across images and make creating a supervised dataset easier.

I'll post more interesting ones as I come across them. I think at this point most of my image recognition's are at night and will eventually hit daytime which I think will show some even more humorous results.

For now, it's suffice to say. This detection is not doing well. I wanted to at least run this with the hopes that it would find cars or other things for building up a supervised set, however I don't think that's going to happen.

Here are some plots of what labels had been applied to the images (of course none of these have any references to confidence, but it's interesting).








Tuesday, November 15, 2016

Busy, Busy, Busy

I've been a busy boy while going back for my masters, I'm currently taking 2 classes, and have been posting quite a few videos called 60 Seconds to Success in OMSCS. Anyhow if you're in the program and you want some helpful tips go check it out.

https://www.youtube.com/channel/UCR-mQpFEIiBWd164H4-yhgw

I'll try to come back once in a while and post some fun stuff.

Lately I've been doing Hough Transforms, Disparity Maps, solving linear algebra problems for stereo imaging and calculating Optical Flow on sets of images. It's been pretty wild, and I'm getting ready for the end (2 more assignments left), but I can't wait to get setup using lightshowpi for my christmas lights.

Saturday, March 12, 2016

Pickling for easier testing

Today I want to talk about Pickling. This approach allows you to save off a variable/data for re-use later.

Why would you want to do this? Well suppose you're like me and you're working on an AI agent, and you have a LOT of problems you need to run through, and all these problems take a little bit of time, and say 50 of them are already solved by your agent, but that 51st isn't, instead of running all 50 over and over (unless your agent is learning things, in which case, you're good). You can pickle the passed in variable, and then make a simple "test" function that will call only the one you want to call so that it's way easier to test out individual parts.

For more general information about pickling take a look here: https://wiki.python.org/moin/UsingPickle

Lets get started.

Import Pickle in your file with the following line added to the top of your Agent.py file:
import pickle

(I"m going to be using some verbiage from my AI course, however the basic idea is this, the agent we have starts with normal class name, __init__ and must implement a Solve function).

Make the start of your Solve function look like this:

   def Solve(self,problem):
      pickle.dump( problem, open( './pickles/' + problem.name + ".p", "wb" ) )

Finally Make a new directory called pickles so pickle can save it.

Finally run your agent like you normally would.

If you notice there should be a bunch of .p files in your pickles directory.

Next lets setup a "test" agent that allows you to run a SINGLE test (I know folks on our forums have asked about this, and well... here it is!

Create a new file called test.py

Inside it you would add the following

import pickle
from Agent import Agent

A = Agent()
problem  = pickle.load( open( "./pickles/Basic Problem E-09.p", "rb" ) )
A.Solve(problem)

Replacing the .p filename with whatever you choose.

You can make this more "generic" if you'd like by accepting command line input and then you run it like this .

test.py Basic Problem E-09 and it would run the one you command it to. Pretty Slick right?

That would look like this:

import pickle
from Agent import Agent
from sys import argv

A = Agent()
script, name = argv
problem  = pickle.load( open( "./pickles/" +  name + ".p", "rb" ) )
A.Solve(problem)

and be ran by this command.

python test.py "Basic Problem E-09"


The final test.py can be found here:
https://gist.github.com/onaclov2000/d1d7fc01b22b98e0098e