šŸ’¾ Archived View for benjaminja.info ā€ŗ log ā€ŗ atom.xml captured on 2024-05-10 at 10:51:28.

View Raw

More Information

ā¬…ļø Previous capture (2024-03-21)

āž”ļø Next capture (2024-07-08)

šŸš§ View Differences

-=-=-=-=-=-=-

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-us">
  <title>Benjamin Jacobs | Log</title>
    <link rel="self" type="application/atom+xml" hreflang="" href="gemini://benjaminja.com/log/feed.xml" />
    <link rel="alternate" type="text/gemini" hreflang="" href="gemini://benjaminja.com/log/" /><id>/</id>
  <updated>2028-01-20T21:38:33Z</updated>
  <generator>Hugo 0.125.4</generator>
  <entry>
    <title><![CDATA[If You Give a Hobbyist a Harddrive]]></title>
      <link rel="alternate" type="text/gemini" hreflang="" href="gemini://benjaminja.com/log/2024/01/16-upgrading_server/" />
    <id>gemini://benjaminja.com/log/2024/01/16-upgrading_server/</id>
    <updated>2024-01-16T07:31:00Z</updated>
    <summary type="gemini"><![CDATA[I recently bought a 2TB hard drive for my home server. I use this server to host NextCloud and you can never have enough storage space. This server is an Inspiron 560s from 2008. It only has two hard drive bays and already has two hard drives.
]]></summary><content type="gemini"><![CDATA[I recently bought a 2TB hard drive for my home server. I use this server to host NextCloud and you can never have enough storage space.

This server is an Inspiron 560s from 2008. It only has two hard drive bays and already has two hard drives. There is however a dvd bay and a SD-card bay. The new hard drive fits just perfectly in the SD-card bay, so thatā€™s its new home.

=> drive_door.jpg šŸ–¼ Hard Drive Door

### The hobbyist will need to try out a new file system

A few months back, I watched a video about ZFS and was convinced to give it a try. The only problem is that it is pretty daunting to even think about trying out.

> There must be so much extra stuff that needs to be learned just to access the file system. Since ZFS is designed to work with other drives, will every drive be required to use ZFS?

These fears are not founded though. It is true that there is some extra software that is required in order to manage ZFS, but it is honestly so much easier than having to deal with parted, or fstab. All I needed to do to format and setup the new disk under ZFS was

zpool create MyPool sda


For me, the strongest selling point of ZFS is that it makes storage work closer to RAM. When running a program, I donā€™t need to specify which ram stick I want to have my software run in. It just figures it out for me. ZFS has this idea of pools where each pool is made up of one or more hard drives. When I put a file in the file pool, I donā€™t know which hard drive the data is going into, just that it is being taken care of for me.

I migrated a second 1TB drive in the server to ZFS and added it to my main pool. So instead of having 3 drives to manage, I have the boot drive, and a 3TB storage space.

### While theyā€™re at it, the hobbyist might as well upgrade the OS

I havenā€™t updated the OS since I originally setup the machine in 2018. Iā€™m running Ubuntu 18.04 and it has recently gone out of long term support. There are still 4 years left of security maintenance, but I figure since Iā€™m working on the machine now, I might as well upgrade to a newer OS. I would like to try out Debian 12.

I backed up the main drive to my newly created pool and got ready to upgrade the OS. Thereā€™s nothing like some spring cleaning where you can get rid of the residue from all your weird decisions you made in the past 6 years and start fresh.

Creating the installation medium was my first hurdle. For whatever reason, I always have trouble creating an USB installer. I primarily use Mac as my daily driver and Iā€™ve pretty much always relied on the Raspberry Pi Imager for Mac. With newer updates to the software, it feels like it is a lot harder to burn a USB stick with anything that isnā€™t Raspbian. So I switched over to my windows machine and I went through several programs trying to find one that will actually burn an ISO and make the drive bootable. I settled for Rufus.

I donā€™t know why, but no matter what I have tried I just canā€™t get the BIOS to recognize my USB. The machine is old enough that it doesnā€™t know what UEFI is, but the one time I was able to get the machine to recognize the drive was when it was formatted with GPT which should be UEFI only. I have spent hours making tweaks and re-imaging that poor USB stick to no avail.

### The hobbyist is ready to sleep now

At this point, it might be better to just give up for now. Itā€™s not necessary that I upgrade the OS (In fact I foresee that it would cause more heartache trying to get everything up and running again from a fresh start). There are still several years left of support for the current OS and I got everything done that I was originally intending to do.

Iā€™m really happy with how ZFS has turned out and I should just see how it goes moving forward. The next thing to figure out is how to get docker volumes to live in my pool. But thatā€™s a problem for another day.
]]></content>
    <category term="projects" label="Projects" scheme="gemini://benjaminja.com/tags/projects/" />
    <published>2024-01-16T07:31:00Z</published></entry>
  <entry>
    <title><![CDATA[Rewriting my Site Generator]]></title>
      <link rel="alternate" type="text/gemini" hreflang="" href="gemini://benjaminja.com/log/2024/01/13-rewriting_site_gen/" />
    <id>gemini://benjaminja.com/log/2024/01/13-rewriting_site_gen/</id>
    <updated>2024-01-13T21:30:00Z</updated>
    <summary type="gemini"><![CDATA[Itā€™s a new year and a new me. Now that I have finally graduated, I feel that I have more time to work on my side projects. One of the first big things I have done is rewriting my site generator once again.
]]></summary><content type="gemini"><![CDATA[Itā€™s a new year and a new me. Now that I have finally graduated, I feel that I have more time to work on my side projects. One of the first big things I have done is rewriting my site generator once again.

=> gemini://benjaminja.info/log/2023/09/03-simple_site_gen/ Simple Site Generator

Rather than creating my own templating engine, I decided to use [tera].
=> https://keats.github.io/tera/docs/ tera

Keeping similar vibes to my original site generator: any additional features is implemented through shell scripts. There are a few important features baked in with the generator and all of the very site specific features are python scripts I created.

It is inspired by [kiln]
=> https://kiln.adnano.co kiln

> ~~but from all of my research it seems that the site has gone down as well as the repo that was holding it.~~

> Update 2024-01-16:

> It turns out that source hut was hit by a DDoS attack and kiln was part of the cross-fire. Everything seems to be back up now.

## Configuration

Here is a copy of my configuration file for https.

Specify file structure content = "content"scripts = "scripts"templates = "templates"output = "www/html"static = "static"# file types that will be rendered in content directorytemplate_types = ["md", "gmi", "html", "xml"]

Where the output will live on the web root = "/"# The base url name for the websiteurl = "https://benjaminja.info"# Any scripts to run before renderingpre = [

"proc/pretty-url.py",

"proc/tags.py", # tags script creates the tag system for my log"proc/pretty-url.py",

]

Any scripts to run after renderingpost = [

"proc/proc_html.py",

]

After rendering a file, convert it using the provided convert for each file # type[converters]

md = { ext = "html", cmd = ["gmi-conv", "-i", "md", "-o", "html"] }

gmi = { ext = "html", cmd = ["gmi-conv", "-i", "gmi", "-o", "html"] }


As an example of what a file might go through, I will show you how this file gets rendered.

Letā€™s say that I have the text

{% raw -%}

The site was rendered at {{ now | ftime(fmt="%B %e, %Y @ %r %:z") }}

{%- endraw %}


Here is the output:

> The site was rendered at {{ now | ftime(fmt="%B %e, %Y @ %r %:z") }}

First, the `pretty-url.py` script will be run which renames this file from `content/log/2024/01/13-rewriting_site_gen.md` to `content/log/2024/01/13-rewriting_site_gen/index.md`. After that the `tags.py` script will be run which adds this file to the `capsule` and `projects` tags. The `pretty-url.py` script gets run again for any generated files, then the rendering starts.

Since this is an `md` file, it will get rendered. After being rendered it will be converted to html using `gmi-conv -i md -o html`. (There is another configuration rendering to gemini). After it is converted, the file will be passed through several templates. To be specific:

1. `templates/logs/2024/_root.html` which adds the title, date, and mentions.
2. `templates/_root.html` which adds the base html boilerplate.

Weā€™re not done yet, finally the `proc_html.py` script gets run. This will use beautiful soup to find any code blocks and adds formatting to it as well as differentiates gemini links as gemini links.

ā€•ā€•ā€•ā€•ā€•ā€•ā€•ā€•ā€•ā€•ā€•ā€•ā€•ā€•ā€•ā€•ā€•ā€•ā€•ā€•ā€•ā€•ā€•ā€•ā€•ā€•ā€•ā€•ā€•ā€•ā€•ā€•ā€•ā€•ā€•ā€•ā€•ā€•ā€•ā€•


I have two configurations running. One for html and one for gemini. I only need to write my capsule once and it will be rendered to both endpoints which is pretty nice.

## Making this Publicly Available

There are still a few oddities about the software that Iā€™m not very happy with. I also want to add a bunch of documentation so that you can actually know how to use it. So I wonā€™t be releasing my site generator until it is in better shape.

This software is probably a bit into the ā€œYou need to be a computer wiz to use this softwareā€ territory, but If I were to add some sane 3rd party scripts and some good tutorials, I think it might could be usable by an average person.
]]></content>
    <category term="capsule" label="Capsule" scheme="gemini://benjaminja.com/tags/capsule/" />
    <category term="projects" label="Projects" scheme="gemini://benjaminja.com/tags/projects/" />
    <published>2024-01-13T21:30:00Z</published></entry>
  <entry>
    <title><![CDATA[Simple Site Generator]]></title>
      <link rel="alternate" type="text/gemini" hreflang="" href="gemini://benjaminja.com/log/2023/09/03-simple_site_gen/" />
    <id>gemini://benjaminja.com/log/2023/09/03-simple_site_gen/</id>
    <updated>2023-09-03T08:06:00Z</updated>
    <summary type="gemini"><![CDATA[Itā€™s been a while since I last posted. I have been busy working on my weatherstation. Iā€™ll need to write about that soon, but for now I want to talk about the state of my capsule.
]]></summary><content type="gemini"><![CDATA[Itā€™s been a while since I last posted. I have been busy working on my weatherstation. Iā€™ll need to write about that soon, but for now I want to talk about the state of my capsule.

During my breaks from the weatherstation, I have been working on my own site generator. I have finally got it to the point where I can start using it in production. Thereā€™s definitely a lot of work left to be done before I can publish it for others to use.

I have been calling it `simple-site` for now, though Iā€™ll probably think of a better name when I actually release it. I have designed the generator to be as simple possible while allowing for complexity to come if desired.

The design starts out with templating. I designed my own simple templating engine that I found works surprisingly well. Each document will be rendered and passed to a chain of configured templates. To get added functionality, scripts can be created which will behave like functions in the templating engine. If you need more control, then generator scripts can be used to make alterations to the structure of the site.

Since I have migrated my capsule over to the new system, I have most likely missed a few things.

### Example

Here is a pretty simple example of what my generator does. Hopefully it can help visualize whatā€™s going on.

+- content

| +- index.gmi

| +- my-image.jpg

+- templates

| +- base.gmi

+- site.toml


$ simple-site site.toml

Rendering "index.gmi" with template "base.gmi"Copying "my-image.jpg"

]]></content>
    <category term="projects" label="Projects" scheme="gemini://benjaminja.com/tags/projects/" />
    <category term="capsule" label="Capsule" scheme="gemini://benjaminja.com/tags/capsule/" />
    <category term="gemini" label="Gemini" scheme="gemini://benjaminja.com/tags/gemini/" />
    <published>2023-09-03T08:06:00Z</published></entry>
  <entry>
    <title><![CDATA[Installing Ethernet]]></title>
      <link rel="alternate" type="text/gemini" hreflang="" href="gemini://benjaminja.com/log/2023/06/26-upgrading_internet/" />
    <id>gemini://benjaminja.com/log/2023/06/26-upgrading_internet/</id>
    <updated>2023-06-26T18:52:00Z</updated>
    <summary type="gemini"><![CDATA[My house used to be connected to Comcast before we switched over to a local fiber ISP. This switch has happened years ago and the house was outfitted with coax back in the Comcast days. Of course now, there is no use for Coax.
]]></summary><content type="gemini"><![CDATA[My house used to be connected to Comcast before we switched over to a local fiber ISP. This switch has happened years ago and the house was outfitted with coax back in the Comcast days. Of course now, there is no use for Coax. The local antenna stations are not great and we donā€™t have cable coming in either. So I figured that I would replace our existing coax with ethernet.

We have three coax ports. One in the basement that goes outside along the wall. And two in the house that share the same wall across two floors. The basement port was very easy to replace as I just had to poke the ethernet out the wall and re-enter into the boiler roomā€”where the networking is located.

Iā€™m still planning out how to replace the two remaining ports. My original plan was to attach the existing coax cable to the ethernet cable and pull it through the wall up into the attic without having to cut any access holes. This would work great in theory, but I have found that there is only one coax cable coming into the attic. This means that somewhere in the wall is a coax splitter.

=> example.png šŸ–¼ It might be easier to see an example of what I mean.

Iā€™m not entirely certain that this is how the cable was installed, but it seems that way. There are two possible solutions that I can think of to make this work: Make the existing access point hole bigger in the attic so that I can pull the splitter through and not have to cut the walls. I could remove the box on the second floor and remove the splitter from that access point and replace the box in the future.

If I were to cut in the attic, it is possible that I will reduce structural integrity. If I were to remove the outlet box, I may have to make repairs to the wall. The box may not be attached to any studs, free floating on the drywall with mounting ears. This might make it easier for me to remove the box without damaging the wall.

When I get the chance, Iā€™ll try to remove that box and see if Iā€™m right about the splitter.

## Update - Retrofitting telephone wire

2023-06-28

alextheuxguy responded and said that he was lucky that the phone jacks were wired with Cat5e. Thatā€™s pretty cool! And now that I think of it, when I was last in the attic I saw some mysterious 8-wire unsheathed cable up there that looked suspiciously like ethernet. I know there is a telephone jack in the dining room, so maybe I would also be able to retrofit the telephone jack with ethernet.

Iā€™ll have some more investigating to do.

Thanks for the tip Alex!
]]></content>
    <category term="home-improvement" label="Home-Improvement" scheme="gemini://benjaminja.com/tags/home-improvement/" />
    <published>2023-06-26T18:52:00Z</published></entry>
  <entry>
    <title><![CDATA[Communicating with my weatherstation]]></title>
      <link rel="alternate" type="text/gemini" hreflang="" href="gemini://benjaminja.com/log/2023/06/24-comms_with_weatherstation/" />
    <id>gemini://benjaminja.com/log/2023/06/24-comms_with_weatherstation/</id>
    <updated>2023-06-24T18:42:00Z</updated>
    <summary type="gemini"><![CDATA[In my original plan for my weatherstation, I would wirelessly send weatherdata to a ground station. I have given up on this idea primarily because managing a rechargeable battery would introduce too many variables. Now, I have decided to have a cable that connects between the ground station and the sensors.
]]></summary><content type="gemini"><![CDATA[In my original plan for my weatherstation, I would wirelessly send weatherdata to a ground station. I have given up on this idea primarily because managing a rechargeable battery would introduce too many variables.

Now, I have decided to have a cable that connects between the ground station and the sensors. I will be using an ethernet cable as the medium, but I wonā€™t be using the ethernet protocol. Having a network card on the station is more overhead than I would like.

The original plan was to connect the serial lines directly. This is not a great idea, since plain datalines cannot go a long distance without losing integrity. Instead, making the lines differential twisted pairsā€”which ethernet is already made ofā€”would allow for longer reliable distance. I just donā€™t know how I would convert a line into a twisted differential pair.

I discovered that CAN bus could be the better option for me. It stands for Controller Area Network, and is designed to be a light weight alternative to Ethernet. CAN is generally used in cars and in industrial settings.

Now I just need to come up with a protocol to manage the weatherstation. Iā€™ve discovered a protocol called CANopen which seems very interesting. Iā€™m currently stuck trying to decide whether I want to fully implement CANopen, or if I want to develop my own protocol that is inspired from CANopen. There is a lot of stuff that goes on with CANopen that I donā€™t necessarily need (particularly since I donā€™t plan to integrate the weatherstation with other CANopen devices).

There is a library for CANopen called CANopenNode, however I would have to make my own compatibility layer with it since no has done that for the Teensy4.0. It might just be better for me to design my own partial CANopen library.

Maybe Iā€™ve gone too far into CAN, and would have been better off just using an Ethernet card. Iā€™ve had fun working with CAN and CANopen, so I donā€™t think I have wasted my own time here, but sometimes I wonder if it would have been better to use a different board that has ethernet built-in.
]]></content>
    <category term="side-project" label="Side-Project" scheme="gemini://benjaminja.com/tags/side-project/" />
    <category term="weather-station" label="Weather-Station" scheme="gemini://benjaminja.com/tags/weather-station/" />
    <published>2023-06-24T18:42:00Z</published></entry>
  <entry>
    <title><![CDATA[My weather vane is now better than new]]></title>
      <link rel="alternate" type="text/gemini" hreflang="" href="gemini://benjaminja.com/log/2023/04/30-repaired_weather_vane/" />
    <id>gemini://benjaminja.com/log/2023/04/30-repaired_weather_vane/</id>
    <updated>2023-04-30T17:12:00Z</updated>
    <summary type="gemini"><![CDATA[Yesterday, I wrote about how I broke and repaird my weather-vane After it got repaired, I was able to get the sensor working in software. Everything worked, but there was one thing odd about the sensor.
]]></summary><content type="gemini"><![CDATA[=> /log/2023/04/29-broke_weather_vane/ Yesterday, I wrote about how I broke and repaird my weather-vane

After it got repaired, I was able to get the sensor working in software. Everything worked, but there was one thing odd about the sensor.

To give some background, the sensor can tell the direction of the wind by triggering one of 8 magnetic reed switches each connected to a resistor. If I measure the resistance of the sensor, I can tell which direction the wind is blowing.

The east resistor measured infinite ohms. In hindsight this is obviously a problem, but I thought that everything was normal until after I did my repair. Why would there be a reed switch that connects to an infinite resistor? This is the same as having a switch connected to nothing.

I took apart the sensor once again to look for any damage. I was only hoping that I wouldnā€™t have a busted reed switch. After some continuity testing, I found this on the east sensor:

=> broken_reed.jpg šŸ–¼ A reed switch that has been pulled off the circuit board

This must be something that has been broken for over 6 years now. I was able to make the repair, luckily it was pretty simple. Just a jumper from the resistor to the reed switch.

=> repaired_reed.jpg šŸ–¼ The repaired sensor

I canā€™t describe just how happy I am about this.

If the wind points between two of the sensors, then it will no longer think the wind has spontaneously pointed east.
]]></content>
    <category term="projects" label="Projects" scheme="gemini://benjaminja.com/tags/projects/" />
    <category term="weather-station" label="Weather-Station" scheme="gemini://benjaminja.com/tags/weather-station/" />
    <published>2023-04-30T17:12:00Z</published></entry>
  <entry>
    <title><![CDATA[Whoops, I broke my weather vane]]></title>
      <link rel="alternate" type="text/gemini" hreflang="" href="gemini://benjaminja.com/log/2023/04/29-broke_weather_vane/" />
    <id>gemini://benjaminja.com/log/2023/04/29-broke_weather_vane/</id>
    <updated>2023-04-29T17:47:00Z</updated>
    <summary type="gemini"><![CDATA[I am working on my weatherstation project now, and Iā€™m going to finish it for real! Yesterday I was opening up the weather-vane to reverse-engineer the board it has and make sure what I already know is correct.
]]></summary><content type="gemini"><![CDATA[I am working on my weatherstation project now, and Iā€™m going to finish it for real! Yesterday I was opening up the weather-vane to reverse-engineer the board it has and make sure what I already know is correct.

I was able to get my picture and put it all back together; there was only one problem. The sensor no longer worked! It turns out that when I took the board out of the housing, I also pulled the cable a bit too hard and broke the connection to the board, whoops.

Fixing the board should be pretty easy, I just have to remove whatā€™s left of the wires, and solder the wires back in. To make sure that the wires donā€™t fall apart again, I decided to use solid core wires and connect the cable to that.

Everything went pretty well until I accidentally ripped one of the pads off the circuit board, whoops. I am just lucky that the pad I pulled off had a simple connection that I could easily bypass.

I was able to fix the sensor just fine. It looks a little silly, but thatā€™s ok. The one thing that Iā€™m more annoyed at than anything else is that I didnā€™t need to take apart the sensor. I had already done that around 6 years ago, and uploaded it to my wordpress blog.

=> /log/2017/04/04-weatherstation/ My blog where I analyzed the weather-vane.

=> sensor-back.jpg šŸ–¼ Back of the repaird weather-vane
=> sensor-front.jpg šŸ–¼ Front of the repaird weather-vane
]]></content>
    <category term="projects" label="Projects" scheme="gemini://benjaminja.com/tags/projects/" />
    <category term="weather-station" label="Weather-Station" scheme="gemini://benjaminja.com/tags/weather-station/" />
    <published>2023-04-29T17:47:00Z</published></entry>
  <entry>
    <title><![CDATA[Planning PWS Hardware]]></title>
      <link rel="alternate" type="text/gemini" hreflang="" href="gemini://benjaminja.com/log/2023/04/16-planning_pws_hardware/" />
    <id>gemini://benjaminja.com/log/2023/04/16-planning_pws_hardware/</id>
    <updated>2023-04-16T17:26:00Z</updated>
    <summary type="gemini"><![CDATA[It has been a dream of mine to create my own personal weather station (PWS). Iā€™ve been working on this project for over 6 years now. Due to school and scope creep: I have not been able to complete this project.
]]></summary><content type="gemini"><![CDATA[It has been a dream of mine to create my own personal weather station (PWS). Iā€™ve been working on this project for over 6 years now. Due to school and scope creep: I have not been able to complete this project. This time will be different. I have a plan. This plan has been split up into two parts: hardware and software. In previous iterations, I have developed hardware and software at the same time without a clear plan, which I believe is part of the reason why it has taken me so long.

With this semester is almost over, I have done a bit of planning so I can hit the ground running with this project. I want to have the hardware installed as soon as reasonably possible so that I can start work on the software remotely.

The general idea for this project is to have a weather station that hosts a web-app. This would allow you to view the current weather conditions from anywhere in the building.

In order to do this, I will have a raspberry pi to host the server and communicate with the station hardware. The station hardware will include a weather vane, rain meter, temperature, humidity, pressure, and possibly a uv-index sensor. This will all be directly controlled by a teensy.

## Hardware plan

The raspberry pi will sit on the roof in a shady spot. It will be connected to the internet via ethernet and get power over ethernet (PoE). The pi will interface with the teensy using CAN over an ethernet cable. Itā€™s possible that the pi could be placed indoors, but I want to attach a camera as a little bonus thing. The teensy will be directly connected with all the sensors over i2c. The weather vane and rain meter donā€™t have any logic chips and so will need to be specially programmed.

## Software plan

The teensy will generally act as a bridge between the sensors and the pi. The weather vane and rain meter will need special logic which I will go into later. The teensy will respond to requests from the pi. The pi will run OctoWeather (PWS software that I am developing). I havenā€™t made any plans yet of how this software will work, but I have general ideas of what it will do in my projects page.

The weather vane has two parts: wind direction and wind speed. Both of these use reed switches to detect what is happening. The wind speed closes the circuit on every rotation (maybe every 180Āŗ I canā€™t quite remember which). The wind direction has eight reed switches each connected to a different resistance to detect which cardinal direction the wind is blowing in. The rain meter has one reed switch that triggers every time 0.01 inches has fallen. The wind speed and rain meter will need to have special software to asynchronously determine how much rain has fallen and how fast the wind is blowing. This should be relatively easy by using pin change interrupts. The wind direction can be connected to a voltage divider to measure resistance on an analog pin.

## What Iā€™ve done so far

I have been able to install an ethernet cable that goes from the basement to the roof. I have also collected all of the hardware that I plan to use for this project.

=> ethernet_install.jpg šŸ–¼ Ethernet Going to the roof
=> pws_hardware.jpg šŸ–¼ Hardware I have so far
]]></content>
    <category term="projects" label="Projects" scheme="gemini://benjaminja.com/tags/projects/" />
    <category term="weather-station" label="Weather-Station" scheme="gemini://benjaminja.com/tags/weather-station/" />
    <published>2023-04-16T17:26:00Z</published></entry>
  <entry>
    <title><![CDATA[Organizing My Life]]></title>
      <link rel="alternate" type="text/gemini" hreflang="" href="gemini://benjaminja.com/log/2023/02/26-organizing_my_life/" />
    <id>gemini://benjaminja.com/log/2023/02/26-organizing_my_life/</id>
    <updated>2023-02-26T21:22:00Z</updated>
    <summary type="gemini"><![CDATA[I have always been bad at organizing my life. It can be hard for me to know what to do and when to do it. This is a particularly big problem for me because of executive disfunction.
]]></summary><content type="gemini"><![CDATA[I have always been bad at organizing my life. It can be hard for me to know what to do and when to do it. This is a particularly big problem for me because of executive disfunction. There are many ways in which I could go about keeping track of what needs to be done, but they all boil down to some sort of calendar system. That being said, each system has you think about things in a different way.

I have tried using my calendar app, various todo apps, and physical journaling. Each one has their pros and cons, but they all ultimately failed me in the sense that I have gotten out of the habbit of using them. Life has been getting overwelming recently and so I thought that it would be a good idea to get back into the habbit of using one of these.

It sounds a little odd, but I have found that physical journaling has been the most useful for me. I have a bit of a hard time expressing why this is, but I think it has to do with how a lot of effort needs to be put into writing in a journal. It is so easy to setup an app, that it is also easy to just ignore it. With journaling, what I write tends to sticks with me.

I follow the the bullet journal style of journaling which has been useful for me to have an organized todo list as well as being able to write down my random thoughts.

=> https://help.bulletjournal.com/en-US/articles/bullet-journaling-101-17356 Bullet Journaling 101

Of course, the bulletjournal site will try to sell you a journal or even a course on how to use it. I am just using a notebook a friend gifted to me.

=> journal.jpg šŸ–¼ My journal

Iā€™ll eventually fall out of use with my journaling again, but thatā€™s ok because all that matters is that it has been useful while it lasts.
]]></content>
    <category term="life" label="Life" scheme="gemini://benjaminja.com/tags/life/" />
    <published>2023-02-26T21:22:00Z</published></entry>
  <entry>
    <title><![CDATA[How I deploy to my server]]></title>
      <link rel="alternate" type="text/gemini" hreflang="" href="gemini://benjaminja.com/log/2023/02/13-how_i_deploy/" />
    <id>gemini://benjaminja.com/log/2023/02/13-how_i_deploy/</id>
    <updated>2023-02-14T17:25:00Z</updated>
    <summary type="gemini"><![CDATA[I donā€™t run this capsule on a server that I physically own. I rent out my server from digitalocean. Since my server doesnā€™t need to have lots of computing power or memory, I have opted to use the cheapest server possible that pennies can buy.
]]></summary><content type="gemini"><![CDATA[I donā€™t run this capsule on a server that I physically own. I rent out my server from digitalocean. Since my server doesnā€™t need to have lots of computing power or memory, I have opted to use the cheapest server possible that pennies can buy. The only problem is that the server is so underpowered: it is nearly impossible to install software from source. In this log, I will explain how I go about deploying software to my server.

=> https://digitalocean.com digitalocean.com

Iā€™ve deployed my server as a droplet using a single shared CPU with 512 MB of memory. Because of these low specs, I have decided that all of my server/CGI software will run on native binaries to make using my capsule as smooth as possible.

The main server software that I use is made with Rust; a language known for its long and intensive compilations. I tried building it on my server and it took around 10 minutes before the build crashed from a lack of available memory. I would probably be better off cross compiling from my computer and uploading the binary than trying to find some workaround.

## Uploading to the server

Compiling software for the server can vary widely from language to language, but it is almost always the same to upload your built binary to the server. The way I do it is by having a `deploy.sh` script in the root of a project that will build, upload, and install the software on the server.

BINARY=path/to/binary

REMOTE=root@my_server

BINAME="$(basename "$BINARY")"BINDIR=/usr/local/bin

TMPDIR=/var/tmp

TODO Buildscp "$BINARY""$REMOTE:$TMPDIR/"ssh "$REMOTE""cd $TMPDIR &&

install -Dm755 ./$BINAME$BINDIR/$BINAME &&

rm ./$BINAME"


Of course depending on the type of software Iā€™m deploying, the script may need to change to fit the projectā€™s needs. I feel that it would be simpler to just scp the binary directly into the installed destination rather than installing it with a separate command, but I kind of like it.

## Deploying Rust

Rust has become my goto language when it comes to compiled software. It supports a lot of language features that I like. It can feel like a high-level language while still allowing for low level control. My problem with Rust is with how difficult it is to cross compile. In theory, it is very easy to cross compile Rust, but when external libraries are used: the process becomes infinitely more complicated.

You will first need to install a target for your toolchain (This is fairly easy). If the program doesnā€™t use any external libraries, you should be good to go. Otherwise, you will need to install a C cross compiling toolchain (This can be tricky depending on your host system) and tell rust the linker you will be using in `.cargo/config.toml`. If your build still fails, a library might be compiling C from source, so you will need to tell rust that any C code should be built using your cross compiling toolchain in an environment variable. If you still canā€™t cross compile the software, then get ready for a never ending rabbit hole.

There is a tool that will help you do cross compiling that I wish I had known about before I spent a week learning how to do it manually. It is called ā€œCrossā€, and allows you to do cross compilations with very little hassle.

=> https://github.com/cross-rs/cross Cross

You will need to have Docker installed for Cross to work, but I think I have read that it might be possible to configure Cross to use Zig as a linker/compiler instead of building inside a Docker container.

Building with Cross is usually as simple as replacing `cargo` with `cross`. Depending on your needs, you may need to create a `Cross.toml` to customize your build, but that is still simpler than doing it manually.

TARGET=x86_64-unknown-linux-gnu

BINAME=<binary>

BINARY=target/release/$TARGET/$BINAME

cross build --release --target $TARGET


## Deploying Go

In comparison to Rust, Go is a walk in the park. All that is needed to cross compile Go is two environment variables: `GOOS` and `GOARCH`. I donā€™t know if there are any edge cases that might show up when building. I really should learn Go.

BINAME=<binary>

BINARY=$BINAME

GOOS=linux GOARCH=amd64 go build


I havenā€™t needed to do anything else for Go to work, but I also donā€™t know the language. If it were possible to use external libraries, then I would imagine that cross compilation could get more complicated, but I just donā€™t know enough about the language to know if thatā€™s even possible.

## Deploying my capsule

This isnā€™t a language, but I figure itā€™s worth mentioning. When I deploy my capsule, I upload the project up to the server and then render it. This allows for semi-dynamic content that is stored exclusively on the server to be rendered into the capsule. The way I go about deploying the capsule is a little bit funky, but it works and thatā€™s all that matters.

DIR="$(dirname -- "${BASH_SOURCE[0]}")"SERVER='gemini@my_server'DEST='/path/to/capsule/data/'SOURCE="$DIR/."GEMINI="/var/www/gemini/my.site/"COMMAND="${1:-upload}"# Upload to the serverif["$COMMAND"="upload"]; then# Synchronize the project with the server rsync -rltp --delete-after -z --exclude='./git' --filter=':- .gitignore' -h "$SOURCE""$SERVER:$DEST" echo "Uploaded capsule"# Run the build section of the deploy script on the server ssh -t "$SERVER""cd $DEST ; ./deploy.sh build"elif["$COMMAND"="build"]; then# Render the capsule cd "$DIR" kiln build

RES=$?

if[ $RES -ne 0]; then exit $RES

fi# Copy the rendered files into the server folder rsync -r "${DEST}public/""$GEMINI" RES=$?

if[ $RES -ne 0]; then exit $RES

fielse echo "Invalid Command, should be one of [upload, build]"fi


I havenā€™t yet had the chance to deploy any other types of software, but I can imagine that some will be easier than others. Zig should be pretty simple, but C/C++ scares me. The thought of having to find or build libraries does not seem at all fun. Though C/C++ should still be easier than Rust.
]]></content>
    <category term="projects" label="Projects" scheme="gemini://benjaminja.com/tags/projects/" />
    <category term="capsule" label="Capsule" scheme="gemini://benjaminja.com/tags/capsule/" />
    <category term="gemini" label="Gemini" scheme="gemini://benjaminja.com/tags/gemini/" />
    <published>2023-02-14T17:25:00Z</published></entry>
  <entry>
    <title><![CDATA[My Capsule Plans]]></title>
      <link rel="alternate" type="text/gemini" hreflang="" href="gemini://benjaminja.com/log/2023/02/10-capsule_plans/" />
    <id>gemini://benjaminja.com/log/2023/02/10-capsule_plans/</id>
    <updated>2023-02-10T19:20:00Z</updated>
    <summary type="gemini"><![CDATA[I have been getting fairly ambitious with ideas for my capsule. This is dangerous with me being in the middle of a heavy semester, so I am going to write down my plans and implement them later.
]]></summary><content type="gemini"><![CDATA[I have been getting fairly ambitious with ideas for my capsule. This is dangerous with me being in the middle of a heavy semester, so I am going to write down my plans and implement them later. Hopefully I donā€™t end up working on these projects to avoid my schoolwork (I am writing this very log to distract myself from a project I need to do šŸ™ƒ).

## Serve my content on both gemini and https

At the moment, I am serving my capsule on the www under a proxy. This has been good, but I would like to have more control of how it looks. To do this, I want to serve my capsule natively on both gemini and https protocols.

I want the feel of the web version to be simple, but feel like it was meant for the web. Primarily so that I can have a navigation section and inline images.

If I were to do this, I might need to write most of my content in markdown so that I can convert it into http/gemtext without much fuss.

## Automated Gemmentions implementation

=> https://codeberg.org/bacardi55/gemini-mentions-rfc Gemini Mentions RFC

Seeing some of the implementations of gemini mentions has been really good. Notably Seanā€™s implementation where mentions to a post are placed at the bottom of the page under ā€˜Discussions about this entryā€™. I particularly like how it feels like Iā€™m going through a big discussion thread without the need of looking through an aggregator.

=> gemini://gemini.conman.org/boston/2023/01/04.1 Thoughts on an implementation of Gemini mentions (The post where I first saw mentions being used)

I want to have a feature like this myself, but I also donā€™t want to do any of it by hand. The idea would be to have a gemmention CGI script that adds mentioned pages to a database, then ask the site generator to rebuild the capsule (Any mentions would be placed in a footing after the article).

Iā€™ve already written a CGI program that can upload mentions to a database, but I have yet to figure out how to insert mentions into posts. I would like to make the program portable so that anyone who would like to have similar functionality could do it themselves. The only problem is that the software I wrote is too complicated to publish without a lot of simplifications.

## Aggregate topics

On most of my pages, I have added a little topics section at the top of the page. I want to have a section of my capsule where you can sort by similar topics.

I would have tags stored in the frontmatter and my site generator could generate pages for each topic. Also the title, date, and tags could be automatically inserted into the generated gemini files so I donā€™t have to repeat myself too much.

An example of the frontmatter might be like:

---

title: My Capsule Plans

date: 2023-02-10T12:20:00-07:00

tags:

- plans

- capsule

author: ttocsneb

---

I have been getting fairly ambitious with ideas for my capsule...


## Learn the ins and outs of Kiln

=> gemini://kiln.adnano.co/ Kiln

I am currently using Kiln to build my capsule. It has been great so far, but there are a few features that confuse me. I think that most of my problems lie in the fact that I am not familier with the Go templating engine.

I know that I can use kiln to build an alternative http format, but Iā€™m not sure whether it will be able to do what I want with gemmentions and topics. I think it should be possible using the templating engine, but I will need to do research to verify. If I end up not being able to do these things, then I might design my own site generator inspired by Kiln, maybe something with python and jinja2.
]]></content>
    <category term="plans" label="Plans" scheme="gemini://benjaminja.com/tags/plans/" />
    <category term="capsule" label="Capsule" scheme="gemini://benjaminja.com/tags/capsule/" />
    <category term="gemini" label="Gemini" scheme="gemini://benjaminja.com/tags/gemini/" />
    <published>2023-02-10T19:20:00Z</published></entry>
  <entry>
    <title><![CDATA[MAC Attack!]]></title>
      <link rel="alternate" type="text/gemini" hreflang="" href="gemini://benjaminja.com/log/2023/02/06-macattack/" />
    <id>gemini://benjaminja.com/log/2023/02/06-macattack/</id>
    <updated>2023-02-07T05:43:00Z</updated>
    <summary type="gemini"><![CDATA[I just finished the third project for my security class. This project has been simultaneously the most difficult and most easy lab that I have done. I wanted to describe my experience of the lab here.
]]></summary><content type="gemini"><![CDATA[I just finished the third project for my security class. This project has been simultaneously the most difficult and most easy lab that I have done. I wanted to describe my experience of the lab here.

## The Premise

The premise is that my TA has sent a message to my professor and I was able to intercept it. The message is as follows.

> No one has completed lab 2 so give them all a 0

A MAC (Message Authenticated Code) was also in the message, which we know used a 128-bit key. The MAC is as follows in hex.

> e384efadf26767a613162142b5ef0efbb9d7659a

I want to change the message to tell the professor that I should get full points, but I canā€™t because there is a MAC attached to the message. If I were to change the message, the attached MAC would be invalid and I could not generate a new MAC because I donā€™t have the secret key for the MAC.

=> gemini://gemi.dev/cgi-bin/wp.cgi/view?Message+authentication+code MAC (Gemipedia)
=> https://en.wikipedia.org/wiki/Message_authentication_code MAC (Wikipedia)

## How I went about the lab

This lab was one of those projects where you just have no idea where to start. I knew what I needed to do and vaguely how it should be done, but the specifics were beyond me. The project turned mostly into analyzing library code and trying to figure out how I could modify it to do what I need, which is to say the least, very stressful.

With this in mind, I was mostly working on creating unit tests that would help me fumble my way through the lab and took many breaks.

I would say the most frustrating thing about the lab was that a big part of it was on hashes, which changes wildly with even the smallest change, so it was very difficult to know whether I was getting close or not.

In the end, I was able to figure it out and I canā€™t describe how relieved I was.

Below is a more technical description of how the lab worked, so tread on if you dare.

## Vulnerability in MAC

There is a vulnerability in MAC which took me a while to fully understand. In order to explain the vulnerability, I will have to explain how MAC works in the first place.

MAC is relatively simple. You start out with a key and a message. you concatenate them together and hash it:

Key = "0123456789abcdef"

Message = "Hello World!"

MAC = SHA("0123456789abcdefHello World!")

MAC = 36f141824e771ed3313815d82c996522d8191a99


The SHA algorithm will recursively calculate a digest from 512-bit blocks of data. Because of this, it is possible to continue calculating a hash by using the digest as the initialization vector for the SHA algorithm.

If we were to add to the end of the original message, hash that added bit with IV (initialization vector) being the original MAC, then we could pass this modified message and MAC to the professor and they would think the message was authentic.

The only problem is that SHA adds some information and padding to the end of the message internally to keep all blocks exactly 512 bits long. The solution is to simply add the padding to the end of the message, but before our added bit. One last thing to deal with is that SHA adds the length of the hashed string at the end of the last block, so we will need to know the length of the key for this to work.

## The Attack

We are given pretty much everything we need for the attack. The most difficult thing will be figuring out how to modify the IV. According to my teacher, golangā€™s API for SHA allows setting the IV, but most languages donā€™t provide that functionality. I had to download a SHA-1 library and modify it myself to allow for setting an initialization vector. Analyzing the library and making it work for what I need was probably one of the most hair pulling things I have done.

Adding the padding to the message wasnā€™t too difficult, particularly with the aid of unit testing.

In the end I was able to generate this message to send to my teacher; posing as my TA with a valid MAC. The message itself looks a little corrupted, but that is a problem to deal with another day.

> Message: No one has completed lab 2 so give them all a 0\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\xf8P.S. Except for ttocsneb, Give him 100%

> MAC: d338d12365cd75f5f13673991d9cd1359e355b2e

## Prevention from this kind of attack

The best way to prevent this attack from being possible would be to use HMAC instead. It essentially performs two hashes with the key being manipulated in a way that I can not understand.

=> gemini://gemi.dev/cgi-bin/wp.cgi/view?HMAC HMAC (Gemipedia)
=> https://en.wikipedia.org/wiki/HMAC HMAC (Wikipedia)
]]></content>
    <category term="school" label="School" scheme="gemini://benjaminja.com/tags/school/" />
    <category term="projects" label="Projects" scheme="gemini://benjaminja.com/tags/projects/" />
    <published>2023-02-07T05:43:00Z</published></entry>
  <entry>
    <title><![CDATA[School has begun]]></title>
      <link rel="alternate" type="text/gemini" hreflang="" href="gemini://benjaminja.com/log/2023/01/15-school_has_begun/" />
    <id>gemini://benjaminja.com/log/2023/01/15-school_has_begun/</id>
    <updated>2023-01-15T17:06:00Z</updated>
    <summary type="gemini"><![CDATA[I find it funny that I chose to start a gemlog right as school started. I was fully expecting to be able to put out more content than I have so far, but thatā€™s ok. School should probably have a higher priority than my hobbies.
]]></summary><content type="gemini"><![CDATA[I find it funny that I chose to start a gemlog right as school started. I was fully expecting to be able to put out more content than I have so far, but thatā€™s ok. School should probably have a higher priority than my hobbies.

Iā€™m almost done with school! Iā€™ll be taking my final CS classes this semester with a few generals. For spring and summer terms, I just need to take 3 GEs and I will be graduated! The first week has already passed, so I have a pretty good idea of how this semester will go. I will be taking these classes this semester:



### Concepts of Programming Languages

Concepts of Programming Languages is a class that teaches about how languages work and why there are different features in different programming languages. I signed up for this class because I was expecting it to be a class about how to design your own language. I think that this is still applicable, but it wonā€™t be about how to design a language.

In this class we are using a functional type language that I have never heard of before: Racket#plait. It is essentially an educational language based on lispā€“which I have heard of but never used. The syntax feels clunky, but I think can get used to it.

I may have already fallen asleep in class, but I blame that on how late we meet. Iā€™m actually pretty excited for this class and I canā€™t wait until we start talking about specific language features.

### Computer Security

I donā€™t yet know what computer security will be like other than a lot of labs. We will be discussing how we can make computer systems secure from cryptography to protecting from phishing attacks.

The first lab is to implement AES from scratch in two weeks. This isnā€™t too bad until you realize that we will only talk about AES for the two days before the lab is due. The professor said that this first lab is the worst lab in the class and he would change it if he was allowed to. I found it very difficult yet fulfilling to learn about how finite-field arithmetic works.

One of the final homeworks (extra-credit) we will do in the class is to access certain information about the professor that he is hiding from us: His twich account, 3 video games he plays, his favorite food, where he got married, and his high-schoolā€™s mascot. This is really cool, but Iā€™m glad this is an extra credit thing.

### Ethics & Computers in Society

This is the one I dread. It is a required class that talks about the ethics in computer science. We will be selected to be in groups that each have a different subject of CS. Each group will do research on what kinds of ethical dilemas are in the subject and do presentations on our findings.

This class is interesting to me in principle, but these kinds of classes are always hard to guage whether they will be unnecessarily difficult.

### University Band

Since this will be my last full semester, I figured that I take should band. I havenā€™t played since high school, which I graduated in 2017. Being rusty might be an understatement. Iā€™ll be playing the tuba and I feel pretty confident that I will be able to re-learn it.

My biggest worry will be that playing in the band will get in the way of my classes, but I donā€™t think that it will be too much of a problem.

### Food Preparation

I signed up for food prep for two reasons: I need two more credits to fulfil my pell grant, and I should know how to cook. Because everyone else wants to take the cooking class, I got stuck in the waiting list for a while.

It got bad enough that I wrote a script that would query the registration API every 15 minutes to see if any section had an available seat. After a certain amount of time, everyone gets dropped from the waitlist and it because a game of first come first serve. I managed to get into a different section than my original plan. This other section has already met, so I wonā€™t be able to go to class until after the add/drop deadline.
]]></content>
    <category term="school" label="School" scheme="gemini://benjaminja.com/tags/school/" />
    <category term="plan" label="Plan" scheme="gemini://benjaminja.com/tags/plan/" />
    <published>2023-01-15T17:06:00Z</published></entry>
  <entry>
    <title><![CDATA[Trying out my own gemlog]]></title>
      <link rel="alternate" type="text/gemini" hreflang="" href="gemini://benjaminja.com/log/2023/01/06-trying_out_gemlog/" />
    <id>gemini://benjaminja.com/log/2023/01/06-trying_out_gemlog/</id>
    <updated>2023-01-06T18:59:00Z</updated>
    <summary type="gemini"><![CDATA[I am by no means a writer. I may have grown up a native english speaker, but my words donā€™t reflect that. I have always gotten a C or worse in my english classes, and writing essays has always been an arduous task for me.
]]></summary><content type="gemini"><![CDATA[I am by no means a writer. I may have grown up a native english speaker, but my words donā€™t reflect that. I have always gotten a C or worse in my english classes, and writing essays has always been an arduous task for me. Despite this, I want to write gemlogs. I canā€™t yet articulate why I want to write a blog of sorts, but I think it has something to do with wanting to be a part of the gemispace community.

Iā€™ve lurked around here for almost 2 years now. I learned about gemini in late 2020 from some random tech youtuber who gave a review for gemini as a replacement to the web. At the time, I was taking a systems programming class where we learned about the kernel and how to interact with it. Our final project was to create an http/1.0 proxy in c. I wished that I could have instead created a gemini proxy instead. After the class, I tried creating my own gemini server. I ended up giving up on it due to scope creep.

Iā€™ve really enjoyed discovering all the stuff that people have made here. Station is very cool. Iā€™ve only just recently discovered antenna which has gotten me to go through so many rabbit holes. I feel like itā€™s about time for me to become a part of this community and write about my experiences.

Despite this, I am quite scared of posting my writing. I am worried about what people might think of meā€“that Iā€™m not good enough, people wonā€™t care for what I have to say or possibly worse, people will care about what I have to say. People might start to have expectations of me that I would not be able to provide. Having eyes on me is scary. People will judge me (good or bad) and there is nothing that I can do about it.

While I am worried about creating a gemlog, I think it will be good for me. I shouldnā€™t be scared. My writing is probably not as bad as I think it is and if it is, the quality should improve with time. I hope you will enjoy what I have to offer, and more importantly I hope I wonā€™t abandon my gemlog when the going gets tough.
]]></content>
    <category term="writing" label="Writing" scheme="gemini://benjaminja.com/tags/writing/" />
    <category term="gemini" label="Gemini" scheme="gemini://benjaminja.com/tags/gemini/" />
    <published>2023-01-06T18:59:00Z</published></entry>
  <entry>
    <title><![CDATA[The Moon Project]]></title>
      <link rel="alternate" type="text/gemini" hreflang="" href="gemini://benjaminja.com/log/2018/06/12-the_moon_project/" />
    <id>gemini://benjaminja.com/log/2018/06/12-the_moon_project/</id>
    <updated>2018-06-12T20:59:59Z</updated>
    <summary type="gemini"><![CDATA[While I was browsing thingiverse, and I found a cool model for the moon.Ā It has both a bump map for the surfaceā€“giving the texture of the moon with all of its cratersā€“and a bump map for the darkness on the moon, which is on the inside of the model.
]]></summary><content type="gemini"><![CDATA[While I was browsing [thingiverse], and I found a cool [model for the moon].Ā  It has both a bump map for the surfaceā€“giving the texture of the moon with all of its cratersā€“and a bump map for the darkness on the moon, which is on the inside of the model.Ā  The inner bump map is used for lights: A light on the inside will show darker on the thicker spots of the moon, making it look more like the moon.Ā  You can read more about how it works, and how you can make your own model [here].
=> https://www.thingiverse.com/ thingiverse
=> https://www.thingiverse.com/thing:2771919 model for the moon
=> http://www.instructables.com/id/Print-Your-Own-Moon/ here

## Printing The Moon

Since my dadā€™s birthday is coming up, I decided to print one for him.Ā  In the first print, I ran out of filament but had some old extra stuff that was not on a roll.Ā  It ended up tangling up but able to finish.Ā  The two colors were not able to stay together, so I had to reprint it.Ā  The second print was done completely with the old filament.Ā  However, it got tangled in the night and ultimately failed.Ā  I was now out of white filament, so I reprinted with silver.Ā  It turned out great except for the fact that it was silver.Ā  No light could pass through the moon, and so I had to reprint again.Ā  I was able to order some white filament in time and print it in white.Ā  It finished but the printer was having temperature problems, and so parts were under-extruded.Ā  I will have to print again, but I havenā€™t yet.Ā  Also, did I mention that each moon took 25 hours to print?

=> https://youtu.be/CYXU0qKKzmQ Youtube - Printing Moons

## Lighting System

After I printed the moons, I had to figure some way to light it up.Ā  My first lighting system was to use a light from a Christmas house.Ā  It worked, but I did not like it.Ā  There were rings of light at the top, and the lighting was uneven.

=> img_0004.jpg šŸ–¼ img_0004

I have a few [NeoPixels] laying around, as well as a [light up button] and a [Pro Trinket].Ā  So I will create my own lighting system.Ā  I started out making an Interpolation library.Ā  This way the lights can turn on smoothly.Ā  After completing the library, I found that someone had already created one: [Ramp].Ā  I will use it in future projects, but for this one, Iā€™ll continue using my [home-made library].
=> https://www.adafruit.com/product/1312 NeoPixels
=> https://www.adafruit.com/product/1476 light up button
=> https://www.adafruit.com/product/2000 Pro Trinket
=> https://github.com/siteswapjuggler/RAMP Ramp
=> https://github.com/ttocsneb/Arduino-Interpolate home-made library

The program has two modes: Power, and Brightness.Ā  Power turns on and off the light when the button is pressed/released.Ā  Brightness dims and err, undims the light until the button is pressed switching to power mode and saving the current brightness in EEPROM.Ā  I uploaded my code to a [Gist], but I recommend you write your own version while using mine as a guide.
=> https://gist.github.com/ttocsneb/54ecf4dc0792c8465a4d0e178fb67792 Gist

Probably the most tricky part was designing a model for the electronics.Ā  The cone I designed is small, so I have to fit the Pro Trinket with a USB plug in there without it making holes on the outside.Ā  Since it is very specific to my parts, you might want to design your own, but I uploaded both [STL and STEP] files if you are interested.
=> https://www.thingiverse.com/thing:2958491 STL and STEP

=> img_0005.jpg šŸ–¼ IMG_0005
=> img_0006.jpg šŸ–¼ IMG_0006
=> img_0007.jpg šŸ–¼ IMG_0007
=> img_0003.jpg šŸ–¼ IMG_0003

=> https://gist.github.com/ttocsneb/54ecf4dc0792c8465a4d0e178fb67792 See my code on my gist
]]></content>
    <category term="wordpress" label="Wordpress" scheme="gemini://benjaminja.com/tags/wordpress/" />
    <category term="3d-printing" label="3d-Printing" scheme="gemini://benjaminja.com/tags/3d-printing/" />
    <published>2018-06-12T20:59:59Z</published></entry>
  <entry>
    <title><![CDATA[Weatherstation: Charging Circuit]]></title>
      <link rel="alternate" type="text/gemini" hreflang="" href="gemini://benjaminja.com/log/2018/05/24-weatherstation-charging-circuit/" />
    <id>gemini://benjaminja.com/log/2018/05/24-weatherstation-charging-circuit/</id>
    <updated>2018-05-24T23:19:17Z</updated>
    <summary type="gemini"><![CDATA[One of the big things on the to-do list is a charging circuit.Ā I need a charging circuit to allow the solar panel to charge the battery.Ā Lucky for me, the Arduino Feather 32u4 has a built-in charging circuit, but then why would I need a charging circuit?
]]></summary><content type="gemini"><![CDATA[One of the big things on the to-do list is a charging circuit.Ā  I need a charging circuit to allow the solar panel to charge the battery.Ā  Lucky for me, the Arduino Feather 32u4 has a built-in charging circuit, but then why would I need a charging circuit?

I bought a little voltage regulator for the solar panel which makes sure that the voltage stays at 5V.Ā  If the voltage goes below 5V and has enough current, then the output voltage will be 5V with a little less current.Ā  Iā€™ve done this because the charging circuit does not work with lower than 5V.Ā  After some testing, I found that the built-in charging circuit stops charging the battery if the solar panel goes through the process of losing sunlight, thenĀ regaining the sunlight.Ā  In order to fix the issue, I can disconnect the power line from the solar panel to the device when there is no sun.Ā  So the charging circuit isnā€™t actually a charging circuit, but rather a charging enable circuit.

## Version 1

My original design used an N-MOSFET.Ā  I used an N-MOSFET because everyone uses NPN BJT transistors, so why not use an N-MOSFET.Ā  After learning about MOSFETs, I created my V1 charging circuit.Ā  It had a voltage divider to probe if the solar panel was getting any sun or not.Ā  The circuit with the N-MOSFET had to be connected to the solar panelā€™s ground: The drain pin should be connected to the load, and N-MOSFETs drain should be more positive than the source (See below image for more detail).

The only problem as you might have guessed is that I could not check the voltage of the solar panel without the N-MOSFET enabled, because the ground was being disconnected, and so the measured voltage had no reference.

I couldnā€™t find the schematic, or picture of the original circuit.
## Version 2

After a few months of ignoring the enable circuit, I decided to work on it again.Ā  After learning a bit more about P-MOSFETs, I found that the only difference between them is the voltage of the source and drain.Ā  The P-MOSFETs drain should be more negative than the source, so the MOSFET should be placed between V+ and your load.

=> mosfet-diagram.png šŸ–¼ mosfet diagram
=> https://electronics.stackexchange.com/questions/3599/basic-p-type-mosfet-question StackExchange - Basic p type MOSFET question

After some experimenting with the new circuit on a breadboard, I found that I donā€™t need the voltage regulator.Ā  In fact, the voltage regulator was causing all the problems that made me design the charge enable circuit.Ā  I donā€™t need the voltage regulator, because the solar panel is a 5V panel, and wonā€™t be able to produce enough current to step the voltage up if it isnā€™t even at 5V.

Just because the solar panel now charges the Feather doesnā€™t mean that creating a new charge enable circuit isnā€™t useful.Ā  If the temperature is too cold or too hot, I shouldnā€™t allow the Li-ion battery to be chargedā€“The temperature range for Li-ion batteries are [32F to 113F].Ā  I donā€™t know how I will insulate the battery to help prevent reaching those temperature ranges, but that is a problem for another day.
=> http://batteryuniversity.com/learn/article/charging_at_high_and_low_temperatures 32F to 113F

=> chargin-circuit.png šŸ–¼ chargin-circuit

=> ws-charging-circuit.jpg šŸ–¼ ws-charging-circuit
]]></content>
    <category term="wordpress" label="Wordpress" scheme="gemini://benjaminja.com/tags/wordpress/" />
    <category term="weather-station" label="Weather-Station" scheme="gemini://benjaminja.com/tags/weather-station/" />
    <published>2018-05-24T23:19:17Z</published></entry>
  <entry>
    <title><![CDATA[Weatherstation: Lots Happening]]></title>
      <link rel="alternate" type="text/gemini" hreflang="" href="gemini://benjaminja.com/log/2018/05/18-weatherstation_lots_happening/" />
    <id>gemini://benjaminja.com/log/2018/05/18-weatherstation_lots_happening/</id>
    <updated>2018-05-18T18:21:09Z</updated>
    <summary type="gemini"><![CDATA[Starting in April, I have started working on the weather station project again, and I have failed to make any updates since.Ā So Iā€™m going to try to write everything I have done in this past month and a half.
]]></summary><content type="gemini"><![CDATA[Starting in April, I have started working on the weather station project again, and I have failed to make any updates since.Ā  So Iā€™m going to try to write everything I have done in this past month and a half.

## Weather Station

First, I created a new repository for the project on [Github].Ā  In this, I have migrated my weather station from an Arduino project to a [PlatformIO] project.Ā  This is significant since the Arduino editor works only as a text editor and compiler, while PlatformIO on VSCode acts as a full IDE with code completion along with support for the old Arduino libraries.
=> https://github.com/ttocsneb/Weather-Station Github
=> https://platformio.org/ PlatformIO

Rather than waiting for commands, the weather station waits for 30 seconds then turns on the radio, and sends the weather packet.Ā  This is done for power saving.Ā  Before, the weather station had the radio turned on and listening 100% of the time.Ā  This wasted a relatively large amount of power.

The weather station now accepts commands after sending the weather update: Set Value, Get Value, Set EEPROM, Load EEPROM, Get Status, and Reset.Ā  These commands can be bunched together in packets.Ā  Some commands send replies which are sent in order after all the commands are sent.

## Base Station

The base station is the raspberry pi device that receives the raw weather data from the weather station through the rf24 chip.Ā  It receives the weather, processes the data into human-readable units, then uploads the data to Weather Underground.Ā  Most of the work done this past month is for the base station.

I have done a little bit of work in the past on the base station, but very limited.Ā  Then I planned to have the program run primarily in python, running a c++ script to get the weather from the radio chip.Ā  Now, most of the work done is in a C++ program, running a python script that uploads the weather to [wunderground.com].
=> http://wunderground.com wunderground.com

Program Loop

It runs in a 30-second loop that is synchronized with the weather station.Ā  To get synchronized, it will leave the radio on and wait until a transmission is received before beginning the loop again.Ā Ā  One problem I found with this system is that the Arduino and raspberry pi clocks arenā€™t the same.Ā  Even though they both wait 30 seconds, one seems to be slightly faster than the other.Ā  The problem is solvedā€”too complicated to explainā€”by the following code snippet.

//wait for an available packet

time_point t = Clock::now();

while(!successfull && timeDiff(t, Clock::now()) < eeprom::listenTime) {

sleep_for(500ms);

successfull = checkForPacket();

count++;

}

//If we are desyncing, compensate.

count -= (eeprom::listenTime /500) /2;

if(count !=0) {

reloadTime += (count *500);

cout <<"Desynced by "<< count *500<<"ms, adjusting"<< endl;

}


Every time the weather station successfully sends a packet: the program will process the data. Upload the weather. And send any commands.Ā  Since I have a website to check the current weather/station status;Ā  I need to have some way of getting that data to the website.Ā  So I decided to use MySQL for data storage and transfer.

MySQL

I am not very skilled in MySQL; after all, Iā€™ve only just learned it.Ā  My plan for the database is to hold the weather for 24 hours to display on the website and to move information from one program to another without the hassle of parsing individual files.Ā  Here are the tables I have made, displayed in a table.

Website

The website Iā€™m making is designed to be for me only: to get information about the station without SSHing into the baseStation.Ā  If I wanted to get the weather, I would use Weather Underground.Ā  Also, I donā€™t think a Raspberry Pi Zero is equipped to handle more traffic than my immediate family.

The website is fairly straightforward, Iā€™m using the [SB Admin] Bootstrap template.Ā  A few pages: One displaying the status, and other useful information.Ā  Another with the current weather with a 24-hour graph of previous temperatures, pressure, humidity, rain, and wind.Ā  Iā€™m using PHP to connect to the MySQL database to get the weather/status information.
=> https://startbootstrap.com/template-overviews/sb-admin/ SB Admin

In the future, I want to have a page for configuring the weather station from the website.Ā  Such as setting EEPROM variables on the weatherStation, or resetting the system remotely.Ā  One worry I have is permissions.Ā  I want the website unable to process these commands unless I am logged in.Ā  However I have never done anything like that before, so could be more difficult than I think.Ā  Of course, it could also be much easier than I think as well.

## Conclusion

As I continue to work on this project, I want to post once a week, or whenever I work on the weatherStation.Ā  That way I could give more detail, and include more code snippets to help anyone who might find this website who is also building their own weather station.Ā  I hope to get this project done in the next month;Ā  I also was planning to get it done a year ago so donā€™t expect too much.
]]></content>
    <category term="wordpress" label="Wordpress" scheme="gemini://benjaminja.com/tags/wordpress/" />
    <category term="weather-station" label="Weather-Station" scheme="gemini://benjaminja.com/tags/weather-station/" />
    <published>2018-05-18T18:21:09Z</published></entry>
  <entry>
    <title><![CDATA[WeatherStation]]></title>
      <link rel="alternate" type="text/gemini" hreflang="" href="gemini://benjaminja.com/log/2018/04/09-weatherstation/" />
    <id>gemini://benjaminja.com/log/2018/04/09-weatherstation/</id>
    <updated>2018-04-09T18:12:09Z</updated>
    <summary type="gemini"><![CDATA[šŸ™Ā GitHub Repository šŸ““Ā WeatherStation Posts This is an ongoing project, see the above links for more information on the project A number of years ago, my father got a home weather station for his birthday.
]]></summary><content type="gemini"><![CDATA[=> https://github.com/ttocsneb/Weather-Station šŸ™Ā GitHub Repository
=> /tag/weather-station/ šŸ““Ā WeatherStation Posts
> This is an ongoing project, see the above links for more information on the project

A number of years ago, my father got a home weather station for his birthday.Ā  It is a simple station that reads wind, rain, temperature, and humidity.Ā  It was a good for seeing how much rain we got, or how hot it is at our house.Ā  Somewhat recently, it broke, we arenā€™t sure what happened, but I decided to recycle the parts and create a new, better weather station.

My plan is to make a weather station that uploads its data to [wunderground.com] using their [PWS Upload Protocol]. The problem is that I need to send the weather data through a GET request, which I need a device with wifi.Ā  I could use an ArduinoĀ with wifi, but I donā€™t think that our wifi has a good enough range to use from the roof.Ā  So I am using an [RF24L01+] module from the station to a raspberry pi 0 baseĀ station, which will upload the data.
=> https://www.wunderground.com/ wunderground.com
=> http://wiki.wunderground.com/index.php/PWS_-_Upload_Protocol PWS Upload Protocol
=> https://arduino-info.wikispaces.com/Nrf24L01-2.4GHz-HowTo RF24L01+

The idea is simple but has a number of problems that need to be addressed, such as power.Ā  I plan to use a Li-ion battery with a solar panel to charge.

### RF24 Protocol

Every 30 seconds, the station will activate the radio, and send the weather data down to the base station, then listen for any commands for the next 2 seconds.Ā  This will allow me to make changes to some constants in the station without having to reflash.Ā  I should also be able to ask the stationĀ to do things, such as reset.

The commands are single chars followed by whatever else is needed.Ā  ie ā€˜Sā€™ is for setting the value of a constant, followed by a char of the code for the constant to be changed, followed by the value.Ā  If the command is a request, the station will send a packet back to the base.

### Solar Power

I am using an Adafruit Feather chip which has a Li-ion charging circuit built-in, so all I need to do is connect a solar panel to the charger.Ā  However, I ran into an issue, where when the power drops too low to charge, then rises back, the charging circuit will stop charging as expected, but will not start charging again until the solar panel is disconnected and reconnected.Ā  I plan to create a circuit with a mosfetĀ and voltage reader so that the station can deactivate the solar panel when it canā€™t supply enough current.
]]></content>
    <category term="wordpress" label="Wordpress" scheme="gemini://benjaminja.com/tags/wordpress/" />
    <category term="weather-station" label="Weather-Station" scheme="gemini://benjaminja.com/tags/weather-station/" />
    <published>2018-04-09T18:12:09Z</published></entry>
  <entry>
    <title><![CDATA[rcProtocol update]]></title>
      <link rel="alternate" type="text/gemini" hreflang="" href="gemini://benjaminja.com/log/2018/02/23-rcprotocol_update/" />
    <id>gemini://benjaminja.com/log/2018/02/23-rcprotocol_update/</id>
    <updated>2018-02-23T01:37:32Z</updated>
    <summary type="gemini"><![CDATA[It has been far too long since the last update, near the end of October.Ā Since then I have been able to make a bunch of improvements.Ā When I last posted, the remote could only pair and connect,Ā now constant communication works, telemetry works, the remote even reconnects after resets.
]]></summary><content type="gemini"><![CDATA[It has been far too long since the last update, near the end of October.Ā  Since then I have been able to make a bunch of improvements.Ā  When I last posted, the remote could only pair and connect,Ā  now constant communication works, telemetry works, the remote even reconnects after resets.

I have also been able to fly my quad with the remote.

### Constant Communication

As the name implies, Constant communication allows for communications to be sent constantly.Ā  In order for CC to work, both the receiver and transmitter call an update function during its program loop.Ā  The transmitter is restricted to run update() at a certain interval designated by the receiverā€™s settings. While the receiver can run update() as often as it is called.

There are several transmission types, dictated by the first byte in the packet. For example, 0xA0-0xAF are reserved for channel packets,Ā  and 0xC0 is for disconnecting.Ā  The receiver processes all of the packets in its update(), while the transmitter will send certain packets from different functions, such as the disconnect packet.

### Telemetry

Telemetry is sent by the receiver through ack-payloads.Ā  At the moment, Telemetry is sent every time a packet is received.Ā  I plan to make the frequency of telemetry packets set by the receiver settings.

I havenā€™t yet merged this to master yet, but telemetry has its own container class now.Ā  It manages all of the bytes in the telemetry object into the proper data.Ā  There are a bunch of things that can be sent through telemetry, and each needs its own implementation so the remote can enable/disable specific telemetry channels it uses. This allows for more efficient telemetry packets.

The telemetry class so far as only implemented, Battery Voltage, Current, Temperature, rpm, GPS, and alarms.

### Reconnects

For a normal receiver, if the receiver were to reset for whatever reason, there wouldnā€™t be much of a problem, since the transmitter will not care if it disconnected for a bit, but with this system, if that were to happen, it would have to go into connect mode, and do its handshake to make sure they can connect.Ā  This is not good, so if the remote, or receiver is to reset while connected, it will immediately consider itself to be connected with that device, and check if the other device is listening.

## Things Still To Do

I think that the library is very close to being finished, but there are still things yet to do.Ā  One of the things I want to do is create a container class for the channels similar to the telemetry class.

I want to have the channels be more standard so that the receiver can request certain channels, and the transmitter will know what to do.Ā  I think this can be done by recreating the Telemetry class.Ā  The remote would tell the Channels class which channels it can provide, and the receiver settings will contain information about which channels it needs.Ā  When the two pair, it will check if the transmitter has the channels the receiver asked for.Ā  If it works, then they will pair as normal, if they donā€™t match, a warning will be sent to the transmitterā€™s firmware, and it can decide whether they can pair and if they do, which channels to send instead.

I think this is one of the big things that need to be done before the library can be considered finished, but there are still a few small things that I would like to implement, like signal strength, and other things that I canā€™t think of right now.
]]></content>
    <category term="wordpress" label="Wordpress" scheme="gemini://benjaminja.com/tags/wordpress/" />
    <category term="drone" label="Drone" scheme="gemini://benjaminja.com/tags/drone/" />
    <published>2018-02-23T01:37:32Z</published></entry>
  <entry>
    <title><![CDATA[rcProtocol update]]></title>
      <link rel="alternate" type="text/gemini" hreflang="" href="gemini://benjaminja.com/log/2018/02/22-rcprotocol_update/" />
    <id>gemini://benjaminja.com/log/2018/02/22-rcprotocol_update/</id>
    <updated>2018-02-23T01:37:32Z</updated>
    <summary type="gemini"><![CDATA[It has been far too long since the last update, near the end of October.Ā Since then I have been able to make a bunch of improvements.Ā When I last posted, the remote could only pair and connect,Ā now constant communication works, telemetry works, the remote even reconnects after resets.
]]></summary><content type="gemini"><![CDATA[It has been far too long since the last update, near the end of October.Ā  Since then I have been able to make a bunch of improvements.Ā  When I last posted, the remote could only pair and connect,Ā  now constant communication works, telemetry works, the remote even reconnects after resets.

I have also been able to fly my quad with the remote.

There are several transmission types, dictated by the first byte in the packet. For example, 0xA0-0xAF are reserved for channel packets,Ā  and 0xC0 is for disconnecting.Ā  The receiver processes all of the packets in its update(), while the transmitter will send certain packets from different functions, such as the disconnect packet.

I havenā€™t yet merged this to master yet, but telemetry has its own container class now.Ā  It manages all of the bytes in the telemetry object into the proper data.Ā  There are a bunch of things that can be sent through telemetry, and each needs its own implementation so the remote can enable/disable specific telemetry channels it uses. This allows for more efficient telemetry packets.

The telemetry class so far as only implemented, Battery Voltage, Current, Temperature, rpm, GPS, and alarms.

I want to have the channels be more standard so that the receiver can request certain channels, and the transmitter will know what to do.Ā  I think this can be done by recreating the Telemetry class.Ā  The remote would tell the Channels class which channels it can provide, and the receiver settings will contain information about which channels it needs.Ā  When the two pair, it will check if the transmitter has the channels the receiver asked for.Ā  If it works, then they will pair as normal, if they donā€™t match, a warning will be sent to the transmitterā€™s firmware, and it can decide whether they can pair and if they do, which channels to send instead.

I think this is one of the big things that need to be done before the library can be considered finished, but there are still a few small things that I would like to implement, like signal strength, and other things that I canā€™t think of right now.
]]></content>
    <category term="wordpress" label="Wordpress" scheme="gemini://benjaminja.com/tags/wordpress/" />
    <category term="drone" label="Drone" scheme="gemini://benjaminja.com/tags/drone/" />
    <published>2018-02-23T01:37:32Z</published></entry>
  <entry>
    <title><![CDATA[rcProtocol]]></title>
      <link rel="alternate" type="text/gemini" hreflang="" href="gemini://benjaminja.com/log/2018/02/03-rcprotocol/" />
    <id>gemini://benjaminja.com/log/2018/02/03-rcprotocol/</id>
    <updated>2018-02-04T04:29:25Z</updated>
    <summary type="gemini"><![CDATA[šŸ”” Github Repository šŸ“•Ā Library Documentation rcProtocol (working title) is a protocol for communications between transmitters and receivers.Ā It is not for receivers communicating with flight controllers.Ā I donā€™t intend this to become a standard, though that would be fun;Ā I intend this to be a niche system for hobbyists who want to make their own remote system without going through the effort of creating their own communications protocol.
]]></summary><content type="gemini"><![CDATA[=> https://github.com/ttocsneb/rcProtocol šŸ”” Github Repository

=> http://ttocsneb.github.io/projects/rcprotocol/docs/html/annotated.html šŸ“•Ā Library Documentation

rcProtocol (working title) is a protocol for communications between transmitters and receivers.Ā  It is not for receivers communicating with flight controllers.Ā  I donā€™t intend this to become a standard, though that would be fun;Ā  I intend this to be a niche system for hobbyists who want to make their own remote system without going through the effort of creating their own communications protocol.

## Dependencies

There is only one dependency for the library, which is an [RF24L01(+)] chip with the [TMRh20 RF24] library.
=> https://arduino-info.wikispaces.com/Nrf24L01-2.4GHz-HowTo RF24L01(+)
=> https://github.com/nRF24/RF24 TMRh20 RF24

I have tried to keep my code system agnostic, so you could theoretically run rcProtocol anywhere RF24 can, but I canā€™t make any promises.

## Capabilities

rcProtocol allows remotes to be paired with more than one receiver.Ā  Each receiver has its own settings that are sent to the remote when paired.Ā  There are only simple radio specific settings at the moment, but I plan to give the receiver control of which channels are sent.Ā  You can read all of the settings in the documentation [here].
=> http://www.ttocsneb.com/projects/rcprotocol/docs/html/classRCSettings.html here

There is a max of 15 channels that can be sent, this is with full 32-byte packets.Ā  I might add the ability to sendĀ up to 16 unique channel packets, upping the theoretical channel maximum to 240 channels, though I would not recommend that.

Telemetry is also possible, by populating ACK packets.Ā  At the time of writing (V0.3.0), You have to manually parse telemetry.Ā  I plan to have standard stuff: Battery, Current, Temperature, RPM, Location, Alarms, etc.

An emergency reconnect system is enabled, making it so that if a board gets reset, it will automatically reconnect to the last device it was connected to before it reset.Ā  This is useful because of the way the transmitter/receiver connect, doing its special handshake would not work in a power failure as it would take too much time.

## Usage

The protocol has two main classes: DeviceProtocolĀ (rcDeviceProtocol.h), and RemoteProtocol (rcRemoteProtocol.h).Ā  The two classes mirror each other in functionality as they are for the receiver, and transmitter respectively.Ā  They both have the same functions but are implemented slightly differently.

To pair with each other, both need to call pair().Ā  The remote broadcasts its ID onto a pairing channel.Ā  The receiver will collect this, then start broadcasting its ID, as well as settings.

To connect, they both have to have paired with each other and call connect().Ā  The receiver will broadcast its ID on the remoteā€™s channel.Ā  The remote will then check if the ID is correct, then send a confirmation/denial response.Ā  They will both load the settings, and test if communication is still possible.

Once they are connected, the remote is free to send data to the receiver.Ā  Though currently, update() and disconnect() are the only communications the remote can send.

There are two other classes: RCGlobal; an internal class used by DeviceProtocol and RemoteProtocol, and RCSettings; a class that holds the settings for communications
]]></content>
    <category term="wordpress" label="Wordpress" scheme="gemini://benjaminja.com/tags/wordpress/" />
    <category term="drone" label="Drone" scheme="gemini://benjaminja.com/tags/drone/" />
    <published>2018-02-04T04:29:25Z</published></entry>
  <entry>
    <title><![CDATA[RC Remote API: Pairing/Connecting]]></title>
      <link rel="alternate" type="text/gemini" hreflang="" href="gemini://benjaminja.com/log/2017/10/29-rc_remote_pairing/" />
    <id>gemini://benjaminja.com/log/2017/10/29-rc_remote_pairing/</id>
    <updated>2017-10-29T16:37:43Z</updated>
    <summary type="gemini"><![CDATA[I was able to get progress on the api for my remote. It can now successfully pair, and connect. I still have yet to send a steady stream of data; That will be my next goal.
]]></summary><content type="gemini"><![CDATA[I was able to get progress on the api for my remote. It can now successfully pair, and connect. I still have yet to send a steady stream of data; That will be my next goal.

## Pairing

In order to pair, both the receiver, and transmitter must call the `pair` function. The remote will start announcing its ID on the `PAIR0` channel, the receiver will be listening on that channel for any data.

When data is received, the receiver will save the ID, switch to write mode on the received channel and send settings (currently that only consists of its ID). The transmitter will know that data was received, as auto-ack is turned on, and switch to receive mode, waiting for settings. When settings are received, it will pass them on to the remotes firmware to save.

## Connecting

When connecting, The receiver will go into write mode, announcing its ID on the remote ID channel saved from pairing. The transmitter will be listening on its channel. When it gets a transmission, it check if the ID sent was saved.

If any of the Saved IDs matches the sent ID, the transmitter will send back an OK, if not, it will send a FAIL, and will not connect to the receiver.

Right now, nothing happens after that. I will have both devices set a value that the device was connected, and which device it was connected to. This should allow the transmitter to know if it is okay to send data freely.
]]></content>
    <category term="wordpress" label="Wordpress" scheme="gemini://benjaminja.com/tags/wordpress/" />
    <category term="drone" label="Drone" scheme="gemini://benjaminja.com/tags/drone/" />
    <published>2017-10-29T16:37:43Z</published></entry>
  <entry>
    <title><![CDATA[RC Remote Software]]></title>
      <link rel="alternate" type="text/gemini" hreflang="" href="gemini://benjaminja.com/log/2017/10/24-rc-remote-software/" />
    <id>gemini://benjaminja.com/log/2017/10/24-rc-remote-software/</id>
    <updated>2017-10-24T15:00:22Z</updated>
    <summary type="gemini"><![CDATA[Over the course of the past year or so, I have torn apart an old RC Remote and put new electronics in. I think I have blogged about it before I rebuilt my website, and hope to restore those lost posts some day.
]]></summary><content type="gemini"><![CDATA[Over the course of the past year or so, I have torn apart an old RC Remote and put new electronics in. I think I have blogged about it before I rebuilt my website, and hope to restore those lost posts some day. I have since stopped working on it until about a week ago.

=> remote_wiring.jpg šŸ–¼ remote_wiring

I discovered [PlatformIO], a plugin for Visual Studio Code, that allows for development on just about any embedded computer. This allowed me to start developing the software for my remote in full.
=> http://platformio.org/ PlatformIO

I have planned to write the software in two parts: The comms library, and the Remote software. The comms library is an API designed to work with nRF24L01 chips and is built for both the transmitter and receiver. The remote Software allows the comms library to work with the hardware of the remote.

## Comms Library

The comms library also has two parts: The Receiver, and the Transmitter. The receiver is the class a device connecting to the remote would use, while the transmitter is the class the remote would use. They are built to work with each other, and so both can be explained simultaneously.

The library will allow a transmitter to pair with more than one device, along with device-specific settings that would be stored in the transmitter (The library doesnā€™t save the settings, but asks the remote to save/retrieve them). When the transmitter connects, it waits for the receiver to announce its ID on the transmitterā€™s channel, the transmitter will then load the settings for that device, and check if all the requirements are valid. If the requirements are not valid, the remote should warn the user, and ask what to do, while the device waits for further commands. If everything is good, the remote should alert the user that the connection was successful.

You should also be able to have add-ons: a device that can communicate with the receiver through the transmitter. An example of an add-on is a Gymbal remote; you would be able to control a gimbal mounted on a quadcopter from a second remote without having a second transmitter. The receiver can specify in the settings wither a specific add-on is required, and which channels from an add-on to send, or which telemetry channels to send to an add-on. The main transmitter is also considered to be an add-on (its ID is 0) so can have specific channels excluded from the transmission.

## Remote Software

The software for the remote handles all of the specifics that the comms library canā€™t. It will control the display, EEPROM, and handle inputs. The screen will be controlled by a UI class that controls several subscreen objects.

The menu structure will be set up something like this

mainscreen

|---Settings

|---System Settings

|---Connect On startup

|---Channels Graph

|---Reverse Channels

|---Change ID

|---Forget All receivers

|---etc

|---Receiver Settings

|---Change Name

|---Change Background Image

|---Forget This Receiver

|---etc


I have already gotten the basic structure for the UI setup, but I havenā€™t done much more than that. I plan to get a connection between the receiver and transmitter done next.
]]></content>
    <category term="wordpress" label="Wordpress" scheme="gemini://benjaminja.com/tags/wordpress/" />
    <category term="drone" label="Drone" scheme="gemini://benjaminja.com/tags/drone/" />
    <published>2017-10-24T15:00:22Z</published></entry>
  <entry>
    <title><![CDATA[Weatherstation: Software]]></title>
      <link rel="alternate" type="text/gemini" hreflang="" href="gemini://benjaminja.com/log/2017/06/17-weatherstation_software/" />
    <id>gemini://benjaminja.com/log/2017/06/17-weatherstation_software/</id>
    <updated>2017-06-17T21:27:42Z</updated>
    <summary type="gemini"><![CDATA[I finished wiring the station, though I would not be surprised if I need to make some last minute adjustments. The last bit of wiring I have done is interfacing with the existing hardware. The rain gauge and anemometer connect directly to the board with an internal pull-up activated.
]]></summary><content type="gemini"><![CDATA[I finished wiring the station, though I would not be surprised if I need to make some last minute adjustments. The last bit of wiring I have done is interfacing with the existing hardware. The rain gauge and anemometer connect directly to the board with an internal pull-up activated. The language is connected to D11 for PCINT7 which allows for interrupts. The weather vane is connected to A0 through a 5k7 resistor to act as a voltage divider with the resistors in the weather vain as the second resistor. The solar panel connects to the USB pin through a step-up converter to make sure there is a 5V output.

=> wiring.jpg šŸ–¼ wiring

As for the software, I created a simple flowchart of what the station will do.

=> flowchart.png šŸ–¼ flowchart

The Program will wait for commands, I expect to update once every 30 seconds. It will then process the command, then repeat. It is a very simple system. though will be slightly more complex than that.

I havenā€™t programmed the commands yet, rather got or getting the processes ready to be commanded. So far have had weatherdump mostly finished, as well as settingdump. They are not yet functional enough to be plugged into a communications API, but the framework is there.

WeatherDump

The weatherdump sends back all of the weather data from about the time the dump was requested. It should start out collecting the wind data as that takes at least 2 seconds. Everything else reads fairly quickly. Next is the weather vain, which just finds which of the eight reed switches are closed. The temperature and humidity come from the DHT22, and pressure comes from the MPL115. The grain count is stored in a variable that may or may not reset after each reading(I havenā€™t decided yet)

SettingDump

All of the settings are stored in the internal EEPROM. The settings are fairly simple, just conversions or other various settings regarding weather data. I am doing this so that if I find an error with my system, I can easily fix the small issues without having to take down the weather station and reflash it. I am mainly storing Integers, doubles, and booleans. As EEPROM stores its values as bytes and has no conversion systems, I have created a few converters. The first converter simplifies the booleans into bytes to conserve memory. The second converts Integers into two bytes. The third converts doubles into 5 bytes. It starts out by finding out how many bits the double needs to become a long. After that, the long is turned into 2 ints which are then saved using the previous writeInt command. The last 5th byte stores the number of bits the double is compressed by.
]]></content>
    <category term="wordpress" label="Wordpress" scheme="gemini://benjaminja.com/tags/wordpress/" />
    <category term="weather-station" label="Weather-Station" scheme="gemini://benjaminja.com/tags/weather-station/" />
    <published>2017-06-17T21:27:42Z</published></entry>
  <entry>
    <title><![CDATA[Weather Station Part 2]]></title>
      <link rel="alternate" type="text/gemini" hreflang="" href="gemini://benjaminja.com/log/2017/04/15-weatherstation_part2/" />
    <id>gemini://benjaminja.com/log/2017/04/15-weatherstation_part2/</id>
    <updated>2017-04-15T21:11:33Z</updated>
    <summary type="gemini"><![CDATA[I have started working on the main board for the station. Adding the transceiver, barometer, temperature, and humidity sensor. It is going pretty well so far. I have not yet tested the rf24 module, though the two other modules I have confirmed to work.
]]></summary><content type="gemini"><![CDATA[I have started working on the main board for the station. Adding the transceiver, barometer, temperature, and humidity sensor. It is going pretty well so far. I have not yet tested the rf24 module, though the two other modules I have confirmed to work. The MPL115 works pretty well and seems to give good readings, though I canā€™t really test it without putting it in a vacuum chamber or climb a mountain, which is fairly difficult, let alone try to tether it to a computer. The humidity sensor reads humid in my mouth, and the temperature sensor senses the proper temperature.

=> chip_top.jpg šŸ–¼ chip_top
=> chip_wiring.jpg šŸ–¼ chip_wiring

I was also able to do some testing on the old equipment. Most of it worked how I expected it would, though with a little twist. I started with the wind meter.

The wind meter will be the easiest to implement. It has a single switch that pulses every 180Ā°. The switch closed most of the time except for when pulsing, which opens the circuit. It will be really easy to implement as I only need to find the amount of time between two pulses. The hard part will be finding the conversion rate between rpm and airspeed. I wouldnā€™t be surprised if the information is readily online, but if it is not, I can take a few readings in a car ride at a set speed in a no wind environment.

Next is the Rain Gage. It is fairly simple, though it will be a bit harder to implement. The Rain gauge collects water in a see-saw thing. the water goes to one side until its bucket fills up and rocks the see-saw to the other side. This process repeats, but on the other side. when the bucket falls, the switch is pulsed. To implement, you just have to keep track of how many times the bucket dropped. It is really simple in principle, though in practice will require the system to always be listening for the switch to switch. An interrupt should do the trick. As for conversions, I believe each bucket drop is 0.01in, as that was the increment of the station before it broke, but I will have to confirm; Probably by leaving it out on a rainy day with rain bucket as a base.

The last is the weather vain, arguably the most difficult to implement. There are eight switches, one for each direction. each switch is parallel to each other with a different resistor paired with each. The resistorā€™s value seems to be random, making it more difficult to implement, though not by much. To implement, I would use a 100k5k7 pull-down resistor to get the following table. Though what I found interesting is that my readings from the last post are different to what the calculated resistance is.

I am certain that I am wrong about the resistance, either in my calculations, or my setup, but I remember reading the resistance on my meter to be correct.

## Edit

It turns out that I took out the resistor from a different box then what I thought I did for the pull-down resistor, it is actually a 5k7 resistor. Everything works out as it should though the West direction should read 4.254V instead of the actual 0V. I believe that a connection is somehow broken, but should work out fine in the final setup.
]]></content>
    <category term="wordpress" label="Wordpress" scheme="gemini://benjaminja.com/tags/wordpress/" />
    <category term="weather-station" label="Weather-Station" scheme="gemini://benjaminja.com/tags/weather-station/" />
    <published>2017-04-15T21:11:33Z</published></entry>
</feed>