I made a thing. A silly PCB thing. A silly PCB thing with a controversial political figure stamped all over it.

I made ‘The Trump’ – a comical Twitter monitor add-on board for the Raspberry Pi.

“What’s it do” I hear you ask? It does two things, my curious friend:

It flashes a big ol’ 10mm LED every time someone tweets about the American President

It helps refresh my limited PCB design skills

It makes me smile

Time to show you this purple presidential PCB, and just for fun, today’s section headings will be modified quotes from the big man himself…

“Make America PCBs great again”

About a month ago I decided it was time to refresh my PCB skills. It had been a while since I had fired up the DesignSpark PCB software, and I was struggling to remember how to use it.

I’m guessing the news must have been on the TV at the time, but for some reason I thought making a Trump-based board would be a fun way to get back into things.

I’ve seen a ton of amusing PCB projects. I’m sure ‘proper engineers’ despise them, but a bit of fun here and there keeps a bedroom maker interested. Banana ruler anyone?

PCB rulers are all the rage these days so I decided I should make one of my very own. I present to you the "Banana Ruler" for whenever you need to check to see if your banana is in spec. Really happy with OSH Park's ENIG finish as it is the perfect banana colour. pic.twitter.com/cSu4hw6E8A — Jon Raymond (@Jon_Raymond_) April 5, 2018

“We’re going to build a wall PCB”

On to the design.

I grabbed a full-size Raspberry Pi HAT template I had designed previously and started to play around to get back to grips with the software:

I recalled that DesignSpark PCB couldn’t import any kind of image/art import – dang. However, I also remembered that I got around this previously by using fonts instead.

My favourite font site DaFont is loaded with lots of interesting ‘Dingbats’ – fonts that are pictures rather than letters/numbers. You can use these as a ‘back door’ to slap funky images on to PCBs in DesignSpark.

As you can see, I found a Donald Trump font. Someone has actually made a font dedicated to DT!

“They will be met with fire and fury PCBs like the world has never seen”

I messed about with the Trump font for a while until I realised that this board needed to actually do something. But what?

I didn’t fancy anything too taxing for my gentle re-introduction to PCB design, so I stuck with trusty LEDs and buttons.

Lights and switches can be very boring, so I decided to make it more interesting by giving them some purpose. Enter the Tweepy Python Twitter library.

The idea of the board is this:

When a tweet is sent with the hashtag #Trump the 10mm LED lights up

the 10mm LED lights up The 5mm LED simply informs me that the program is running

If I hit the switch, it pauses the program (5mm LED goes off too). I can hit it again to resume.

It’s a visual way of monitoring how much the world is talking about the most famous man on the planet.

“The beauty of me is that I’m very rich purple”

With the PCB designed and code ready, it was time to get a few made up.

Having your own batch of PCBs fabricated is actually quite cheap. I ordered a set of 3 ‘The Trump’ boards through OSHPark who have a lovely signature purple and gold finish.

The cost came to around $28 for the 3 boards, with shipping included all the way from the USA. Not terrible.

All soldered and finished, here’s what it looks like:

“I have great respect for the Pope Python”

I had to set up the Twitter library and code to run this thing – and here’s how you do it:

Install Tweepy

The code uses the Tweepy Python library to watch (stream) Twitter.

To install Tweepy, it’s as simple as entering the following command in your terminal:

sudo pip install tweepy

Set up a Twitter Application & Keys

You’ll need to set up an ‘application’ in Twitter, which gives you the tokens you need to allow other ‘things’ to use your Twitter account.

Once you’ve set up an application, if you look in the ‘Keys and Access Tokens’ section, you can find the following:

Consumer Key (API Key)

Consumer Secret (API Secret)

Access Token

Access Token Secret

The Code

In the script below we’ve got some GPIO code to control the LEDs (I haven’t bothered with the switch or LED 1 in this example) and the rest is for the Tweepy streamer.

I used most of the Tweepy streamer code example from here combined with the JSON tweet data elements from here.

You need to add your Twitter application keys in lines 22 to 25. Line 54 contains the search criteria (“#Trump”).

Now run the code and watch the lights flicker as the entire planet argues over the yellow-haired man!

from __future__ import absolute_import, print_function from tweepy.streaming import StreamListener from tweepy import OAuthHandler from tweepy import Stream import RPi.GPIO as GPIO import time import json # Set the GPIO mode GPIO.setmode(GPIO.BCM) # Set the LED GPIO number LED2 = 22 # Set the LED GPIO pin as an output GPIO.setup(LED2, GPIO.OUT) #Set LEDs off to start GPIO.output(LED2,False) # Twitter Application Keys consumer_key="PUT-YOUR-KEY-HERE" consumer_secret="PUT-YOUR-SECRET-HERE" access_token="PUT-YOUR-TOKEN-HERE" access_token_secret="PUT-YOUR-TOKEN-SECRET-HERE" class StdOutListener(StreamListener): def on_data(self, data): print (" ********** there was a tweet**********") # Decode the JSON data tweet = json.loads(data) # Print out the Tweet print('@%s: %s' % (tweet['user']['screen_name'], tweet['text'].encode('ascii', 'ignore'))) #Flash the LED GPIO.output(LED2,True) time.sleep(0.1) GPIO.output(LED2,False) return True def on_error(self, status): print(status) if __name__ == '__main__': l = StdOutListener() auth = OAuthHandler(consumer_key, consumer_secret) auth.set_access_token(access_token, access_token_secret) stream = Stream(auth, l) stream.filter(track=['#Trump'])

Video

Here’s a video of it in action:

“Who’s Gonna Pay for the Wall PCB?”

I’ve shared the design on OSH Park for anyone stupid enough to want one of these boards for themselves. There’s no profit or anything in it for me, you just pay OSH’s rates.

All you’ll need to add is 2 LEDs, a couple of resistors (around 330 ohm), a GPIO header and a tactile switch.

Warning: Avoid the super swift service and just go for regular speed. For some reason, the Super Swift fabricator interprets my gerber files a little differently – you could end up with some weird notches on the board.

“Covfefe”

Well that was fun. I made PCBs great again.

I’ll be making another comical board before I design anything serious, just to make sure I’ve got my head back around things.

Go make stuff. Enjoy it. Have some fun. Let your hair down.

Rich

Still reading? Good. Your prize? I have a few spare boards (some have the weird notches but still work) – hit me up in the comments with your favourite Trump quote if you want one. If you make me laugh, you get a board sent to you for free with the parts included.