Seb Lee-Delisle

Menu

Calling all speakers! A hardware button to toggle display mirroring

I’ve been really frustrated that my favourite keyboard shortcut to toggle display mirroring doesn’t work on TouchBar MacBooksso I’ve made a button that can emulate it!

Of course since I’ve got this working I’ve discovered there’s a weird work-around to get it working on the TouchBar, but it’s still quite a fun device, and you could use it to emulate any key (missing that Escape key, anyone?)

What you need :

That’s it! It should be way less than $20. You’ll also need a soldering iron.

Solder the switch to the Trinket as in the pictures – you’ll need to break one of the legs off.


Then you’ll need to install the Arduino IDE, and add the Adafruit boards. Checkout Adafruit’s brilliant guide to installing the Arduino IDE for their boards.

Download the code from the Cmd-f1-emulator repository on GitHub.

In the Arduino IDE, open the preferences and change the sketchbook folder to be the ‘Arduino’ folder inside the repository that you just downloaded. Restart the IDE, and then open the file CmdF1Emulator from the sketchbook. Make sure that the correct board and programmer are selected (Adafruit Trinket 8Mhz and USBTinyISP, respectively – check the instructions on working with the Trinket on Adafruit if you’re new to this).

Press the reset button on the Trinket and upload the code to it.

It should now work! It uses the Keyboard Trinket code provided by Adafruit, although I had to adapt it – apparently the Mac doesn’t act on the keyboard shortcut unless it thinks it’s made by Apple. That was a day wasted trying to figure that out! I adapted the Keyboard Trinket library to provide an Apple USB device ID to fool your computer into thinking it’s an Apple keyboard.

Ideally you should really put it in some kind of case – maybe just wrap it in Sugru? Or else there are some Trinket cases on Thingiverse you could check out.

Let me know if you decide to make this simple project and how you get along!

Posted in Speaking | Comments Off on Calling all speakers! A hardware button to toggle display mirroring

Keyboard shortcut for “Mirror Displays” on Touchbar MacBook

It’s kind of a niche requirement but very important for someone like me who has does presentations with keynote split on two screens to running demos that need to be mirrored.

It was always Cmd-F1 on any non-touchbar equipped Mac, but sadly that stopped working on the new Macs, even if you hit the fn key to make the function keys appear.

I went as far as creating a hardware keyboard emulator, before I discovered this software solution (thanks Anders Anker!).

Step one :
In Keyboard Preferences, select Press Fn key to Expand Control Strip

Step two :
Hit Fn-Cmd and the decrease brightness button on the touchbar.

That’s it!

If you’re interested, here’s the post with full instructions on how to make the hardware version.

Posted in Uncategorized | Comments Off on Keyboard shortcut for “Mirror Displays” on Touchbar MacBook

Fading LEDs with PWM on all pins with Pi Zero & Node.js

ezgif.com-optimize

I’ve been converting my ST4i workshop from Arduino to Node.js/Raspberry Pi and one of limitations is a lack of built-in PWM pins. PWM or Pulse Width Modulation can be used to fade LEDs up and down rather than just turn them on and off. If you’re new to PWM, here’s a full explanation at Sparkfun.

On the Pi Zero, you can only enable 2 hardware PWM pins at one time, and the library I’m using to control the GPIO pins doesn’t support PWM at all! (The ubiquitous onoff node module).

After a bit of searching, I found the pigpio Node.js module, and this, in turn is a wrapper for the Pigpio C library.

As far as I can tell, it manages the PWM duty cycle in software, so it’s not as performant as the built-in hardware PWM pins, but as it’s written in C I’m sure it’s fast and certainly my experience so far suggests it’s super smooth.

If you want to try it for yourself, follow the instructions on the github page. I had a slight amount of weirdness, it didn’t seem to install straight away, but I deleted everything and started again and it seemed better.

I also had another problem – somehow I had started the pigpiod daemon and this clashed with the Node.js module code. Either the installer for pigpio did it or else I ran in manually while trying to get things running. sudo killall pigpiod should sort it out.

And a final thing to look out for – if you have node 0.10.29 on your Raspberry Pi (the version that comes with Raspbian Jesse) you’ll have a problem running any Node.js module that uses Nan, the native addon library. I first encountered this when I updated the LED matrix library to work with newer versions of Node.js, but it’s simple enough to fix. See this thread on github for solutions.

Once you have it installed you can do PWM output on any GPIO pin, here’s a set up for 9 LEDs like in the image above.

9 Leds on a Raspberry Pi

You can then use this code to get the nice pulsing effect in the animation.

 
var Gpio = require('pigpio').Gpio; 
 
// change these to match your LED GPIO pins : 
var ledPins = [21,20,16,12,26,19,13,6,5]; 
 
var leds = [];
 
// initialise all the pins
for (var i = 0; i<ledPins.length; i++) { 
	var led = new Gpio(ledPins[i], {mode: Gpio.OUTPUT});    
	leds.push(led);
}
 
// get a loop running 60 times a second (1000/60 = 16.6)
setInterval(loop, 16); 
 
function loop() { 
 
	for(var i = 0; i<leds.length; i++) { 
 
		var led = leds[i]; 
		// calculate a sin wave for brightness dependent on time and 
		// position in the row of LEDs
		var brightness = Math.sin(((Date.now()/16)+(i*5))*0.2)*0.5 + 0.5; 
		// a quick way to do a cubic ease in - it means the LEDs get brighter
		// slower. It compensates for the fact that LEDs get bright quick. 
		brightness*=brightness*brightness; 
		// the pigpio library complains if you send it a floating point number
		// so we have to round it down.
		brightness = Math.floor(brightness*255);
		led.pwmWrite(brightness);
	}	
 
}

Note the issue with sending floating point numbers – I’m surprised that this isn’t handled at the other end but it’s easy enough to fix with a Math.floor.

And also notice how I’m using cubic easing to smooth out the brightness curve on the LEDs.

You can also use the pigpio library to control hobby servo motors. That’s what I’ll be doing next!

More about my ST4i workshops.

Posted in Node.js, Raspberry Pi, ST4I | 2 Comments

Controlling 7 segment LED displays on Raspberry Pi with Node.js

As part of the preparation for my upcoming workshops (last two tickets left!) , I’ve been working on writing Node.js code to drive various bits of hardware that are included in the free kit that comes with the course. So I’ve made my first ever npm package! And it drives cute LED displays running on the MAX7219 chip.

In particular, there are two little LED displays that I really love. One is an 8 x 8 LED matrix, and the other is an 8 character 7 segment display. (The ‘7 segment’ refers to the arrangement of LEDs that makes up the number shape – think of the displays on the Delorean time-machine dashboard).

They’re both driven by the same chip, the MAX7219, which can drive 64 LEDs, so perfect for both of these displays, and you can actually daisy chain up to 8 of them together and run them from the same pins. There is already a Node.js library that can run these, and it works fine (MAX7219) – it’s geared towards the 7 segment display and it works with the native SPI device on the Raspberry Pi.

But it is possible to run a MAX7219 chip without using the SPI device. You can ‘bit-bang’ the GPIOs – this is a way of sending digital data out of pins manually by setting them to high or low for each bit. It’s probably more performant to use the native SPI device but this method is perfectly fast enough for most applications, can be connected to any pins, can have multiple outputs, and is simpler to set up (as you don’t have to enable the SPI device on the Raspberry Pi).

[UPDATE – I just found this post with more about how bit-banging the MAX7219 works]

I’ve also implemented a few other fun features :

  • Display a number on the 7 segment display, with a fixed number of decimal places and leading zeros
  • A full alphabet – send it any alpha-numeric character and the library will do its best to represent it (obviously m’s and w’s are a bit crap ūüôā )
  • Set a specific led at x and y coordinate of the 8 x 8 matrix – for fun graphics output

It’s based on the Arduino LedControl library so much of the API is similar, but it’s currently in a very early state so expect the API to change.

See the github page for more details.

Posted in Node.js, Raspberry Pi, ST4I | Comments Off on Controlling 7 segment LED displays on Raspberry Pi with Node.js

Upgrading a node module that wraps C code

Today I wanted to get this ultra-thin LED matrix working with Raspberry Pi in NodeJS as part of my work on my new ST4i workshop.

Ultrathin RGB Matrix_02

The SeeedStudio Ultrathin Red LED matrix.

It’s such a nice bright matrix, I really love it, but they’re a little weird to work with. They use the HUB75 protocol which scans across the screen doing a few pixels at a time, so they tend to look super flickery on a standard slow Arduino. But there’s this C++ library for Raspberry Pi that is way faster and some nice person has wrapped it in a Node.js module.

Although I got the C++ code working, I couldn’t install the Node module – the compilation process failed. After some exploration, I realised that the module was designed for older versions of Node (I think a maximum of 0.12.0) and I’m running 5.4.1.

I tried to revert my Node version with n but that seemed temperamental on the Raspberry Pi ARM versions of node. I couldn’t get it working, and it didn’t feel right to switch Node versions if I didn’t have to.

So plan B – I set to work updating the node module. There’s lots of documentation on how to wrap C++ code into Node addons and I have to admit, it’s pretty intense! At least for me, as I haven’t really got much experience of the V8 engine.

But I figured it out – the main issues were how objects are passed back and forth between the JavaScript and C++. It works! But sadly I think it’s probably broken in older versions.

I really should use the Native Abstractions which is a way to wrap C++ code that will remain compatible with past and future versions of Node.js, but one thing at a time. I’ll take a look at that next.

[UPDATE here’s a link to my fork of the repo]

[UPDATE 2 Now rewritten to work with Nan! So is hopefully good for Node.js versions 0.8, 0.10, 0.12, 4 and 5. here’s a link to my fork of the repo, pull request pending.]

[UPDATE 3 My pull request has been accepted and the main repo is now updated.]

In the meantime, enjoy the particles!

Posted in javascript, Node.js, Raspberry Pi, ST4I | Comments Off on Upgrading a node module that wraps C code

Review of 2015 – the year of electronics

2015 has gone by in a blur – at first I couldn’t remember the details of what I did. There have been so many different threads and distractions that it occasionally felt like I didn’t accomplish much. But now I’ve looked back at my calendar I’ve realised that there was actually a lot going on. In fact it’s taken until mid-way through January to compile it all together!

Electronics

Synth Prototype1

If 2014 was the year of the laser, I’d say that 2015¬†was the year of electronics. Following on from my¬†LED emblazoned Light Synths I continued to develop my skills, working on a wide variety of different electronics projects and workshops.

ST4i

IMG_5341_sml

The year was off to a flying start with my Internet of Things¬†workshops, or ST4i, as I cheekily prefer to call it. Three sell out workshops in Brighton, followed by more in Amsterdam, London and Dusseldorf. It’s been really great to share the electronics stuff I’ve learned and connect little prototypes to the internet. I loved it, and thankfully the participants seemed to really enjoy it too.

In February, I wrote an in-depth article for net magazine all about ST4i, giving an overview of all the various platforms and devices. This stuff moves so fast that it may be a little out of date, but you can see it here – How to Build Cool Stuff for the Internet of Things.

And then in June, I was invited to speak about IoT on Radio4. It was a fun segment on “You and Yours” (from 18:50 onwards) and we all had a knowing laugh about the internet fridge again. Fun times!

I’ll be updating the ST4i workshops with a brand new version with a really exciting twist. Join the mailing list if you want to be the first to hear about the new workshops.

Collaborations

In February I spent a week with choreographer Tim Casson on a series of experiments involving live audience interaction with dancers. I have a very sedentary lifestyle, so it’s really wonderful to work with a group of talented dancers so good at expressing themselves with their physicality. Tim’s a really nice guy, and I’m sure we’ll be continuing this R&D into 2016. You can watch this little chat we had on youtube about our work together for South East Dance in August.

spoontesting2The “Get Enough” Robot Spoon by Dominic Wilcox

In June I worked with my artist-inventor friend Dominic Wilcox on a series of crazy breakfast related inventions for Kelloggs. I completed the electronic elements for 2 or 3 of his crazy ideas, including the Soggyometer and the “Get Enough” Robot Spoon (I’m particularly proud of the expressive eye animation).

Working with Dominic was a real pleasure and delight – I hope I get the chance to work with him again in the future.

More electronics, servo motors and 3D printers

In other electronics side projects I worked on a vending machine with multi-coloured LEDs for the hackspace, my office lighting, with adjustable daylight LEDs and a weather station reader.

One of the larger things I worked on was a highly controllable servo motor for a 3D printer extruder. Servo motors are complicated, and I really need to write a few posts to document that project. Suffice it to say that it took several weeks to fully understand and program brushless DC servos but in the end, I managed to get a prototype extruder working perfectly.

IMG_0023The servo powered extruder on the Delta One 3D printer prototype

The main benefit of using brushless DC servos on an extruder rather than the traditional stepper motor is weight. You can make a very lightweight direct drive extruder on the print head that is more powerful than a large stepper motor.

This has been for an ongoing project of Paul Strotten, the engineer I’ve worked with over the last 3 years. He’s been designing and building his 3D printer for a year or two now. The idea is to bring it to market but progress comes in fits and starts. But I think the servo drive hardware could be useful for people outside of that, so I really need to work that up into an open source hardware project this year.

Lasers

Of course my obsession with lasers is continuing, with three more laser shows for Smashing Conference in Oxford, LA and New York, each progressively becoming more interactive. And again working with Val Head on the animations and laser help from Paul Hayes. The NY edition was on Broadway, and projected onto the Avenue Q set, and the LA show had anaglyphic red/blue 3D.

IMG_0279
ofxLaser in action

In the summer I started work on releasing my laser control code into a reusable library for openFrameworks РofxLaser. It takes care of drawing laser shapes, optimising the path of the beam, calibrating the colour balance, amongst other things.

My friends Tangible Interaction in Vancouver used¬†it¬†for a wonderful participatory laser animation installation ANIMA.¬†¬†I’ll be continuing to refine¬†the addon throughout 2016.

Oh and I finally got qualified – my laser safety training certificate was issued in September.

Money

I know it’s very un-British to talk about money, but financial extremes played such a big part of 2015 I can’t really ignore it.

The year started with an unexpected tax bill of £25k! The result of some very poor financial planning; I had made made some money which I then used up developing Laser Light Synths which fell in the next tax year РI was paying tax on profit that I no longer had.

I fired my accountant, managed to get the bill down to ¬£15k and took out a loan to pay it off, but the monthly repayments were a huge burden. I’m very thankful that the ST4i workshops were such a great success, they pretty much single handedly helped me to keep my head above water in that time.

And then the second half of the year was pretty much the opposite. A couple of years ago when Jenny and I moved to a new flat, we managed to keep hold of the old one, which I rented to my brother. Since then, property prices went up considerably so it made sense to sell the flat.

It was a huge relief to be able to pay off all our debts and keep some money in the bank. And knowing I have a safety net in case of bad cashflow is a massive luxury. Of course I should really put that money in our current mortgage…

Although I greatly benefitted from the situation, it highlighted to me how unfair the financial system is in this country. If you have money you can make more money, pretty much out of thin air. I’m greatly concerned about the inequality of the distribution of wealth, although I’m not entirely sure what to do about it. But that’s a story for another time.

PixelPyros & Laser Light Synths

IMG_0143PixelPyros crew rigging the massive screen
After a break in 2014, PixelPyros had two outings in 2015, at Media City in Salford, and at the Arts By the Sea festival in Bournemouth. It was good to revisit the project, and we had a few more pixels to play with thanks to a pair of upgraded projectors.
IMG_9663Laser Lights Synths at dConstruct
Laser Light Synths had a couple of successful mini-outings at dConstruct and the Brighton Mini Maker Fair.

If you’re interested in booking either of these projects for your event in 2016, please get in touch. [email protected]

Conferences

CSO19XcXAAAEJeGMotivational speaking at its finest

Not quite as many conferences as previous years, but still plenty to be getting on with. I travelled to York, Shropshire, Amsterdam, Trondheim in Norway, and there were a few in London, mostly opening or closing keynotes.

Diversity scholarship

I ended the year with a CreativeJS workshop in Brighton, and inspired by Remy and Julie, I set up a diversity scholarship to encourage under-represented groups in our industry to attend. I was astonished to get applications from all around the world, and I wish I could have given every applicant a place. It was possibly the most diverse workshop that I’ve ever run and that made it a better experience for me, and hopefully everyone else.

What’s in store for 2016?

Good question! I’m currently taking some time to prioritise all the various strands to my career. My priority is the new ST4i workshop and that’ll be up and running very shortly.

Other than that I have a lot of options. Laser Light Synths needs more work, so I could apply for a grant to take that on tour (like I did with PixelPyros in 2013). Both that and PixelPyros could do with a more co-ordinated marketing push.

And I’m embarrassed about how little I’ve blogged, and I really need to document my projects better. I’m working on a new website, and maybe that’ll give me the impetus I require. I really need to give back more, both in documentation and in my open source projects, and I hope to do better this year.

I feel like maybe my career is in a bit of a transition but between which states? Well either way, it’s a fun ride. I consider myself exceptionally lucky and privileged to have this lifestyle and the chance to pursue almost any interest I want. Here’s to 2016!

Posted in Annual Review | 1 Comment

CreativeJS Graphics and Animation workshop in December

JavaScript 3D pixels

It’s been a busy year but I’ve managed to squeeze in one last CreativeJS workshop on the 9th and 10th December in Brighton. It’s a two day course based in Clearleft’s fantastic HQ on Middle Street. Tickets go on sale on Friday at 11am and start at ¬£499, or ¬£399 for freelancers.

And in case you missed it yesterday, for the first time I’m offering diversity scholarships which cover the workshop cost and up to ¬£300 each for travel and accommodation. Please share this link with anyone who might be interested in applying.

Posted in Training Courses | Comments Off on CreativeJS Graphics and Animation workshop in December

CreativeJS workshop diversity scholarships

UPDATE : Please note – applications have now closed

My CreativeJS workshop returns to Brighton on the 9th and 10th December, and (inspired by Remy and Julie) I’ll be offering 2 diversity scholarship places.

Diversity in tech is something I care deeply about, and although the problem won’t be solved overnight, this small gesture is a step in the right direction. Although this may not be relevant to you personally, you can still play an important part by passing this on help find others who may benefit from the scholarships.

What are the scholarships?

Scholarships are available for anyone in an under-represented group in tech. This includes (but is not limited to): people of colour, LGBTQIA+ people, women and disabled people.

I have 2 scholarships places which include the cost of the two day workshop, and up to £300 (per scholarship) towards the cost of travel and accommodation.

More information about the workshop.

How to apply

Please answer the following questions and email me. You don’t have to explain your personal situation (but you can of course, if you want to).

Who are you?
Where would you be travelling from (airport or city)?
What do you do?
Why should you get a scholarship?

Please note that your email will be treated with the utmost privacy, and we will not publicly announce who the diversity scholarships go to (though you’re welcome to say so yourself).

Deadline for applications: Friday 20th November, 2015.

Acknowledgements

I’ve taken most of the copy from Remy, who in turn was inspired by SassConf and OTSConf.

Again, if this doesn’t apply to you, please please can you pass on the message and reach out to anyone you know that might benefit from one of these scholarship places.

Posted in Uncategorized | 1 Comment

Upcoming ST4i and CreativeJS workshops

ST4i Amsterdam, second batch of tickets on Tuesday, and 2 UK CreativeJS workshops on sale now.

CreativeJS workshop

There’s no let up this year as the first batch of ST4i Amsterdam workshop tickets sold out in 10 minutes, but don’t worry – the next batch will go on sale Tuesday morning 11am local time. If you want a reminder, register your interest and I’ll send you an email.

But if you’re worrying that I might have ditched my CreativeJS series about graphics and animation in JavaScript, let me reassure you – I have 2 workshops coming up, both connected to conferences.

19th March CreativeJS Oxford (as part of Smashing Conference)
8th April CreativeJS York (as part of DotYork conference)

Both conferences are worth attending in their own right so be sure to check them out either way.

Posted in Speaking, ST4I, Training Courses | Comments Off on Upcoming ST4i and CreativeJS workshops

ST4i workshops sold out – where next?

My Brighton dates both sold out within a day, so where should I take my workshops next? Let me know!

[UPDATE]… and the winner is… Amsterdam! Tickets on sale Tuesday 10th February, register interest for a reminder email.

IMG_5307_sml

My new Internet of Things workshop (or ST4i, as I prefer to call it) are proving to be hugely popular, so now I’ve decided to spread out a little and bring it around the country, and maybe around the world!

But I can probably only do 2 dates in the next few months, so let me know where I should come! Currently Bath and Amsterdam are hot favourites, but Manchester and Dusseldorf are close behind. I chose the locations based on people who are local offering to help.

Let me know where I should come next by filling in this short form.

Could you help me bring a workshop to you? Let me know.

Or if you’d like me to come to your company and run it for you, mail me! [email protected]

Posted in ST4I, Training Courses | Comments Off on ST4i workshops sold out – where next?