<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="4.1.1">Jekyll</generator><link href="https://insom.me.uk//feed.xml" rel="self" type="application/atom+xml" /><link href="https://insom.me.uk//" rel="alternate" type="text/html" /><updated>2020-11-01T21:48:47-05:00</updated><id>https://insom.me.uk//feed.xml</id><title type="html">Shameless Self Promotion</title><subtitle>Usury is evil.</subtitle><entry><title type="html">What You Should Read (October 2020)</title><link href="https://insom.me.uk//2020/10/10/what-you-should-read.html" rel="alternate" type="text/html" title="What You Should Read (October 2020)" /><published>2020-10-10T00:00:00-04:00</published><updated>2020-10-10T00:00:00-04:00</updated><id>https://insom.me.uk//2020/10/10/what-you-should-read</id><content type="html" xml:base="https://insom.me.uk//2020/10/10/what-you-should-read.html">&lt;p&gt;&lt;a href=&quot;https://glyph.twistedmatrix.com/2020/08/lenses.html&quot;&gt;Lenses – Squinting harder never cured my ADHD.&lt;/a&gt; (glyph)&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Sitting up night after night destroying my mental and physical health, depriving myself of sleep, focusing with every ounce of my will on tasks that I absolutely hated doing but was forcing myself to complete at all costs: it doesn’t seem to line up with the popular conception of what “laziness” might be like! Yet, I absolutely believed that I was lazy. If I were not lazy, surely Doing The Thing wouldn’t be so difficult!&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This is the post that got me to try going all-in on a single to-do list that everything I need to do goes into. (It happens to be &lt;a href=&quot;https://www.todoist.com/&quot;&gt;Todoist&lt;/a&gt;, but anything with reasonable tags and saved searches could probably do).&lt;/p&gt;

&lt;p&gt;I don’t have ADHD but I often feel lazy. I’ve made a good career in computing and I obviously &lt;em&gt;do&lt;/em&gt; get things done, or else nobody would employ me, but my career has been one long square wave – where I oscillate between doing almost nothing and bouts of intense productivity. Good news: you can be successful doing this! Bad news: it’s really fucking taxing on your well-being.&lt;/p&gt;

&lt;p&gt;It’s not rare to spend four days of a work week getting almost nothing done, finishing several 8 hour days exhausted and frustrated, blaming this lack of progress on interruptions or succumbing to shallow work. Then, when I’m lucky, I nail things in the last day and it averages out to an okay week and I can start the cycle again. Sometimes that four days is more like 8 days, and that one “good day” is one sleepless night. It’s not always like this, but … it’s not uncommon, either.&lt;/p&gt;

&lt;p&gt;So, as is probably clear, my kind of lazy is actually hard work. I totally agree with Glyph’s premise that tools and techniques meant for people who are not neurotypical have value for everyone else, too.&lt;/p&gt;

&lt;p&gt;(A related version of this: I am dyslexic and the techniques I was taught by my primary school’s remedial teacher have allowed me to learn to read and distill information quickly. But what if &lt;em&gt;everyone&lt;/em&gt; learned how to read like this? Wouldn’t it provide a boost to non-dyslexic people?)&lt;/p&gt;

&lt;hr /&gt;

&lt;p&gt;&lt;a href=&quot;https://revdancatt.com/2015/10/05/asking_children_questions_about_ghosts&quot;&gt;20 questions to ask children about ghosts&lt;/a&gt; (revdancatt)&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Sometimes I find myself in a situation where I need to talk to a child. For some people talking to kids comes naturally, I am not one of those people. My usual gambit is to ask them what they’re interested in and taking it from there. But sometimes that just doesn’t work, they’re not interested in anything, or they’re not interested in sharing it, or they’re too intimidated by my beard to say anything.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;hr /&gt;

&lt;p&gt;&lt;a href=&quot;https://invisibleup.com/articles/31/&quot;&gt;All Our Selves in One Basket&lt;/a&gt; (InvisibleUp)&lt;/p&gt;

&lt;p&gt;This is a great article and it’s long. I wouldn’t want to TL;DR it, but one element that I agree with the most is the importance of communities owning their own “third places” online, through a combination of decentralization, federation, and rejecting algorithmic engagement.&lt;/p&gt;

&lt;p&gt;It reminded me that Telford in Staffordshire (150,000~ people) just has a shopping centre for its town centre, and when the mall is closed there’s basically nowhere for people to go.&lt;/p&gt;

&lt;hr /&gt;

&lt;p&gt;&lt;a href=&quot;https://macwright.com/2020/08/22/clean-starts-for-the-web.html&quot;&gt;A Clean Start for the Web&lt;/a&gt; (Tom MacWright)&lt;/p&gt;

&lt;p&gt;Linked from the InvisibleUp article, Tom makes the case for a split between the document oriented and application oriented web.&lt;/p&gt;

&lt;hr /&gt;

&lt;p&gt;&lt;a href=&quot;https://archive.org/details/processedworld32proc/page/32/mode/2up&quot;&gt;Processed World 32 - Feb ‘94&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It’s fun to read zines from the 90’s and see that not everything turned out as bad as we thought (or, they’ve taken longer to turn out that badly than people expected).&lt;/p&gt;

&lt;hr /&gt;

&lt;p&gt;&lt;a href=&quot;https://erkin.party/blog/200715/evolution/&quot;&gt;Evolution of a Scheme Programmer&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Only Lisp Kids Will Remember.&lt;/p&gt;

&lt;hr /&gt;

&lt;p&gt;&lt;a href=&quot;https://www.atlasobscura.com/articles/rosewater-vanilla-baking-pie&quot;&gt;The Downfall of Rosewater, Once America’s Favorite Flavor&lt;/a&gt; (Atlas Obscura / Jaya Saxena)&lt;/p&gt;

&lt;p&gt;I love me some trivia about some topic that’s totally irrelevant to my life.&lt;/p&gt;

&lt;hr /&gt;

&lt;p&gt;&lt;a href=&quot;https://arstechnica.com/information-technology/2020/08/the-golden-age-of-computer-user-groups/&quot;&gt;The Golden Age of Computer User Groups&lt;/a&gt; (Ars Technica / Esther Schindler)&lt;/p&gt;

&lt;p&gt;(More nostalgia). I got in on what feels like the tail end of this – Ireland Online had city-specific user groups who would meet up in pubs and talk about being on the Internet, in person. The mailing lists were actually useful and a springboard for a bunch of people’s careers on the early web.&lt;/p&gt;

&lt;p&gt;I remember the Irish Linux User Group setting up, and while I wasn’t active beyond one or two meetings, the idea of getting together to talk about Linux seems so weird to me now – especially as Linux kind-of won and is the dominant tech for building things on the web.&lt;/p&gt;

&lt;p&gt;It’s like the air that I breathe, and I rarely specifically think about how I use it – even using it on the desktop does not feel like an act of rebellion / self-sabotage like it used to do.&lt;/p&gt;

&lt;hr /&gt;

&lt;p&gt;&lt;a href=&quot;https://www.centennialbulb.org/&quot;&gt;Livermore California’s Centennial Light&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Home of the world’s longest burning lightbulb!&lt;/p&gt;

&lt;p&gt;I am so glad that this website exists.&lt;/p&gt;</content><author><name></name></author><summary type="html">Lenses – Squinting harder never cured my ADHD. (glyph)</summary></entry><entry><title type="html">Hello again, world</title><link href="https://insom.me.uk//2020/08/14/hi.html" rel="alternate" type="text/html" title="Hello again, world" /><published>2020-08-14T00:00:00-04:00</published><updated>2020-08-14T00:00:00-04:00</updated><id>https://insom.me.uk//2020/08/14/hi</id><content type="html" xml:base="https://insom.me.uk//2020/08/14/hi.html">&lt;p&gt;Some stuff that I wrote about recently on &lt;a href=&quot;https://tilde.town/&quot;&gt;tilde.town&lt;/a&gt; – about being inspired by seeing some
modern day tumblelogs – that has lead me down a rabbit hole.&lt;/p&gt;

&lt;p&gt;I rediscovered some 2005-era blogs from &lt;a href=&quot;http://leahneukirchen.org/anarchaia/archive/2005/03.html&quot;&gt;around the time of the dawn of Ruby on Rails&lt;/a&gt;
and have read some and followed links and it has made me feel like 15 years is
a &lt;em&gt;very&lt;/em&gt; short and &lt;em&gt;very&lt;/em&gt; long time.&lt;/p&gt;

&lt;p&gt;We still had Ubuntu back then! I remember
Ubuntu being new! But also we didn’t have Twitter or smartphones, two things
that I intellectually know weren’t invented or popular yet, but are such a part of 00’s culture
that it doesn’t &lt;em&gt;feel&lt;/em&gt; like they were introduced in the last couple of years of
the decade.&lt;/p&gt;

&lt;p&gt;Anyway, I’ve become slightly jealous of those people who either &lt;a href=&quot;https://utcc.utoronto.ca/~cks/space/blog/&quot;&gt;never left
blogging&lt;/a&gt; or who have &lt;a href=&quot;https://blog.jcole.us/&quot;&gt;tended their old blogs&lt;/a&gt; well. I have not done this, and
numerous times I have just &lt;a href=&quot;https://www.insom.me.uk/2004/12/15/tantrum.html&quot;&gt;blanked my blog&lt;/a&gt; or moved to another domain or
something.&lt;/p&gt;

&lt;p&gt;That said, I am enough of a digital pack-rat that I kept the
original files in most cases – I may not have a functioning blog archive back
to 2004, but I do have the files. Before 2004, I suppose I could try for the
wayback machine?&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;-rwxr-x---  1 aaron www-data  31K Jul 25  2004 ConjuringFireball.jpg*
-rwxr-x---  1 aaron www-data 4.4K Jul 25  2004 PythonFame.png*
-rwxr-x---  1 aaron www-data 7.8K Jul 25  2004 SolarisExpress.png*
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;blockquote&gt;
  &lt;p&gt;Pictured: Some files I have dutifully rsynced from machine to machine, preserving the timestamps, from before my teenage son was born.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Fun fact: one of the first entries in my 2004 blog is
&lt;a href=&quot;https://www.insom.me.uk/2004/06/13/weblog-responsibility.html&quot;&gt;an announcement&lt;/a&gt; that I have moved
off &lt;a href=&quot;http://blosxom.sourceforge.net/features.html&quot;&gt;Bloxsom&lt;/a&gt; and onto my own blogging software (I later went through
&lt;a href=&quot;https://movabletype.org/&quot;&gt;MovableType&lt;/a&gt;, &lt;a href=&quot;https://jekyllrb.com/&quot;&gt;Jekyll&lt;/a&gt;, &lt;a href=&quot;https://www.wordpress.org/&quot;&gt;WordPress&lt;/a&gt;, then my own thing again, then &lt;a href=&quot;https://gohugo.io/&quot;&gt;Hugo&lt;/a&gt; when I archived the site in
2015). I said I would be backfilling my new blog with the old entries from my
Bloxsom blog. Spoiler: I did not do that.&lt;/p&gt;

&lt;p&gt;I’ve copied a couple in from web.archive.org and &lt;a href=&quot;https://www.artima.com/profile/16398?t=480&amp;amp;r=15&quot;&gt;the Artima site&lt;/a&gt; which appears to have been dutifully archiving my RSS feed for nearly 15 years. Thanks, Artima!&lt;/p&gt;

&lt;p&gt;The funny thing is that you don’t know what’s historically interesting or personally important until a
bunch of time has passed. This is mostly why I almost never delete photos (or
throw the physical ones away).&lt;/p&gt;

&lt;p&gt;It makes me smile that I’ve got a (mildly cringey) post talking about how
&lt;a href=&quot;https://www.insom.me.uk/2005/02/03/ramp.html&quot;&gt;Ruby on Rails will be the next big thing&lt;/a&gt; (2005) and 11 years later I started work at (arguably) the &lt;a href=&quot;https://www.shopify.com/&quot;&gt;world’s largest Rails-powered company&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Looking back at my &lt;a href=&quot;/2014/09/21/what-you-should-read-september-2014.html&quot;&gt;link-blog posts from years ago&lt;/a&gt; lets me see the well-worn grooves in my thinking,
topics I come back to again and again like minimalism and social media addiction.&lt;/p&gt;

&lt;p&gt;Like a lot of bloggers, the first fatal blow to regular posting was Twitter. So convenient, compared to writing a whole blog post! I was an early adopter in 2007, keen advocate and heavy user but dropped off in 2015 when the level of discourse around Britain’s proposed referrendum on leaving the EU depressed me.&lt;/p&gt;

&lt;p&gt;I downloaded and kept my archive and I still sometimes refer back it (most recently: to figure out when I broke my collar bone, which &lt;em&gt;obviously&lt;/em&gt; I tweeted about from A&amp;amp;E). I’m &lt;a href=&quot;https://twitter.com/insom&quot;&gt;back on there now&lt;/a&gt;, but with retweets turned off for almost everyone, a bunch of accounts blocked, and a heavily curated list of people I follow. I delete my tweets after a couple of weeks. Having to “twitter defensively” is probably a bad sign.&lt;/p&gt;

&lt;p&gt;It’s not all Twitter’s fault though; I also started to subconsciously raise the bar for what was a good blog post. I would write a post, read it back and think “Is this adding to the public discourse? Does this need to be written?” and then just never publish it. It seemed like there was enough information in the world and adding more low quality posts was lowering the SNR.&lt;/p&gt;

&lt;p&gt;Finally, as most of what I was posting was related to my own electronics/radio/manufacturing projects, I realised that I liked making things, but then I resented writing about those things. The two were totally linked in my mind, to the point that I would avoid doing projects that wouldn’t make an interesting write-up or that were “done before”. I still think the right call was to just ditch the blogging part and carry on making things, but now I’m looking back at the last ~3 years and I feel a little sad because I made a few cool things and there’s no real record of them on my blog.&lt;/p&gt;

&lt;p&gt;(Conclusion): Blogging about blogging sucks but whatever, it’s my website. I’m not going to make some pronouncement that I’m &lt;em&gt;back&lt;/em&gt; or anything, but now that I have the whole site back in Jekyll and it’s reasonably low friction for me to post, I hope I &lt;em&gt;will&lt;/em&gt; post here more, and might even back-fill some of the stuff I’ve learned or done during my fallow years.&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;lt;3&lt;/code&gt;&lt;/p&gt;</content><author><name></name></author><summary type="html">Some stuff that I wrote about recently on tilde.town – about being inspired by seeing some modern day tumblelogs – that has lead me down a rabbit hole.</summary></entry><entry><title type="html">Building and fixing the Dreadbox Hades</title><link href="https://insom.me.uk//2018/01/01/hades.html" rel="alternate" type="text/html" title="Building and fixing the Dreadbox Hades" /><published>2018-01-01T00:00:00-05:00</published><updated>2018-01-01T00:00:00-05:00</updated><id>https://insom.me.uk//2018/01/01/hades</id><content type="html" xml:base="https://insom.me.uk//2018/01/01/hades.html">&lt;p&gt;&lt;img src=&quot;/img/hades/2017-12-31-0008.jpg&quot; alt=&quot;Finished Hades&quot; /&gt;&lt;/p&gt;

&lt;p&gt;This is a finished Dreadbox Hades DIY, a monophonic Eurorack compatible synthesizer from Greece, which was briefly available in kit form. (It’s no longer available for purchase)&lt;/p&gt;

&lt;p&gt;It was substantially more involved as a build than I expected - it didn’t ship with resistors so I used some from my stash. There’s nothing especially tricky about the build, there’s just a lot of small parts and a lot of individual solder joints. Here’s the populated board:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/hades/2017-12-31-0002.jpg&quot; alt=&quot;Populated board&quot; /&gt;&lt;/p&gt;

&lt;p&gt;The resistors and the capacitors took the most time – stuffing a board with ICs and big moving parts is a doddle in comparison.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;So, &lt;em&gt;The End&lt;/em&gt; right? I built someone elses synth kit, big deal!&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;That picture was really just the start of the most fun part of building the kit: putting it together and finding out it doesn’t quite work.&lt;/p&gt;

&lt;h3 id=&quot;control-voltage&quot;&gt;Control Voltage&lt;/h3&gt;

&lt;p&gt;I put the case on, even tightening the nuts which hold the potentiometers and jacks in place, and found that when I hooked everything up to MIDI – nothing happened. It didn’t react to MIDI notes &lt;em&gt;at all&lt;/em&gt;. This was made a little more frustrating because it was a new, cheap, MIDI-USB cable, so it could be the cable. And I’m not very familiar with MIDI routing in OSX or Linux, so it could just be user error. Luckily it was neither.&lt;/p&gt;

&lt;p&gt;The Dreadbox people &lt;a href=&quot;https://www.dreadbox-fx.com/wp-content/uploads/2017/10/HADES-diy-schematic-1.pdf&quot;&gt;make the schematic for this kit available online&lt;/a&gt;, which was a priceless debugging tool. I located the pins on the 24 pin connector that I needed to trace and got ready to test it on the oscilloscope.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/hades/cv1.png&quot; alt=&quot;CV Pins&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/hades/cv2.png&quot; alt=&quot;Glide Control&quot; /&gt;&lt;/p&gt;

&lt;p&gt;I decided to dig in, took the board out of the case and… the control voltage worked. I put it back in the case, and it didn’t. And then it sometimes worked if I pressed on the board, but sometimes it didn’t. There was clearly an intermittent connection somewhere. Either something was shorting out which shouldn’t, or a circuit was being opened where it shouldn’t.&lt;/p&gt;

&lt;p&gt;The schematic let me trace the CV to the C and D parts of the TL074 quad op-amp on the top left of the board. The signal was fine at pin 10 – running a MIDI sequence in a loop in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;seq24&lt;/code&gt; showed edges of transitions – but by the time it was output to the 1V/Octave 3.5mm jack on the board it was gone. Outside of a defective op-amp, the only really obvious component that could be at fault is the glide 1M&amp;amp;ohm; slider.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/hades/2017-12-31-0006.jpg&quot; alt=&quot;Fixed joints&quot; /&gt;&lt;/p&gt;

&lt;p&gt;I didn’t grab a photo of it, but that slider (and others!) had dry joints. It made contact, but once the case was put on the pressure on the sliders broke that contact. I’m not used to soldering big parts that need this much heat – I just went over all those joints and melted them again, adding a little more solder for good luck, and the CV issue was fixed.&lt;/p&gt;

&lt;p&gt;(These are still pretty bad solder joints, I should have melted and solder-suckered them and then started over. But this works!)&lt;/p&gt;

&lt;h3 id=&quot;no-gate&quot;&gt;No Gate&lt;/h3&gt;

&lt;p&gt;Once I was able to hear the tone changing reliably, the other issue was that neither of the two parts of the synth which &lt;em&gt;should&lt;/em&gt; be triggered by the gate signal were working. There’s a gate output on 3.5mm jack, and checking it with the oscilloscope just showed a constant DC signal. I traced back to the pin on the 24pin connector – still dead, and back to the pin on the microcontroller – working just fine! There’s only one part between the connector and the microcontroller, a 1N1007 diode. I believe that it’s there to stop an external gate source feeding back into the microcontroller. Gate voltages don’t need to be TTL, so an external gate could kill the chip.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/hades/2017-12-31-0001.jpg&quot; alt=&quot;Replaced Diode&quot; /&gt;&lt;/p&gt;

&lt;p&gt;As I wasn’t using an external gate, I bridged the diode with alligator clips (which made the gate work) and then replaced the diode with a signal diode from my spares box. It’s not an 1N1007 but that diode was &lt;em&gt;massively&lt;/em&gt; over-specified, being able to cope with 1000V and 1A of current.&lt;/p&gt;

&lt;p&gt;This fixed the the voltage controlled amplifier (VCA), but the filter (VCF) wasn’t working properly at all.&lt;/p&gt;

&lt;h3 id=&quot;filter-not-triggering&quot;&gt;Filter not triggering&lt;/h3&gt;

&lt;p&gt;&lt;img src=&quot;/img/hades/filter.png&quot; alt=&quot;Filter Schematic&quot; /&gt;&lt;/p&gt;

&lt;p&gt;This one is pretty embarassing.&lt;/p&gt;

&lt;p&gt;I traced the bias on pin 9 of the TL074 op-amp used near the gate input to the filter – the bias voltage was fine, but pin 10 showed a barely perceptible square wave on top of a wall of DC. It was like the positive input of the op-amp was really biased badly, or the positive feedback was all wrong.&lt;/p&gt;

&lt;p&gt;The construction manual for the Hades says “be careful not to mix up 1K&amp;amp;ohm; and 1M&amp;amp;ohm; resistors” and I thought, “how would you even do that?” and yet…&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/hades/2017-12-31-0003.jpg&quot; alt=&quot;Replaced Resistor&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Once I replaced this resistor with an &lt;em&gt;actual&lt;/em&gt; 1M&amp;amp;ohm; one (and not a 1K&amp;amp;ohm;) – the filter sprang into action. All fixed!&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/hades/2017-12-31-0009.jpg&quot; alt=&quot;Oscilloscope View&quot; /&gt;&lt;/p&gt;

&lt;p&gt;This is a pleasant ramp being output by the envelope generator (which is an A D/R S type).&lt;/p&gt;

&lt;h3 id=&quot;miscellaneous-bad-things-i-did&quot;&gt;Miscellaneous Bad Things I Did&lt;/h3&gt;

&lt;p&gt;I didn’t have all the right resistors in stock, so I had to either add resistors in series (R&lt;sub&gt;1&lt;/sub&gt; + R&lt;sub&gt;2&lt;/sub&gt;) or in parallel (1/R&lt;sub&gt;1&lt;/sub&gt; + 1/R&lt;sub&gt;2&lt;/sub&gt;). Look at some of the lovely stacked / joined messes that lead to:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/hades/2017-12-31-0004.jpg&quot; alt=&quot;Cosy&quot; /&gt;
&lt;img src=&quot;/img/hades/2017-12-31-0005.jpg&quot; alt=&quot;Series&quot; /&gt;&lt;/p&gt;</content><author><name></name></author><summary type="html"></summary></entry><entry><title type="html">PS/2 to USB convertor from an Arduino</title><link href="https://insom.me.uk//2017/06/28/ps2usb.html" rel="alternate" type="text/html" title="PS/2 to USB convertor from an Arduino" /><published>2017-06-28T00:00:00-04:00</published><updated>2017-06-28T00:00:00-04:00</updated><id>https://insom.me.uk//2017/06/28/ps2usb</id><content type="html" xml:base="https://insom.me.uk//2017/06/28/ps2usb.html">&lt;p&gt;&lt;img src=&quot;/img/ps2usb/keyboard.jpg&quot; alt=&quot;The Original Keyboard&quot; /&gt;&lt;/p&gt;

&lt;p&gt;I picked up a 90’s era Microsoft Ergonomic keyboard from Value Village after
Christmas 2016. The keyboard is in amazingly good condition and, of course,
it’s built like a tank. It’s actually not a mechanical keyboard, my usual
preference, but it &lt;em&gt;is&lt;/em&gt; worth saving and making useful again.
&lt;!--more--&gt;&lt;/p&gt;

&lt;hr /&gt;

&lt;h2 id=&quot;the-first-attempt&quot;&gt;The First Attempt&lt;/h2&gt;

&lt;p&gt;At the time I did have &lt;em&gt;one&lt;/em&gt; computer which actually still had a PS/2 connector
(an HP G5 from 2009-or-so). I tested the keyboard out over PS/2 and all the
keys worked. This wasn’t going to have to be a repair, just a conversion.&lt;/p&gt;

&lt;p&gt;The last time that I made a PS/2 to USB convertor, I used the excellent
[tmk_keyboard][].  That was using an ATmega32U4 microcontroller.&lt;/p&gt;

&lt;p&gt;These have
USB hardware on board (which is why they are very popular in the keyboard
hacking community) and using one to create a PS/2 adaptor is basically a case
of flashing [tmk_keyboard][] and soldering the PS/2 wires to some pins.&lt;/p&gt;

&lt;p&gt;Back then I had a depleted electronics stash: my container of stuff had arrived
from the UK but there was still a load of stuff that I had sold or given away
that I hadn’t replaced yet. I didn’t have an ATmega32U4 microcontroller. All I
had was Arduino (clones), an FTDI cable and some passive parts.&lt;/p&gt;

&lt;p&gt;Despite having very few basic parts, I did actually have a 50MHz oscilloscope,
which was a leaving present from &lt;a href=&quot;https://www.iweb.co.uk/&quot;&gt;iWeb&lt;/a&gt;, this was actually pretty useful in
diagnosing USB problems.&lt;/p&gt;

&lt;p&gt;I compiled tmk_keyboard for the ATmega328p, making sure to edit
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Makefile.vusb&lt;/code&gt; and change the CPU speed to 16MHz (it defaults to 12MHz). I
didn’t have an ATmega programmer, so I had to just upload it via the Arduino
bootloader.&lt;/p&gt;

&lt;p&gt;This meant that when the power turns on to the board there is short pause
before the microcontroller executes the convertor firmware. I think this was
one of several factors which made the convertor unreliable to the point of
useless. The other was not using quite the right diodes, and so voltages were
slightly out of specification:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/ps2usb/scope.jpg&quot; alt=&quot;Scope output&quot; /&gt;&lt;/p&gt;

&lt;p&gt;(Sometimes 3V, 3.3V or maybe up to 3.6V?)&lt;/p&gt;

&lt;p&gt;It did work, at least once:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/ps2usb/screenshot.jpg&quot; alt=&quot;Working&quot; /&gt;&lt;/p&gt;

&lt;p&gt;but you can see all of the kernel errors from failed negotiations in the
screenshot. I think, maybe, that the wiring played a part, too:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/ps2usb/clips.jpg&quot; alt=&quot;Hung together&quot; /&gt;&lt;/p&gt;

&lt;hr /&gt;

&lt;h2 id=&quot;the-second-attempt&quot;&gt;The Second Attempt&lt;/h2&gt;

&lt;p&gt;I still had the keyboard, but I got rid of the HP. I wanted to use the keyboard
with a Raspberry Pi, anyway, so PS/2 was never going to be good enough.&lt;/p&gt;

&lt;p&gt;I also had some ATmega328p TQFP parts at 0.8” pitch, and a toaster oven I
wanted to try out for reflowing. I took the schematic from the README:&lt;/p&gt;

&lt;pre&gt;
                +---+   +---------------+
USB            GND  |   |   ATmega168   |
===                 C3  |               |
5V &amp;lt;-------+--------+---|Vcc,AVCC       |        PS/2
           R1           |               |        ====
D- &amp;lt;----+--+-----R2-----|INT1        RXD|-------&amp;gt;DATA
D+ &amp;lt;----|---+----R3-----|INT0        XCK|-------&amp;gt;CLOCK
        Z1  Z2          |               |      -&amp;gt;5V
GND&amp;lt;----+---+--+--+-----|GND            |      -&amp;gt;GND
               |  |     |               |
               |  C2-+--|XTAL1          |
               |     X1 |               |
               +--C3-+--|XTAL2          |
                        +---------------+
&lt;/pre&gt;

&lt;p&gt;And I recreated it in Kicad:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/ps2usb/schematic.png&quot; alt=&quot;Schematic&quot; /&gt;&lt;/p&gt;

&lt;p&gt;And I even got as far as starting to mill the PCB before realising my mistake:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/ps2usb/pcb.png&quot; alt=&quot;PCB&quot; /&gt;&lt;/p&gt;

&lt;p&gt;(Spoiler: There is nowhere to program the chip. I omitted ICSP pins).&lt;/p&gt;

&lt;p&gt;The main missing part was an actual ATmega programmer, which is why the whole
project took six months to finish off. I was definitely going to need to
connect it somehow.&lt;/p&gt;

&lt;p&gt;So, basically I gave up on the PCB, and decided to just sacrifice an actual
Arduino clone. It’s easy to program and you can just solder it straight into
some perf-board:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/ps2usb/arduino.jpg&quot; alt=&quot;Arduino version&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Just substitute the raw ATmega pin names for the Arduino equivalents:&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;ATmega Pin Name&lt;/th&gt;
      &lt;th&gt;Arduino Pin&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;RXD&lt;/td&gt;
      &lt;td&gt;0&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;INT0&lt;/td&gt;
      &lt;td&gt;2&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;INT1&lt;/td&gt;
      &lt;td&gt;3&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;XCK&lt;/td&gt;
      &lt;td&gt;4&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;Using a USBasp clone I wrote the firmware directly, overwriting the Arduino
firmware but also getting rid of that ~1 second start-up delay which was
causing so many USB errors before.&lt;/p&gt;

&lt;p&gt;This actually worked first time, pretty unexciting stuff but I can move on with
my life with a working keyboard. The only part left was to insulate the board.
There is more than enough space inside the cavernous Microsoft keyboard case,
but it’s also got some massive metal sheets.&lt;/p&gt;

&lt;p&gt;This also had a quick fix:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/ps2usb/bag.jpg&quot; alt=&quot;Ziploc Bags&quot; /&gt;&lt;/p&gt;

&lt;p&gt;There is a lot to be said for keeping ziploc bags as quick insulation. It’s
even &lt;em&gt;more&lt;/em&gt; of a cheat that wrapping everything in heat-shrink tubing.&lt;/p&gt;</content><author><name></name></author><summary type="html"></summary></entry><entry><title type="html">Making your own private Internet</title><link href="https://insom.me.uk//2017/04/02/private-internet.html" rel="alternate" type="text/html" title="Making your own private Internet" /><published>2017-04-02T18:00:00-04:00</published><updated>2017-04-02T18:00:00-04:00</updated><id>https://insom.me.uk//2017/04/02/private-internet</id><content type="html" xml:base="https://insom.me.uk//2017/04/02/private-internet.html">&lt;p&gt;&lt;em&gt;blows dust off blog&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;It’s not that I haven’t been busy! I’ve built &lt;a href=&quot;https://twitter.com/insom/status/835978638063468546&quot;&gt;and upgraded&lt;/a&gt;, and broken, a
CNC mill. &lt;a href=&quot;https://twitter.com/insom/status/843579691604828160&quot;&gt;I’ve converted a 70’s toy to accept WiFi and speak Python&lt;/a&gt;.
I even converted another PS2 keyboard to USB .. &lt;a href=&quot;https://twitter.com/insom/status/816405430079541251&quot;&gt;kinda&lt;/a&gt;. I just haven’t
written any of it up on my blog.&lt;/p&gt;

&lt;p&gt;I knew I had to write up the even &lt;em&gt;older&lt;/em&gt; stuff about FPGAs etc., and I think
that was holding me back.&lt;/p&gt;

&lt;p&gt;This is not that post.&lt;/p&gt;

&lt;p&gt;This is a post about using &lt;a href=&quot;https://wireguard.io/&quot;&gt;WireGuard&lt;/a&gt;, &lt;a href=&quot;https://en.wikipedia.org/wiki/Virtual_Extensible_LAN&quot;&gt;VXLANs&lt;/a&gt; and Linux bridge
devices to make your own private network between hosts that can neccessarily
all talk to each other.&lt;/p&gt;

&lt;hr /&gt;

&lt;p&gt;The &lt;a href=&quot;https://www.wireguard.io/quickstart/&quot;&gt;WireGuard quickstart&lt;/a&gt; is pretty comprehensive, so I’m not going to
duplicate it here. For my part, I have five machines:&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Machine&lt;/th&gt;
      &lt;th&gt;Location&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;rho&lt;/td&gt;
      &lt;td&gt;Paris, FR&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;epsilon&lt;/td&gt;
      &lt;td&gt;Eastern US&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;vorke&lt;/td&gt;
      &lt;td&gt;Ottawa, CA&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;bob&lt;/td&gt;
      &lt;td&gt;Stafford, UK&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;pi0&lt;/td&gt;
      &lt;td&gt;Roaming&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;Rho, Epsilon and Bob have static IP addresses and are reachable from the
outside. Vorke has a dynamic IP address which is reachable from the outside.
Pi0 could be anywhere, has a dynamic IP and is usually behind NAT.&lt;/p&gt;

&lt;p&gt;I checked out the WireGuard source and built the kernel module. Because I’m a
lesson to others, I am using a mix of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;x86&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;amd64&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;armel&lt;/code&gt;. I’m also
using a mix of Debian, Ubuntu and VoidLinux, and my Paris machine is a Marvell
Armada SoC. Don’t be like me.&lt;/p&gt;

&lt;p&gt;Let’s assume that&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;cd WireGuard/src ; make ; sudo make install
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;does the right things for you. You’ll have a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;wg&lt;/code&gt; utility on your path, a new
kernel module in the directory that matches your running kernel and an
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/wireguard&lt;/code&gt; directory, waiting for a config.&lt;/p&gt;

&lt;p&gt;I changed to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/wireguard&lt;/code&gt; on each machine and generated my keys:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;wg genkey | tee privatekey | wg pubkey &amp;gt; publickey
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Then I assigned &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;10.88.88.0/24&lt;/code&gt; out of thin air. (It’s in an RFC1918 network,
so this is fine. Anything starting with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;10.&lt;/code&gt; is fair game as long as no other
network you are connected to is using it).&lt;/p&gt;

&lt;p&gt;Each machine has a config which lists the other nodes in it:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;# Rho
[Interface]
PrivateKey = REDACTED
ListenPort = 56560

# Bob
[Peer]
PublicKey  = REDACTED
AllowedIPs = 10.88.88.1/32
Endpoint   = 86.188.161.69:56560

# Epsilon
[Peer]
PublicKey  = REDACTED
AllowedIPs = 10.88.88.4/32
Endpoint = 104.196.99.86:56560

# Vorke
[Peer]
PublicKey  = REDACTED
AllowedIPs = 10.88.88.3/32

# Pi0
[Peer]
PublicKey  = REDACTED
AllowedIPs = 10.88.88.5/32
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;You don’t have to always list every node in the config, only the other nodes
that you expect that machine will talk to. For example, I’ve only put &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Pi0&lt;/code&gt; in
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Rho&lt;/code&gt;’s config, because those two machines only talk to each other via WireGuard.&lt;/p&gt;

&lt;p&gt;You’ll notice that &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Endpoint&lt;/code&gt; is only filled in for machines which are
publically reachable on a static IP. The other machines will initiate a
connection &lt;em&gt;out&lt;/em&gt; to the static ones. Once that happens, the static ones know to
use that existing UDP socket pair to talk back to them.&lt;/p&gt;

&lt;p&gt;I create and configure the WireGuard network interfaces on every machine:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;modprobe ipv6
modprobe udp_tunnel
modprobe ip6_udp_tunnel
ip link add dev wg0 type wireguard
wg setconf wg0 /etc/wireguard/config
ip link set up dev wg0
ip addr add 10.88.88.4/24 dev wg0 # pick a unique IP for each machine
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;You can verify that everything is working now by pinging from place to place.
If you’re okay with the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;wg&lt;/code&gt; kernel module making routing decisions for you,
and having to have all nodes be able to talk to all other nodes, you could stop
now.&lt;/p&gt;

&lt;hr /&gt;

&lt;p&gt;I wasn’t happy with this, and I also wanted to deal with the issue of MTU. On
&lt;em&gt;my&lt;/em&gt; network, the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;wg0&lt;/code&gt; device has an MTU of 1420. This &lt;em&gt;should&lt;/em&gt; be fine,
because we have path-MTU discovery, but we live in crappy times and between
overzealous filtering of ICMP, refusal to route fragmented packets and anycast
IPs that do the wrong thing, this will cause problems at some point.&lt;/p&gt;

&lt;p&gt;My solution for this is to run &lt;a href=&quot;https://en.wikipedia.org/wiki/Virtual_Extensible_LAN&quot;&gt;VXLANs&lt;/a&gt; over the encrypted
point-to-point tunnels that WireGuard have given us. They are effectively VLANs
which are implemented in UDP instead of at layer 2.&lt;/p&gt;

&lt;p&gt;These act more like regular network devices, their routing (and switching)
decisions work in standard ways, and I can tell the kernel to make the devices
have 1500-byte MTUs and just send fragmented packets over WireGuard. It won’t
neccessarily be efficient, but it will work.&lt;/p&gt;

&lt;p&gt;Each of these VXLANs is going to form a point to point network of their own. I
like to think of them as “virtual wires”. Or cloud Ethernet. Or something.
Given a bunch of virtual wires which connect between each other but don’t form
a complete mesh, I thought of a few ways to make this work:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Static routing over the IPs. I don’t have a &lt;em&gt;lot&lt;/em&gt; of hosts, but I have enough
for this to become annoying, and it wouldn’t provide any form of redundancy.&lt;/li&gt;
  &lt;li&gt;Use a dynamic routing protocol (like BGP). Because the hosts don’t form a
full mesh, they couldn’t live inside the same autonomous system, but I could
allocate a bunch of ASes from the test range (64512 and above).
 
This could be cool because I could join my BGP based Calico network in. It
does mean configuring some routing software (probably Quagga). I may still
revisit this, but it wasn’t what I chose to do.&lt;/li&gt;
  &lt;li&gt;Solve this at layer 2 by using Linux bridges and the &lt;a href=&quot;https://en.wikipedia.org/wiki/Spanning_Tree_Protocol&quot;&gt;spanning tree protocol&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;hr /&gt;

&lt;p&gt;Spanning tree will mean that I really can just treat these VXLANs like cables
– connect them all to a core switch, connect them to each other, and let STP
avoid switching loops.&lt;/p&gt;

&lt;p&gt;In real network gear, if you have two connections between &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Switch A&lt;/code&gt; and
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Switch B&lt;/code&gt;, you would cause a switching loop – packets going to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Switch B&lt;/code&gt;
from &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;A&lt;/code&gt; would end up going &lt;em&gt;back&lt;/em&gt; to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;A&lt;/code&gt; and then back to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;B&lt;/code&gt; and bad, bad
things would start to happen.&lt;/p&gt;

&lt;p&gt;To avoid this, when a layer 1 connection comes up on an STP enabled switch it
sends some broadcast packets called BPDUs. If it receives that packet back on
another interface, it will disable one of the two interfaces to avoid a loop.
No real traffic can flow until this process has run its course, which takes
around 30 seconds.&lt;/p&gt;

&lt;p&gt;Apart from avoiding pain when connecting network equipment together, STP also
gives you a layer of redundancy – if the active port stops sending packets,
your switch can attempt to bring the port which was disconnected (‘Blocked’ in
STP speak) into to use (‘Forwarding’).&lt;/p&gt;

&lt;p&gt;This is going to be great for my internetwork, because if one of the nodes is
unavailable then all of the rest of the nodes which have cross connects will
eventually notice and reconfigure themselves into a mostly working network.&lt;/p&gt;

&lt;p&gt;Because it doesn’t require every node to talk to every other, connections like
Pi0 – which only has one upstream connection, are treated just like an access
port on a switch. They have no redundancy, but they are considered down-stream
of which every Linux bridge they are connected to.&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;brctl addbr internet
brctl stp internet on
case $(uname -n) in
epsilon)
    ip addr add 10.99.99.4/24 dev internet
    ip link add vorke   type vxlan remote 10.88.88.3 id 1 dstport 4789
    ip link add bob     type vxlan remote 10.88.88.1 id 2 dstport 4789
    ip link add rho     type vxlan remote 10.88.88.2 id 4 dstport 4789
;;
vorke)
    ip addr add 10.99.99.3/24 dev internet
    ip link add bob     type vxlan remote 10.88.88.1 id 3 dstport 4789
    ip link add epsilon type vxlan remote 10.88.88.4 id 1 dstport 4789
    ip link add rho     type vxlan remote 10.88.88.2 id 5 dstport 4789
;;
sudo ip link set up dev internet
for i in epsilon bob vorke rho pi0; do
    ip link set up $i
    brctl addif internet $i
    ethtool -K $i tx off
done
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The above establishes VXLANs between the different hosts (only two are
included, for brevity), adds them to an STP enabled bridge and configures IPs
on the bridge devices.&lt;/p&gt;

&lt;p&gt;Because of a bug … somewhere (I suspect WireGuard) I had to disable hardware
accelerated tx checksums, that’s what the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ethtool&lt;/code&gt; line is doing.&lt;/p&gt;

&lt;hr /&gt;

&lt;h3 id=&quot;epilogue&quot;&gt;Epilogue&lt;/h3&gt;

&lt;p&gt;We can view the status of things with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;brctl showstp internet&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;EPSILON:~$ sudo brctl showstp internet
internet
 bridge id              8000.5299c5e0d97b
 designated root        8000.16500a8e632a
 root port                 1                    path cost                100
 max age                  20.00                 bridge max age            20.00
 hello time                2.00                 bridge hello time          2.00
 forward delay            15.00                 bridge forward delay      15.00
 ageing time             300.00
 hello timer               0.00                 tcn timer                  0.00
 topology change timer     0.00                 gc timer                 276.72
 flags


bob (1)
 port id                8001                    state                forwarding
 designated root        8000.16500a8e632a       path cost                100
 designated bridge      8000.16500a8e632a       message age timer         19.86
 designated port        8002                    forward delay timer        0.00
 designated cost           0                    hold timer                 0.00
 flags

rho (3)
 port id                8003                    state                  blocking
 designated root        8000.16500a8e632a       path cost                100
 designated bridge      8000.3a3bee4c8584       message age timer         19.87
 designated port        8002                    forward delay timer        0.00
 designated cost         100                    hold timer                 0.00
 flags

vorke (2)
 port id                8002                    state                  blocking
 designated root        8000.16500a8e632a       path cost                100
 designated bridge      8000.42031e2df8ce       message age timer         19.88
 designated port        8002                    forward delay timer        0.00
 designated cost         100                    hold timer                 0.00
 flags


EPSILON:~$ ping vorke.vpn.insom.me.uk
PING vorke.vpn.insom.me.uk (10.99.99.3) 56(84) bytes of data.
64 bytes from 10.99.99.3: icmp_seq=1 ttl=64 time=196 ms
64 bytes from 10.99.99.3: icmp_seq=2 ttl=64 time=196 ms
64 bytes from 10.99.99.3: icmp_seq=3 ttl=64 time=197 ms
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;You can see from the above the Epsilon (US) isn’t using its connection to
either Rho (FR) or Vorke (CA). It’s only using Bob (UK). And that means when I
use ping, even though Canada and the US share a land mass, my packets take
nearly 200ms to return: &lt;em&gt;the traffic is going over to England and back,
crossing the Atlantic twice&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;The full script for this is &lt;a href=&quot;https://gist.github.com/insom/f8e259a7bd867cdbebae81c0eaf49776&quot;&gt;available in this gist&lt;/a&gt;.&lt;/p&gt;</content><author><name></name></author><summary type="html">blows dust off blog</summary></entry><entry><title type="html">Measuring Frequency Response</title><link href="https://insom.me.uk//2016/12/27/measuring-frequency-response.html" rel="alternate" type="text/html" title="Measuring Frequency Response" /><published>2016-12-27T11:00:00-05:00</published><updated>2016-12-27T11:00:00-05:00</updated><id>https://insom.me.uk//2016/12/27/measuring-frequency-response</id><content type="html" xml:base="https://insom.me.uk//2016/12/27/measuring-frequency-response.html">&lt;p&gt;In my short electronics career, I’ve built headphone and power
amplifiers, including a valve amp, and a microphone pre-amp of &lt;a href=&quot;/journal/2016/06/09/&quot;&gt;my own
(extremely simple) design&lt;/a&gt;. I’ve modified others, too.&lt;/p&gt;

&lt;p&gt;I like the sounds of these devices to a greater or lesser degree, possibly for
pretty unscientific reasons.&lt;/p&gt;

&lt;p&gt;One thing I’ve wanted to do for a while is stick some science on it and
actually measure their frequency responses.&lt;/p&gt;

&lt;p&gt;I recently had a good excuse because I found my microphone pre-amp and I was
going to rebuild it properly and put it in a box but I &lt;em&gt;also&lt;/em&gt; found this &lt;a href=&quot;http://www.analog.com/en/products/audio-video/audio-amplifiers/micpre-amp-audio-products/ssm2019.html&quot;&gt;SSM2019
chip&lt;/a&gt; that I’d received a sample of from Analog.&lt;/p&gt;

&lt;p&gt;The SSM2019 is effectively a pre-amp on a chip, only requiring power, signal
and a 10K variable resistor to control gain. Its &lt;a href=&quot;http://www.analog.com/media/en/technical-documentation/data-sheets/SSM2019.pdf&quot;&gt;datasheet&lt;/a&gt; promises a
flat frequency response past 20KHz, which is about as good as &lt;a href=&quot;https://en.wikipedia.org/wiki/Hearing_range&quot;&gt;human hearing
range&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;There was no point in rebuilding my basic LM348N-based amp if the SSM was
going to be better and even simpler.&lt;/p&gt;

&lt;p&gt;Curiously, the LM348N &lt;a href=&quot;http://www.digikey.com/product-detail/en/texas-instruments/LM348N/296-12849-5-ND/476163&quot;&gt;doesn’t list frequency response&lt;/a&gt; on its datasheet
(as available from Digikey). I found a &lt;a href=&quot;http://eicom.ru/pdf/datasheet/Fairchild_PDFs/LM348-248/LM348-248.html&quot;&gt;Fairchild version on a Russian
website&lt;/a&gt; which suggests it falls off well before 10KHz.&lt;/p&gt;

&lt;hr /&gt;

&lt;p&gt;As a happy coincidence, Hackaday recently ran an article called &lt;a href=&quot;https://hackaday.com/2016/11/29/controlling-your-instruments-from-a-computer-doing-something-useful/&quot;&gt;“Controlling
Your Instruments From A Computer: Doing Something Useful”&lt;/a&gt;. In it, Jenny
List measured a filter she designed against the simulation (and found the real
one wanting). She used a Rigol oscilloscope for the readings and a Raspberry Pi
as a signal generator. I have both of those! This was all going to be a walk in
the park!&lt;/p&gt;

&lt;p&gt;Nope.&lt;/p&gt;

&lt;p&gt;I checked out her fork of &lt;a href=&quot;https://github.com/JennyList/LanguageSpy/tree/master/RaspberryPi/rf/freq_pi&quot;&gt;freq_pi&lt;/a&gt; and used the Rigol to verify that
GPIO4 on the Pi was outputing some very stable square waves. Then I found
it’s only &lt;a href=&quot;https://github.com/JennyList/LanguageSpy/blob/master/RaspberryPi/rf/freq_pi/freq_pi.c#L823&quot;&gt;capable of generating waves from 61KHz to 250Mhz&lt;/a&gt;. (Well, I say
&lt;em&gt;only&lt;/em&gt;. That’s incredibly useful, just not for me).&lt;/p&gt;

&lt;p&gt;It was time to completely switch tack.&lt;/p&gt;

&lt;hr /&gt;

&lt;p&gt;Last Christmas I was given an &lt;a href=&quot;https://wiki.analog.com/university/tools/m1k&quot;&gt;Analog Devices ADALM1000&lt;/a&gt;. This is a
combination two channel signal generator / oscilloscope aimed at the
educational market.&lt;/p&gt;

&lt;p&gt;The basic idea is that you build some filters or op-amp designs and have one
channel generate a signal, and then measure it with the other channel.&lt;/p&gt;

&lt;p&gt;That sounds great for testing an amplifier too, and it’s capable of generating
a sine-wave from 1Hz to 20KHz, so it perfectly matches the range I’d like to
test.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/freq/desk.jpg&quot; alt=&quot;Desk&quot; /&gt;&lt;/p&gt;

&lt;p&gt;This is everything held together with crocodile clips. This photo actually
shows me testing my &lt;a href=&quot;http://diyaudioprojects.com/Solid/12AU7-IRF510-LM317-Headamp/&quot;&gt;NP100v12&lt;/a&gt; valve amp, but the basic set up is the
same.&lt;/p&gt;

&lt;p&gt;I connected channel A to the ground and input of the pre-amp and channel B to
ground and output. I powered the amp from a 9V battery to avoid introducting
any mains hum.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/freq/scope.png&quot; alt=&quot;Scope&quot; /&gt;&lt;/p&gt;

&lt;p&gt;This is the Alice software for the ADALM1000. It’s all written in
Python and pretty hackable. It’s not as polished as the Pixelpulse
software which is also available from Analog, but once you get used to
it this software is far easier to control accurately.&lt;/p&gt;

&lt;p&gt;In this screen shot I’ve set channel A to be AWG (arbitrary waveform
generator). The shape is sine (you can’t see that, it’s hidden under the
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;shape&lt;/code&gt; menu). Input amplitude is from 0 to 0.1V, and we’re generating a 100Hz
wave as a test.&lt;/p&gt;

&lt;p&gt;Channel B is measuring voltage. It’s set to display the waveform as
well as the peak voltage (V&lt;sup&gt;max&lt;/sup&gt; – 1.01V here). Our gain (G)
here is 10.&lt;/p&gt;

&lt;p&gt;By changing the frequency I created a table of Hz vs. V&lt;sup&gt;max&lt;/sup&gt;:&lt;/p&gt;

&lt;table border=&quot;1&quot;&gt;
&lt;tr&gt;&lt;th&gt;Hz&lt;/th&gt;&lt;th&gt;V&lt;sup&gt;max&lt;/sup&gt;&lt;/th&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;10 &lt;/td&gt;&lt;td&gt; 1.03&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;50 &lt;/td&gt;&lt;td&gt; 1.03&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;100 &lt;/td&gt;&lt;td&gt; 1.01&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;500 &lt;/td&gt;&lt;td&gt;  1.005&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;1000 &lt;/td&gt;&lt;td&gt; 1.015&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;2500 &lt;/td&gt;&lt;td&gt; 1.00&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;5000 &lt;/td&gt;&lt;td&gt; 0.98&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;10000 &lt;/td&gt;&lt;td&gt; 0.92&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;15000 &lt;/td&gt;&lt;td&gt; 0.84&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;20000 &lt;/td&gt;&lt;td&gt; 0.75&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;

&lt;p&gt;This isn’t very clear, although even I can see the drop-off starting after 5000Hz.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://gist.github.com/insom/46af7810b0b4d344659e6f6984d80ffc&quot;&gt;A little Python script&lt;/a&gt; to generate a plot will help with visualising what this means.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/freq/plot.png&quot; alt=&quot;Plot&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Oh.&lt;/p&gt;

&lt;p&gt;Expect a follow up when I build the SSM2019 based pre-amp, I guess.&lt;/p&gt;</content><author><name></name></author><summary type="html">In my short electronics career, I’ve built headphone and power amplifiers, including a valve amp, and a microphone pre-amp of my own (extremely simple) design. I’ve modified others, too.</summary></entry><entry><title type="html">ESP8266 and MicroPython Temperature Logger</title><link href="https://insom.me.uk//2016/12/19/micropython-temperature-logger.html" rel="alternate" type="text/html" title="ESP8266 and MicroPython Temperature Logger" /><published>2016-12-19T11:00:00-05:00</published><updated>2016-12-19T11:00:00-05:00</updated><id>https://insom.me.uk//2016/12/19/micropython-temperature-logger</id><content type="html" xml:base="https://insom.me.uk//2016/12/19/micropython-temperature-logger.html">&lt;p&gt;My furnace is broken. Again.&lt;/p&gt;

&lt;p&gt;I have internal temperature graphs that show what’s going on, courtesy
of a BME280 Adafruit board that I bought:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/temperature/housetemp.png&quot; alt=&quot;House Temperature&quot; /&gt;&lt;/p&gt;

&lt;p&gt;You can see the slow build up to temperature, the rapid cycling at or
near the top of the cycle and when the furnace gives up and the
temperature creeps down. Oh, and by the way, it’s pretty cold out.&lt;/p&gt;

&lt;p&gt;Google reckoned it was down to -20 last night, but I honestly can’t
get my brain around a temperature like that and I always feel it’s
milder at my house than Google (or the Weather Channel) say it is.&lt;/p&gt;

&lt;p&gt;It’s time to science this up.&lt;/p&gt;

&lt;p&gt;I had actually ordered another &lt;a href=&quot;http://www.ebay.ca/itm/Atmospheric-Pressure-Sensor-Temperature-Humidity-Sensor-Breakout-BME280-/272435211880&quot;&gt;BME280 board from eBay&lt;/a&gt; more than a
month ago, at the same time as the Adafruit order from &lt;a href=&quot;https://www.buyapi.ca/&quot;&gt;BuyAPi.ca&lt;/a&gt;, and
it just showed up yesterday. What perfect timing.&lt;/p&gt;

&lt;p&gt;I already had a couple of ESP8266 boards which had arrived with my
belongings from the UK, so I &lt;a href=&quot;https://learn.adafruit.com/building-and-running-micropython-on-the-esp8266/build-firmware&quot;&gt;followed the tutorial to compile and
install MicroPython on one&lt;/a&gt;, grabbed &lt;a href=&quot;https://github.com/catdog2/mpy_bme280_esp8266&quot;&gt;this great MicroPython library&lt;/a&gt;
for the BME280 part and wired it all up.&lt;/p&gt;

&lt;p&gt;I needed to use the WebREPL server to upload both the library and my
&lt;a href=&quot;https://gist.github.com/insom/b80b13f20cc7ff6ca992f540ed288be5&quot;&gt;new boot.py file which contains all of the Python&lt;/a&gt; I had to write for
this. Basically it just sends a UDP packet to my Raspberry Pi every
few seconds.&lt;/p&gt;

&lt;p&gt;There’s a &lt;a href=&quot;https://gist.github.com/insom/b80b13f20cc7ff6ca992f540ed288be5&quot;&gt;tiny Ruby script on the Pi submitting the data&lt;/a&gt; that it
receives into Graphite, and Grafana makes the pretty graphs.&lt;/p&gt;

&lt;p&gt;I used the Xiaomi battery pack I &lt;a href=&quot;https://insom.github.io/journal/2016/06/26/&quot;&gt;blogged about before&lt;/a&gt; to power
the whole lot. As that previous post mentions, the battery pack will
turn off if there isn’t enough current being drawn. Unfortunately the
ESP8266 and the BME280 are too damned power efficient, only drawing
73mA. This is less than the 90mA that we need.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/temperature/IMG_20161219_210432.jpg&quot; alt=&quot;The Warm Unit&quot; /&gt;&lt;/p&gt;

&lt;p&gt;I added the four-200&amp;amp;ohm; resistor pack, bringing the consumption
(according to my ammeter) to 170mA total. This is wasteful but, meh,
this is a quick hack. It also gives me a nice LED to see that the
power is on.&lt;/p&gt;

&lt;p&gt;This is a useful feature because I threw the whole thing into a
transparent box to weather proof it, and now I can see if it’s on or
not without going out into the cold.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/temperature/IMG_20161218_220403.jpg&quot; alt=&quot;The Cold Unit&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Here’s the completed graph:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/temperature/outsidetemp.png&quot; alt=&quot;Outside Temperature&quot; /&gt;&lt;/p&gt;

&lt;p&gt;You can see that it took a little while for the unit to get down to
outside temperature, it dropped to -18C at the lowest point, and the
battery ran for 16 hours.&lt;/p&gt;

&lt;p&gt;The current consumption is (0.17A × 5.1V) 0.87W, so the power
should have run for ~18 hours, but given that it was -18C below, I
think it’s fair to say that the battery did pretty well.&lt;/p&gt;</content><author><name></name></author><summary type="html">My furnace is broken. Again.</summary></entry><entry><title type="html">Z80 BASIC on a Cyclone IV FPGA</title><link href="https://insom.me.uk//2016/12/13/fpga1.html" rel="alternate" type="text/html" title="Z80 BASIC on a Cyclone IV FPGA" /><published>2016-12-13T00:00:00-05:00</published><updated>2016-12-13T00:00:00-05:00</updated><id>https://insom.me.uk//2016/12/13/fpga1</id><content type="html" xml:base="https://insom.me.uk//2016/12/13/fpga1.html">&lt;p&gt;With a vague idea that FPGAs are cool and that I’d like to learn how to use them
I picked up a &lt;a href=&quot;https://www.aliexpress.com/item/xilinx-fpga-development-board-spartan6-xilinx-spartan-6-XC6SLX45-xilinx-board-xilinx-spartan-6/967529392.html&quot;&gt;cheap Cyclone IV development board&lt;/a&gt; and a &lt;a href=&quot;https://www.aliexpress.com/item/ALTERA-ByteBlaster-II-USB-Blaster-CPLD-FPGA-JTAG-Download-Cable-Win8-Linux-for-EMP240-EPM570-EP4CE6/32238799560.html&quot;&gt;knock-off Alter
USB Blaster clone&lt;/a&gt; from AliExpress.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/fpga1/fpga.jpg&quot; alt=&quot;FPGA Board&quot; /&gt;&lt;/p&gt;

&lt;p&gt;I didn’t really know what I was buying, this was simply the cheapest thing I
could find. The spec is alright, 6272 logic elements and 256K&lt;em&gt;bits&lt;/em&gt; of RAM. The
bit part is important – you’re going to construct your own RAM from IP blocks,
and the bus could be any number of bits wide.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/fpga1/chipselection.png&quot; alt=&quot;FPGA Board&quot; /&gt;&lt;/p&gt;

&lt;p&gt;The programmer is exactly like the picture, it’s Altera branded but, you know, fake.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/fpga1/jtag.jpg&quot; alt=&quot;Programmer&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Inside it’s a PIC microcontroller and &lt;a href=&quot;http://www.ti.com/lit/ds/symlink/sn74lvc244a.pdf&quot;&gt;a 74LVC244A octal buffer&lt;/a&gt;. I guess it
emulates an FTDI because when I configured OpenOCD to use it I use the FTDI
driver.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/fpga1/jtaginside.jpg&quot; alt=&quot;Programmer Guts&quot; /&gt;&lt;/p&gt;

&lt;h3 id=&quot;vhdl&quot;&gt;VHDL&lt;/h3&gt;

&lt;p&gt;There’s two major languages for FPGA development, &lt;a href=&quot;https://en.wikipedia.org/wiki/Verilog&quot;&gt;Verilog&lt;/a&gt; and &lt;a href=&quot;https://en.wikipedia.org/wiki/VHDL&quot;&gt;VHDL&lt;/a&gt;. I’m
not experienced enough to have an opinion on which is better, but the project
that I extended was already written in VHDL, so that’s what I carried on with.&lt;/p&gt;

&lt;p&gt;This is an Altera chip, so you need to use their &lt;a href=&quot;http://dl.altera.com/?edition=lite&quot;&gt;Quartus&lt;/a&gt; software. Luckily,
it’s available for Linux as well as Windows. It’s big, and you need to download
an also-very-big board support package for the Cyclone IV after installing it,
but that’s proprietary software for you.&lt;/p&gt;

&lt;p&gt;I followed &lt;a href=&quot;http://searle.hostei.com/grant/Multicomp/index.html&quot;&gt;Grant Searle’s Multicomp instructions&lt;/a&gt;, updating them for the
board that I have and the current version of Quartus.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Nothing I’ve done so far would have been possible without this excellent
resource, you should read his whole site if you’re into retrocomputing or
understanding how a microcomputer works.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;I’ve put my own &lt;a href=&quot;https://gist.github.com/insom/f837035a2034fe94c42bde58ae88ec99&quot;&gt;VHDL microcomputer definition in a commented gist&lt;/a&gt;, which
should help explain what’s going on a little better. This build is for a Z80
running BASIC and 4K of internal 8bit RAM. It has a UART (a 6850 compatible
one) and an IO device called “aaron” which I’ll explain later.&lt;/p&gt;

&lt;p&gt;In fact, my whole project file is &lt;a href=&quot;/img/fpga1/MC.zip&quot;&gt;available for download&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Quartus is as powerful as it is kind-of ugly:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/fpga1/ide.png&quot; alt=&quot;IDE&quot; /&gt;&lt;/p&gt;

&lt;p&gt;When I imported Grant’s project Quartus asked me to upgrade the IP, which I’ve
done. I regenerated the the RAM and ROM using the wizard interface, as they are
built using “off the shelf” Altera IP blocks.&lt;/p&gt;

&lt;p&gt;You just specify how much RAM you want to use, how many ports it should have
(you can have dual port RAM, useful for framebuffers) and how wide the data bus
should be.&lt;/p&gt;

&lt;p&gt;For the ROM you can see I picked 8K of 8bit words, and it’s going to have 12
address signals and 8 data signals:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/fpga1/wiz1.png&quot; alt=&quot;First Screen&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/fpga1/wiz2.png&quot; alt=&quot;Second Screen&quot; /&gt;&lt;/p&gt;

&lt;p&gt;I also had to define which pins on the chip I wanted to use for each of the
external signals – not every pin can be used for every function but it’s
surprisingly flexible:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/fpga1/chip.png&quot; alt=&quot;Pin Planner&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Congratulations! This should be all you need to synthesise your design. If you
were on Windows, you could even use the built in programmer software to upload
it, but for some reason, that didn’t work for me.&lt;/p&gt;

&lt;p&gt;Tune in next time to see how I got JTAG programming working, and for the exciting “Hello, World”.&lt;/p&gt;</content><author><name></name></author><summary type="html">With a vague idea that FPGAs are cool and that I’d like to learn how to use them I picked up a cheap Cyclone IV development board and a knock-off Alter USB Blaster clone from AliExpress.</summary></entry><entry><title type="html">Void Linux CDC Ethernet on the Raspberry Pi Zero</title><link href="https://insom.me.uk//2016/11/20/cdc-ethernet-on-pi-zero.html" rel="alternate" type="text/html" title="Void Linux CDC Ethernet on the Raspberry Pi Zero" /><published>2016-11-20T11:00:00-05:00</published><updated>2016-11-20T11:00:00-05:00</updated><id>https://insom.me.uk//2016/11/20/cdc-ethernet-on-pi-zero</id><content type="html" xml:base="https://insom.me.uk//2016/11/20/cdc-ethernet-on-pi-zero.html">&lt;p&gt;A quick howto. &lt;a href=&quot;http://www.voidlinux.eu/&quot;&gt;Void Linux&lt;/a&gt; is a minimal Linux distribution that
aggressively tracks upstream software with a rolling release model. They use
&lt;a href=&quot;http://smarden.org/runit/&quot;&gt;runit&lt;/a&gt; as their &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;init&lt;/code&gt; and have the option to use &lt;a href=&quot;https://www.musl-libc.org/&quot;&gt;musl&lt;/a&gt; as their &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;libc&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Binaries are available for x86_64 and ARM platforms, with a distribution
available for the Raspberry Pi 1 (which is close enough to the Zero).&lt;/p&gt;

&lt;p&gt;Unfortunately, it looks like the default Pi build expects you to have a console
and keyboard on the machine. As I only have a serial terminal, the first thing
that I did was set it up to print console messages to the built-in UART, and
set up a getty on &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/dev/ttyACM0&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Follow the &lt;a href=&quot;https://wiki.voidlinux.eu/Raspberry_Pi&quot;&gt;installation instructions&lt;/a&gt;, and while you have the filesystem
mounted, change &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;boot/cmdline.txt&lt;/code&gt; to:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;root=/dev/mmcblk0p2 rw rootwait console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 smsc95xx.turbo_mode=N dwc_otg.lpm_enable=0 loglevel=4 elevator=noop
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;That will take care of the boot messages. To be able to actually log in, we’re
going to need to change to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;etc/runsvdir/default&lt;/code&gt; (relative to your
mount-point, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/mnt/rootfs&lt;/code&gt; for me) and create a symbolic link to a file which
won’t actually exist for you:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;ln -sf /etc/sv/agetty-ttyAMA0
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;That’s going to make sure that a getty on ttyAMA0 loads on boot. This was
already included in the distribution, it just wasn’t enabled by default.&lt;/p&gt;

&lt;hr /&gt;

&lt;p&gt;The next step was enabling CDC Ethernet – I think that this is one of the best
features of the Zero, you can have a little computer that you plug in with a
Micro USB lead and you can SSH straight to it.&lt;/p&gt;

&lt;p&gt;To make the module load at boot time create the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;modules-load.d&lt;/code&gt; folder and
list the modules in the order that we need them (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;dwc2&lt;/code&gt; for gadget support,
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;g_ether&lt;/code&gt; for CDC Ethernet support)&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;mkdir -p etc/modules-load.d
tee etc/modules-load.d/ether.conf &amp;lt;&amp;lt; EOF
dwc2
g_ether
EOF
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Because I like the device to always get the same DHCP lease and show up as the
same network device when plugged into my laptop, I also set the host and device
addresses:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;tee etc/modprobe.d/ether.conf &amp;lt;&amp;lt; EOF
options g_ether host_addr=32:70:05:18:ff:78 dev_addr=46:10:3a:b3:af:d9
EOF
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Finally, I make sure that the Zero will DHCP for this new network device the
first time that I plug it in:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;cd etc/sv
cp -r dhcpcd-eth0 dhcpcd-usb0
ex dhcpcd-usb0/run
:%s/eth0/usb0/g
:wq
cd ../../etc/runit/runsvdir/default
rm dhcpcd
ln -sf /etc/sv/dhcpcd-usb0 # this absolute path won't exist yet
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;That’s it for the Zero, just unmount the filesystems and pop the MicroSD card
into your Raspberry Pi.&lt;/p&gt;

&lt;hr /&gt;

&lt;p&gt;I use Ubuntu on my laptop, so when I plugged in my Zero, it detected a new
network device. Select ‘Edit Connections…’ in the Network Manager applet to
reconfigure this new USB device that has shown up - you’ll want to go to ‘IPv4
Settings’ and then choose ‘Shared to other computers’. Okay your way out an
wait a few seconds for everything to catch up.&lt;/p&gt;

&lt;p&gt;The IP address of your Zero should in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/var/lib/misc/dnsmasq.leases&lt;/code&gt; – SSH in
and enjoy!&lt;/p&gt;</content><author><name></name></author><summary type="html">A quick howto. Void Linux is a minimal Linux distribution that aggressively tracks upstream software with a rolling release model. They use runit as their init and have the option to use musl as their libc.</summary></entry><entry><title type="html">Just another Arduino weather monitor</title><link href="https://insom.me.uk//2016/11/06/weather.html" rel="alternate" type="text/html" title="Just another Arduino weather monitor" /><published>2016-11-06T00:00:00-04:00</published><updated>2016-11-06T00:00:00-04:00</updated><id>https://insom.me.uk//2016/11/06/weather</id><content type="html" xml:base="https://insom.me.uk//2016/11/06/weather.html">&lt;p&gt;Just a quickie project, mostly consisting of smushing Adafruit modules and eBay
modules together in hardware, and a few choice libraries in software.&lt;/p&gt;

&lt;p&gt;I’ve moved to Canada and I have a garage with mains power. I’ve never been
through this kind of winter before, so I thought it would be interesting to log
the inside and outside temperature and outside barometric pressure.&lt;/p&gt;

&lt;p&gt;While there is power,
there’s no connectivity in the garage, so I’m following in the footsteps of
some of my friends back in England, and using a pair of Nordic nRF24 modules to
establish a reliable radio link.&lt;/p&gt;

&lt;p&gt;The source code to the whole thing is &lt;a href=&quot;https://github.com/insom/weather&quot;&gt;on GitHub&lt;/a&gt;, and it depends on the &lt;a href=&quot;https://github.com/tmrh20/RF24/&quot;&gt;RF24&lt;/a&gt; and &lt;a href=&quot;https://github.com/adafruit/Adafruit_BMP085_Unified&quot;&gt;Adafruit Sensor&lt;/a&gt; libraries.&lt;/p&gt;

&lt;p&gt;I tested my set up by starting with low power amplifier settings on the radios
and using &lt;a href=&quot;http://tmrh20.github.io/RF24/GettingStarted_8ino-example.html&quot;&gt;an example sketch provided with the library&lt;/a&gt;. It might seem like
setting power to the maximum is the best, but that also puts the most load on
your 3.3V voltage regulator, and some Arduinos and clones don’t deal well with
that.&lt;/p&gt;

&lt;p&gt;Luckily, I was able to verify that mine does, and use that. I also only
transmit at 250Kbps, which results in acceptable performance at higher ranges.&lt;/p&gt;

&lt;h4 id=&quot;sensor-node&quot;&gt;Sensor Node&lt;/h4&gt;

&lt;table border=&quot;1&quot; cellpadding=&quot;5&quot;&gt;
&lt;tr&gt;&lt;th&gt;Arduino Pin&lt;/th&gt;&lt;th&gt;BMP180 Pin&lt;/th&gt;&lt;th&gt;nRF2401+ Pin&lt;/th&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;GND&lt;/td&gt;&lt;td&gt;GND&lt;/td&gt;&lt;td&gt;GND&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;VCC&lt;/td&gt;&lt;td&gt;VCC&lt;/td&gt;&lt;td&gt;-&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;3.3&lt;/td&gt;&lt;td&gt;-&lt;/td&gt;&lt;td&gt;VCC&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;7&lt;/td&gt;&lt;td&gt;-&lt;/td&gt;&lt;td&gt;CE&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;8&lt;/td&gt;&lt;td&gt;-&lt;/td&gt;&lt;td&gt;CSN&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;11&lt;/td&gt;&lt;td&gt;-&lt;/td&gt;&lt;td&gt;MOSI&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;12&lt;/td&gt;&lt;td&gt;-&lt;/td&gt;&lt;td&gt;MISO&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;13&lt;/td&gt;&lt;td&gt;-&lt;/td&gt;&lt;td&gt;SCK&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;A4&lt;/td&gt;&lt;td&gt;SDA&lt;/td&gt;&lt;td&gt;-&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;A5&lt;/td&gt;&lt;td&gt;SCL&lt;/td&gt;&lt;td&gt;-&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;

&lt;h4 id=&quot;receiver-node&quot;&gt;Receiver Node&lt;/h4&gt;

&lt;table border=&quot;1&quot; cellpadding=&quot;5&quot;&gt;
&lt;tr&gt;&lt;th&gt;Arduino Pin&lt;/th&gt;&lt;th&gt;nRF2401+ Pin&lt;/th&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;GND&lt;/td&gt;&lt;td&gt;GND&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;3.3&lt;/td&gt;&lt;td&gt;VCC&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;7&lt;/td&gt;&lt;td&gt;CE&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;8&lt;/td&gt;&lt;td&gt;CSN&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;11&lt;/td&gt;&lt;td&gt;MOSI&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;12&lt;/td&gt;&lt;td&gt;MISO&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;13&lt;/td&gt;&lt;td&gt;SCK&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;

&lt;h4 id=&quot;reading-the-output&quot;&gt;Reading the Output&lt;/h4&gt;

&lt;p&gt;As long as the Receiver node can pick up the signal from the Sensor node, you’ll get regular data output over the USB serial:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;picocom --baud 9600 /dev/ttyUSB0
...
OHAI
P1022.41T4.30
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;That’s 1022.41 hPa and 4.30C outside.&lt;/p&gt;

&lt;p&gt;Because I have a local Graphite install, I can just send metrics to
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;127.0.0.1:2003&lt;/code&gt; with a &lt;a href=&quot;https://github.com/insom/weather/blob/master/agent.rb&quot;&gt;tiny Ruby script&lt;/a&gt;, which parses the serial output
and spits Carbon formatted data over TCP to my Graphite install.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://insm.cf/_/temperature.png&quot; alt=&quot;It's not cold ... yet&quot; /&gt;&lt;/p&gt;</content><author><name></name></author><summary type="html">Just a quickie project, mostly consisting of smushing Adafruit modules and eBay modules together in hardware, and a few choice libraries in software.</summary></entry></feed>