Simon Fell > Its just code

Saturday, October 10, 2020

After i ordered the parts, I got started on the 3D printing, there's a lot of it. There's 5 parts to be printed for each actuator. One set of parts takes about 50 hours to print. You can get these printed via a print service. But now that printers are less than $300 it's more economical to buy a printer and print them yourself. Plus as a bonus you'll have a 3D printer at the end of it.

I went with the Anycubic i3 Mega S. It's easy to assemble, just 4 bolts and you're up and running. Getting the print bed level is a PIA, but that seems to be true for all the 3D printers. The Prusa i3 and Ender printers are also popular.

One of the first things i printed was a raspberry pi case/mount so that I could setup Octoprint. This lets you control and monitor your printer from a browser, great for keeping an eye on those 12 hour prints without going out to the garage every time. I use a Sony PS Eye webcam with mine that i picked up for $15. No need to spend more than that for the webcam.

Dimensional accuracy of the prints is important, especially for the slider. Its worth spending the time on some calibration prints first. You'll also want to play close attention to the print profile in the slicer software. The prints are not strong enough with the typical default profile. I setup a custom profile that follows the recommendations. If you're confident in the calibration then go ahead and print all 4 sets. I printed one set first and test fit it to the profile before starting to print the rest.

Tuesday, October 6, 2020

If you recall from the previous post I had a sheared bolt inside the thread insert. The bolt extractor tool turned up, so lets fix that!

Drill a hole in the center of the bolt, then tap the extractor into the hole.

Now turn the extractor anti-clockwise using a tap handle, and its out!

Crisis averted!, onward. On the remaining profiles I'm going to counter sink the hole a little before installing the thread inserts, this should make getting them flush easier.

Saturday, October 3, 2020

First step in the actuator build is to install the threaded inserts into the aluminum profile. 4 Profiles, 4 inserts per end, 32 total.

As mentioned in the ordering post, I brought my aluminum profile from a fellow iRacer. They didn't however have the matching thread inserts that kinetic sells. I wasn't able to find these from anywhere, and ended up with some different ones, just to keep things interesting.

Kinetic insert left, inserts I ended up with on the right. Note that the Kinetic insert has a nice shoulder that helps keep things square when inserting them. Another nice thing about the Kinetic insert is that it has an internal hex, allowing it to be installed with an allen wrench. The info for my inserts mention a specific insertion tool, but i couldn't find anywhere selling them. The insertion tool though is basically a threaded shaft with a nut on it, I made my own with an M8 bolt and nut.

The inserts claim to be self tapping, but have no leading taper, making them very hard to get started. I ended up using a M12 tap in the profile to cut a starting thread that the insert can then use.

2 down, 30 to go, ughh, these are a lot of work. First tapping the aluminum, then the installing the insert. I tried using my battery impact driver, but it didn't have the torque needed to install the insert. One internet order later, i tried a larger AC powered impact driver. That had way to much torque, it mostly ended up stripping the threads on the bolt rather than inserting the insert.

One more internet order later i had a much longer wrench, and one with a built in ratchet end. This made installing the inserts by hand much less work. But that longer leverage means more torque, combine that with the damage done earlier with the impact driver and bingo, one snapped bolt, arrrrgggggghhh.

At this point I've spent a week on this and gotten a grand total of 7 installed inserts. One with a broken bolt stuck in it. One more internet order. when the bolt extract tool turns up this adventure will continue.

Thursday, October 1, 2020

The SFX-100 is an open source/DIY motion actuator for use with racing or flight simulators. I've been enjoying iRacing this year, and thought this would a fun project to work on.

Step 0 is to order everything, there's parts needed from a number of different suppliers, and some of these take weeks or even a month or two to be delivered. The original project parts list is heavy on european suppliers, reflecting where all the development was done. This post on Race Department details better options for US based folks.

I had no issues ordering from ntl bearing or Master Jiangs store on aliexpress, those parts turned up in a couple of weeks. ntl-bearings also now can supply the servo & drives, if you want to cut down the number of different places to order from.

The big lead time is the aluminum profiles from Kinetic, they're a B2B supplier and not set up for lots of little consumer orders. Reports are that it can take 1-2 months for those orders to turn up in the US. I lucked out, someone on the iRacing forums was selling a set of the profiles after decided not to do the build. I purchased those and had them in a week.

These are the main parts, the rest is a laundry list of bits and pieces, all easily available.

While waiting for everything to turn up, its a good time to get started on the 3D printing, there's a lot of it needed.

Saturday, January 19, 2019

I recently got a new power amp for my hifi setup, and it has a 12v trigger input. The trigger input allows for an external signal to turn the amplifer on or off. Its usually connected to a central item so that everything can turned on/off together. I also use Roon, which is a great network music player.

While remembering to turn the amp on is not a problem, remembering to turn it off can be a problem for various reasons. I thought it'd be a fun little project to use the Roon API to have the amp turn on automatically when roon starts playing, and to have it automatically turn off in the evening.

I hatched a plan, using the Sparkfun Thing board, this is a little Wifi enabled processor that has some basic I/O pins and can be programmed using the Arduino software.

  • A node app using the roon api listens for state changes in a particular output zone.
  • It sends a TCP message over Wifi to the Thing board which turns a relay on.
  • The relay is inline in the trigger connection from the preamp to the power amp.
  • At a particular time of day, the node app sends the message to turn the relay off.

The Hardware

I used the Sparkfun Thing Dev Board and a Relay Kit. The actual relay in the kit is overkill for this use case of switching a low current low voltage signal, but it'll work fine.

First up, build the relay kit, the sparkfun instructions are clear & detailed, and its an easy build for anyone who's used a soldering iron before.

Next up, I used a breadboard to connect the relay board to the Thing board, the Thing board conviently has 5v & ground pins you can use to power the relay board, and I connected Thing's GPIO pin 4 to the control input on the relay board.

After testing with the software, I installed the 2 boards in a little box and connected a pair of mono 3.5mm jacks to the relay switch.

Thing Software

You can program the Thing using the Arduino IDE over USB, simple!. What we need for this is to join the Wifi network, listen on a TCP port, read messages from a client and turn pin 4 on or off.

I used a simple 4 byte TCP message format that supported 3 request messages, STAT, UON & UOFF, which return the current state, turn the output on and turn the ouput off.

The core loop ends up looking like

        void loop() {
          // Check if a client has connected
          WiFiClient client = server.available();
          if (!client) {
          // Wait til there's a 4 byte message ready
          while (client.available() < 4) {
          uint8_t buff[4];
          int x =, 4);
          if (buff[0] == 'S' && buff[1] == 'T' && buff[2] == 'A' && buff[3] == 'T') {
              int state = digitalRead(RELAY_PIN);
              client.print(state == HIGH ?"ON  \n": "OFF \n");

          } else if (buff[0] == 'U' && buff[1] == 'O' && buff[2] == 'N') {
              digitalWrite(RELAY_PIN, HIGH);
              client.print("ON  \n");

          } else if (buff[0] == 'U' && buff[1] == 'O' && buff[2] == 'F' && buff[3] == 'F') {
              digitalWrite(RELAY_PIN, LOW);
              client.print("OFF \n");

Roon API Software

The Roon API ships as a node.js based library. Our code is pretty straightforward
  • Do a dance to connect to a Roon server.
  • Listen for zone state changes for a particular zone.
  • If the zone started playing send the 'UON ' message to the thing endpoint.
  • At a certain time of day, send the 'UOFF' message to the thing endpoint.
Sending a TCP message is easy enough from node.js,
    var client = new net.Socket();    
    client.connect(triggerPort, triggerHost, function() {
        // Write a message to the socket as soon as the client is connected, the server will receive it as message from the client 

    // Add a 'data' event handler for the client socket
    // data is what the server sent to this socket
    client.on('data', function(data) {
        console.log('TRIGGER SAID: ' + data.slice(0,4));
        // Close the client socket completely
You need somewhere you can leave this running, I run it on the Raspberry Pi I have that runs pihole.


This was a fun little project, and a nice change of scenery from my day job. The Thing is a great little board for building integrations like this. The full code for both the Thing & the Roon integration is available on Github.

Saturday, December 15, 2018

Site has moved to a new webhost and has been migrated from ASP.NET 1.1 (!) to being generated with Hugo. It now supports TLS & HTTP 2.0. Along the way I dropped the RSS & Atom feeds, nothing updates often enough that constantly polling is worth it.

Let me know if you see any problems. And yes this is my bi-annual blog post.

Tuesday, January 12, 2016

2016 is the year you find out how well you understand all the integrations & API usage you have against the salesforce API. There are 2 changes being made in 2016 that will impact a lot of integrations & API clients.

API retirement for hosted the original API login service, many years ago a dedicated login service was hosted at Starting in 2016 the login service running at is going to be disabled..

Disablement of TLS 1.0

Support for TLS 1.0 is being disabled, this will affect many HTTPS client libraries, especially those that are not upto date, or don't get their TLS/SSL support directly from the host OS.

Impact for Beatbox

Beatbox is a python library i wrote for accessing the API. If you have integrations built using Beatbox you need to carefully review your python environment in order not to be impacted. Support for TLS 1.1 & TLS 1.2 requires python 2.7.9 (or later) and OpenSSL 1.0.1 (or later). If you're running on older versions that this, when TLS 1.0 is disabled, your integration will stop working!. Note that if you're on OS X, the bundled version of OpenSSL is 0.9.8 and needs to be upgraded to continue to work. There is more info in the readme about this. Beatbox was updated in 2010 to start using instead of for logins, so if you're beatbox version is older than that, you'll need to update to a new version (or update your usage to explicitly set serverUrl before calling login)

Impact for ZKSforce

ZKSforce is a library for iOS & OSX to call the salesforce API. It gets its HTTPS support via the cocoa NSURLRequest class, which is part of the OS. All recent versions of iOS & OS X have support for TLS 1.2 and you shouldn't have any issues related to the TLS 1.0 disablement. However ZKSforce by default sends login requests to unless you have a version from Sept 2015 or later. You can either upgrade to the latest version of ZKSforce or explicitly set the auth server before calling login, e.g.
[client setLoginProtocolAndHost:@""]

Tuesday, December 3, 2013

There's a big update to zkSforce available, it now supports the entire v29 Partner API, all the new calls, soap headers etc. Also there are aysnc/blocks versions available of all the API calls, so you can safely make soap calls on a background thread and not block the UI.

The update is mostly driven from a new tool I wrote which generates code from the WSDL, so as new WSDLs get released keeping zkSforce unto date will be easier. (note you don't need to use this tool, just add zkSforce to your project as usual and off you go). This move to generated code means there are a number of minor changes from previous versions that you might need to address if you update to the latest version, check the read me for all the details.

If you try it out, let me know how you get on.

Thursday, October 25, 2012

SF3 was one of the first OSX/Salesforce tools I wrote, made possible by an API in OSX called Sync Services. With the release of OSX 10.8 (aka Mountain Lion) Apple officially deprecated the Sync Services API (and its future was in doubt for a quite a while prior to that). With this news the future for SF3 is that it doesn't have any future, there is no new API that replaces the functionality of Sync Services. There are APIs to talk to both Address Book and iCal, but without the sync engine piece an app that wanted to sync data between those apps and a 3rd party is going to have to build the entire sync/match/change log functionality itself, a big job. Its possible that exposing the salesforce data using CalDav and CardDav might make it usable from OSX, but I haven't had time to investigate that in any detail.

Thursday, September 6, 2012

Easy to digest venn diagram explaining everything thats wrong with the typical metrics used in software engineering.

Friday, March 2, 2012

For quite a while now you've been able to make HTTP requests from Apex to other services, this was aimed at integrations for structured data, xml or json, and so would deal with strings. This made life easier if you were actually doing xml or json, but makes life difficult to impossible if you were trying to deal with binary data. In the recent Spring release this is fixed, and you can now work with binary data (blobs in apex) directly in the http request or response. Here's an example of making a HTTP GET request for an image PNG file, and saving it to the document object in salesforce

HttpRequest r = new HttpRequest();
Http http = new Http();
HttpResponse res = http.send(r);
blob image = res.getBodyAsBlob();

Document d = new Document(); = 'logo.png';
d.body = image;
d.folderId = UserInfo.getUserId();
insert d;

(Yes, this may well be my one blog post for this year)

Friday, February 18, 2011

Hudson is a popular continuous integration build server, I've been working on a plugin for it that will post build notifications to chatter. The plugin is configurable, so that it can post updates to its own wall, to a specific group (perhaps the project team that owns the build), or to a specific data record (perhaps you have a custom object that represents a build).

You can grab the source and a prebuilt plugin binary from the projects home page on github.

Monday, June 7, 2010

ZKSforce is the Cocoa library i wrote to make it easier to access the API from Cocoa / Objective-C. I just posted a new version that uses the v19 API, and has switched out its use of NSXML & NSCalendarDate with libxml & NSDate and so is now compatible with both OSX and iPhone based projects. (iPhone OS 3.2 and up should be good).

Monday, June 7, 2010

The Applescript Connector for allows you to write applescript that can interact with the API, login, create, update & delete data, run queries, retrieve your scherma's metadata all from Applescript. Now you can more easily integrate with your OSX desktop and applications.

Friday, May 14, 2010

A friend recently turned me onto Instaviz, a great iPhone / iPad diagraming tool based on graphviz. Graphviz lets you define your diagram as a set of nodes and connections, and it will perform the layout for you. I have something of an interest in being able to visualize your schema, and some lines of python code later, i had something that would generate a graphviz description of your schema, starting from a primary object, and with the option to go 1 or more levels deep from there. Here's an example for Opportunity, just 1 level deep. (click for full size version)

And here's the generated oppty.gv file that produces that graph. If you have Instaviz or one of the desktop viewers for graphviz, you can open the .gv file directly in those apps. (and/or you can use the commandline tools to generate a png or other formats).

Here's the actual python code, it uses beatbox to call the describeSObject API to discover the schema for your login. You run it as

python mypassword Opportunity > oppty.gv

Here's an even larger model that's 5 levels deep from Account - png rendering (ouch its 6MB), gv (33k)