Tag Archives: tutorial

‘Mastering’ inkscape for makers …

Things you should know. These are a few tips I’ve learnt from the last twelve months of using inkscape on a daily basis. Practically every piece of art work I process using open source / free software. Mainly Inkscape, sometimes GIMP, sometimes Scribus and laugh all you like mspaint.exe, useful when I quickly need to crop or annotate an image.

Before you rage quit my article and storm off muttering under your breath ‘what a newb! WTF is he going on about.’ … well I started out using Hardvard Graphics in dos and Deluxe Paint on the Amiga, when I upgraded to windows (3.0/3.11) I moved to Corel graphics v3.0 for scanning, tracing images and compositing etc. (I can still to this day remember the evening I got the disk, bought an official copy second hand. This was before the age of CD writers and copied CDs weren’t easily available, this came with all the official documentation, manuals and the clip art book!!) Mid-nineties I took a bespoke course taught at local university on web design (the first of its kind in the country.) which was really what started my interest in design work, the internet and programming, the lecturer introduced me to Macromedia (awesome company that Adobe practically consumed and now lives off its glory, not to mention they absolutely ruined the nice simple / low overhead / easily navigable interface.) So I spent many years working with Macromedia products, Dreamweaver, Fireworks, Flash and Director. I’ve worked extensively with 3D Studio Max, Maya, Truespace and still use Blender (but not as much as I should do.) Had a brief experience with Solidworks, spent many hours using Autocad making files for water jet cutting. Down to specialist bespoke product design software, aimed at manufacture (I’ll post a link later the name escapes me at the moment). I’ve also a degree in design and applied arts, spent over 20 years in the IT / digital graphics world and the last five years of my working life programming robots. Right less about me waffling on about old software, I’ve used a lot of packages, you might notice I’ve neglected one, yes I have used Photoshop for many projects / years, at one point it was my go to design program (probably around version 6) especially useful for digital composition and photo manipulation, but, I’m going to say it, bloated to hell and the most over-rated design tool out there. If Oracle made design software it would probably be called Photoshop. I’ll save that for another post. The above is merely scraping the surface.

So now you have a little background on some of my software experience, I hope you might listen a little more intently. Inkscape is a fantastic tool. Firstly it’s 100% free. (Really dude you’re starting here … YUP) This is for makers. Makers are usually on tight budgets / constraints so its important to consider this. 100% free no cost, no subscription, no hidden code, no shady CEO milking your bank account. All updates 100% free. Available 100% of the time to run on older hardware than the kind of pc you need to handle the amount of bloat that Photoshop / Illustrator rolls with. Inkscape takes up less resources and memory than most design packages / ‘solutions’. Means you can do more faster with older hardware. (I promise that’s my last dig at Adobe.)

Inkscape is also cross platform, meaning it really doesn’t matter what hardware you’re running it on you’re always presented with a familiar interface. Which is really handy if you’re a maker, you might require a specific vector file format for a project on a linux / windows / osx box, Inkscape is only one trusted download away. No cracks, keygens, viruses / malware. If you’re really paranoid you can build from source or checksum the download.

The program itself is open source but also allows users to independently develop plugins via a well documented API. Python the language of the maker, free, open source and right now, there’s an incredible amount of python development going on, meaning modules plugins and code is pretty much readily available all over the web. Inkscape also supports Perl, the language of the internet and regular expressions. Advanced programmers are encouraged to implement their plugins natively in c++. If there’s some kind of graphical automation you require its likely Inkscape will be able to provide or give you the grounds to develop your own solution.
Click here to learn how to create your own plugins.more about pythonmore about perl,

Existing plugins? Yes there’s a lot, because there’s already a large user base for the package. Many that help extend the programs functionality from simply a graphics program to a production tool or service. Examples? One that immediately springs to mind is the laser cut tabbed box designer plugin. Not only useful for producing your own tabbed boxes but these boxes are extremely popular on auction sites. Makers and crafts people are buying them by the bucket full for their own projects. A few clicks and numbers to set the dimensions and amount of compartments you require, something that would manually take quite a while to produce. There are plugin’s for HPGL plotters, 3D printers, gcode senders, jigsaw creators, all great plugins for makers.
Click here to browse the full list of plugins on the inkscape site.

I’ve talked about how great the software is and the plugins but you came here for useful tips.

Continue reading

Hakology – How to grab openweathermap data using python.

I’ve been playing with the openweathermap api thought i’d share a little code, the following pulls the json and constructs a string containing the location, temp, tax temp, min temp and humidity. You will need to sign up for an API key and free user account 1st. The free account at the time of writing this allows 50k calls a day so if you’re writing for a small personal project 50k calls should be fine.

Copy the code below to a file
eg. displayweather.py

chmod the file if needed …
sudo chmod +x displayweather.py

run the file using …
python displayweather.py

import requests
r = requests.get('http://api.openweathermap.org/data/2.5/forecast/city?id=YOURCITYIDGOESHERE&APPID=YOURAPIKEYGOESHERE')
data = r.json()
mystring = ""
mystring = mystring + data['city']['name'] + " "
mystring = mystring + "Temp:" + str(int(data['list'][0]['main']['temp'] - 273.15)) + "C "
mystring = mystring + "Max:" + str(int(data['list'][0]['main']['temp_max'] - 273.15)) + "C "
mystring = mystring + "Min:" + str(int(data['list'][0]['main']['temp_min'] - 273.15)) + "C "
mystring = mystring + "Hum:" + str(data['list'][0]['main']['humidity']) + "% "
print mystring

Click here to download the file.

Hakology Project Notes : Python, RedditAPI, Arduino, RaspberryPi thing.

Over the last three weeks I’ve been playing with various breakout boards, microcontrollers and embedded linux. I’ve been trying to take time to learn how the technology works and how best to combine them to teach and produce something useful, different and entertaining. So this project initially started out when I was playing with the RTLSDR dongle, I thought it might be cool to display the messages as they got demodulated on a separate device that was dedicated to grabbing POCSAG messages, I slapped it all together, then when my son was over the other weekend we decided to modify the code to grab the top 25 articles from a given subreddit.

Eventually when I get time ill put together a video tutorial on setting this all up but in the meantime here are the notes …

You will need:

1 x Raspberry Pi model B.
1 x Wifi dongle or ethernet cable.
1 x Arduino deumilinove.
1 x USB lead (for serial communication with the arduino)
1 x USB lead (to power the RPi)
1 x USB Charger
1 x LED Matrix 8×8 x4 (I used the horizontal style layout)

So how does it work?
Its pretty simple really, the raspberry pi runs a small python script that grabs the top 25 articles from a predefined subreddit using the api (most of reddits api can be accessed just by post fixing .json to a lot of their URLS the data structures are also well documented and available on github.) The script strips out any weird characters as the JSON is returned in utf-8 format. A string is built containing the articles rank, total amount of upvotes and the article title. If the string is over 300 characters it gets trimmed and “…” appended to the end. The script creates a serial connection to the arduino (the device is usually addressable using /dev/ttyUSB0) The string is then sent to the arduino over serial. When the arduino receives a new string it displays it to the LED matrix after having scrolled any current messages.

What’s the python code?

Install and configure raspbian in the normal way. Before running the script make sure you have internet access otherwise the python script will fail when it trys to communicate with reddit. (todo: add better error handling.)
Python code – http://pastebin.com/shXyry5C
Copy the code in to a file called reddit.py to your home directory.
Edit the file so it points to the correct serial device.
nano reddit.py
If you’re unsure about the arduino serial port run
sudo ls /dev
Look for something like …
ttyUSB0
Edit the line in reddit.py where the serial communication is initialised ensure it matches the port for the arduino.
ser = serial.Serial('/dev/ttyUSB0','57600')
Save the file using …
ctrl+x
Make sure the file has execute permissions by issuing the following command …
chmod +x reddit.py
You can test the script by running it from the command line using the following command (*this needs to be run with superuser privs to access the serial port) …
sudo python reddit.py
Once you’re happy with the way the script is running you can make it autoboot with the pi by using the following command …
sudo crontab -e
If you are prompted which editor to use and are unsure use nano (option 2)
At the bottom of the file add the following line …
@reboot /local/bin/python /home/user/reddit.py
Save the file by pressing ctrl+x
Reboot and test your script is autoloading.

To display the messages on the matrix you’ll need to flash your arduino with a little code …

Wiring the arduino …
To connect the arduino to the matrix you will need to ensure you have the correct SPI pins as they differ between arduino boards the ones on the deumilinove are pins A4 and A5, A4 SDA and A5 SCL, you will also need to attach the CS (chip select) pin to pin number 13 on the arduino and also connect VCC to 5v and GND to GND on the arduino.

A4 to SDA
A5 to SCL
13 to CS
5v to VCC
GND to GND

(todo : will post a pic when i get time)

What’s the arduino code?
Arduino code – http://pastebin.com/pvkM2DUK
Copy and paste the arduino code in to your arduino IDE, you’ll also need to grab the md_max29xx library from git hub. (Download the zip file and unzip the files to your arduino IDE library folder usually /Documents/arduino-x.x.xx/libraries) This library is used to drive the LED matrix. Once you’ve installed the library you’ll have to specify how many matrices you are using in the arduino code. (How many LED matrix panels you will be displaying to my board had 4 8×8 LED panels.) Here’s the important bit though depending on what/where/who you bought your led matrix board from you might find you’ll have to edit way the arduino draws to the matrix otherwise you could be in for some very interesting results. This can be done in the md_max29xx lib folder. There are a few variables that define the matrix rotation and draw direction IE. right to left, left to right, top to bottom etc. You will need to play with these variables until you get the right combination for your matrix.

NB. When initially getting this running use the example grapicstest to make sure the leds are drawing as expected then flash the arduino reddit serial code once you have the library configured correctly.

Now all the hard work’s done
Once you’ve installed the library, edited the arduino code, updated the variables for the draw direction and successfully flashed the code, plug the arduino in to the raspberry pi and boot. There should be enough of a delay in the script to ensure the RPI has connected to your network before it makes its initial request.

If you have the arduino setup correctly you should see scrolling text on the matrix. “Waiting for serial data!” after a short while the rpi should connect and start displaying articles from reddit.

Concluding
Still yet to build an enclosure or decided how / where im going to use this yet but i’ve had fun making it. Initially getting the libraries setup and running correctly was by far the most frustrating part of this project writing / editing the code was pretty straight forward. There’s plenty of scope for improvement / modification too, if I get time I was thinking I’d get it to cycle multiple subreddits, but for the time being I’ve spent enough hours on this project.

NB. The original code running on the arduino was limited to 25 characters I’ve modified this to allow for messages up to 300 characters in length (the size of an article title from reddit) Since doing so some of the serial messages appear to glitch intermittently. I’ve been checking the code for errors but haven’t managed to pinpoint the problem yet. As far as I can tell the python code runs fine but there might be a problem when the arduino is receiving the serial messages. Possible solutions maybe change the baud rate and send the data slower or add a checksum. (*As suggested by advancednewbie) Example code an library for implementing a checksum. https://github.com/AdvancedNewbie/serialChecksum

IF YOU HAVE ANY QUESTIONS REGARDING THIS PROJECT PLEASE PUT THEM IN THE COMMENTS ON THE YOUTUBE VBLOG EPISODE AT THE TOP OF THIS POST.

Installing SDR# on windows …

How to install SDR# on windows …

You will need …

PC/Laptop (Recommended dual core, 4gb RAM)
RTLSDR dongle
(Optional antenna / adapter. *Recommended*)
.NET Framework 4.6

DO NOT PLUG IN THE DONGLE
DO NOT INSTALL ANY SOFTWARE IT CAME WITH
If you have uninstall the software, driver and unplug the dongle.

Goto airspy.com and download the ‘SDR Software Package’
Unzip the files somewhere
Run install-rtlsdr.bat
Plug in your dongle
Run zadig.exe (as administrator)
Click options
Make sure ‘show all devices’ is selected.
In the device drop down select ‘Bulk Interface 0’
Ensure WINUSB is selected in the other drop down.
Click install
Click OK to any warnings
Run sdrsharp.exe
Select the RTLUSB dongle
Click the play icon to start capture.
Tune to a known frequency (FM station)
Ensure WFM is selected
Open the options menu
Increase RF gain, but don’t let the signal distort.
If you can hear distortion try adjusting the volume control in SDR#

Give yourself a pat on the back and get scanning!

Moving on to gqrx and linux in the next video.

Recommended SDR shopping list for up coming content …
RTLSDR – RTL2832(u) DVB-T+DAB+FM Dongle (£10-£15)
MCX MALE TO BNC FEMALE (for connecting antennas) (Approx £2)
AIR BAND (or similar) antenna (usually with BNC male connector) (£3-£10)

Hakology Day 12 : Blog Entry

[1521]
Kettle is on. Coffee to be made. So day twelve begins.
[/1521]

[1530]
Tunes turned to 11 … its Friday!
Operation pre-weekend tidy up has begun.
[/1530]

[1653]
Slow start, written up all the notes for the SDR# tutorial, might have a go at recording it later, need to clear some space in the garage for some new equipment arriving soon.
[/1653]

[1913]
Just had a little jam on my drums .. its been way too long. Great warm up for some FPS.
[/1914]

[2044]
Right time to do something productive.
[/2044]

[0103]
Uploading SDR# tutorial, writing up notes in to a new post.
[/0103]

[0200]

Really quick video showing you how to install and setup SDR# under windows.
Moving on to linux and gqrx next.
[/0200]

[0321]

[/0321]

 

Hakology – Retropie HDMI audio fix

No audio over HDMI on retropie? No problem, here’s your solution i’ve seen a few fixes on the web lots varied some were overly complicated so I decided to write up a really simple fix. Tested and working on the RPi3MB.

Boot retropie
Go to the retro pie menu
Go to the audio menu and press ‘A’
Ensure HDMI is selected, also check the mixer volume is at 100%
Save settings and return to the retropie menu
Quit emulation station
Run …
sudo nano /boot/config.txt

uncomment the following …
#hdmi_drive=2
so it looks like this …
hdmi_drive=2

also uncomment …
#hdmi_force_hotplug=1
so it looks like this …
hdmi_force_hotplug=1

Press ctrl+x to save the file.
now run …
amixer cset numid=3 2
and ..
sudo reboot

Hopefully you should now have audio over HDMI

Hakology – Retropie steam controller setup guide

Notes to accompany the following video showing you how to setup and configure the steam controller for retropie. Tested and verified as working with python 2.7 on the rpi model B and rpi3 model B.

sudo apt-get install python-pip
sudo pip install libusb1
sudo pip install enum34
git clone https://github.com/ynsta/steamcontroller.git
cd steamcontroller
sudo python setup.py install
sudo nano /etc/udev/rules.d/99-steam-controller.rules
Add these lines :
SUBSYSTEM==”usb”, ATTRS{idVendor}==”28de”, GROUP=”games”, MODE=”0660″
KERNEL==”uinput”, MODE=”0660″, GROUP=”games”, OPTIONS+=”static_node=uinput”

sudo udevadm control –reload
sudo crontab -e
@reboot /usr/local/bin/sc-xbox.py start