Categories
Uncategorized

Problems with Net::Google::Calendar

Ok, in using Net::Google::Calendar, was getting an authentication error when trying to access the calendars. Thanks to castaway (:D), turns out theres a dependancy that it didnt install. So if you get an error like this:

401 Authorization required at ~/perl5/lib/perl5/Net/Google/Calendar.pm line 625.

Then all you need to do is get LWP::Protocol::https! This should then fix it and get it working.

Categories
Uncategorized

Net Google Calendar

Very short update on some things im working on: First, is installing Net::Google::Calendar. For future reference, the things needed to install ontop of a fresh Raspbian install are:

  • libexpat1-dev
  • libssl-dev
  • libxml2-dev

Those 3 allow Net::Google::Calendar to ‘install’ from CPAN, without any issues.

The other thing i’m working on, is hopefully going to be the start of a home-automation thing. To teach myself more Perl, and Android, i’m going to write something to control some RGB Led’s from my phone, through a Pi and onto an Arduino. Woo!

Categories
linux Programming Shadowcat

The Cat of Shadow, and Multiplexed Terminals

So for those of you who don’t know (which will probably be most of you…), I have started interning at Shadowcat Systems, where their philosophy (for new staff atleast) is to push you off a cliff, and see how long it takes for you to learn to fly. Currently im still falling, though slightly slower than before, which brings me to the main subject of this post: Tmux.

So, way back (ok so more like mid 2007/8) when I started messing in Linux for desktop and server based stuff, I had the need for keeping terminal’s open even when I was not connected to the server, and for having several open at one time. Now anyone who has used Linux for such purposes have probably used something called Screen – an exceedingly powerful window manager for the command line, though with a very steep learning curve, and (as i found ‘back in the day’) quite a difficult to understand config and use.

Fast forward to a few months ago, when I was first sorting out things with Shadowcat, and I realised that a lot of the time there I would be spending at the command line, and would have need for something quite similar to Screen. Remembering how little I liked said program, I had a look around, and happened across Tmux. Now dont ask me how I came across it, I really cannot remember the details, but all I know is that it makes sense. Ok, as with all command line interfaces and the like, there is always a learning curve, and I dont know how much of this I remembered from using Screen, but it clicked in and worked.

One of the major things I liked, was that there was a permanent statusbar, just like the taskbar seen in Windows/ Linux/ Mac/ insert OS here. I know that screen has the same option, but at the time I didnt know that, and having looked at some of the documentation for how to make that work nicely, I’m quite sure I would have just ran away screaming. Another function I liked was the ability to split windows into ‘panes’, and swapping between them quickly. Again, screen has this functionality (I think, somewhere….), but as before, being able to just pick it up and run with it is always a good sign.

The other major thing that I really like about it now, is how easy it is to customise it. I spent quite a while looking at tmux-powerline, which is a plugin of sorts that is designed to change the look of the statusbar, and update it with loads of quite useful functions. However, I really did not need all that extra stuff, and to be honest was quite confused about the ‘patched fonts’ – which relied on another related project’s documentation and files to work (the fact that the instructions linked to on the other projects documentation no longer exists, and when eventually found on ANOTHER related project, didn’t work either, did not bode well…). And anyway, these fonts were just for a few bits of visual flair… nice, but I felt was unnecessary, and was not going to work in my use-case either. The one major thing I liked about it, was the colour and the rough look of the bar, which I unceremoniously nabbed and then played with until I had what I am currently using.

tmux-current
My current Tmux scheme

As you can see, if you have taken a look at the powerline thingy linked earlier, the colours are quite similar. The one major difference though, is that this doesn’t need any shell scripts to run, and all is in the .tmux.conf file, which I can copy to any machine im working on which has Tmux, and have an environment that I am happy to use all day long. My Tmux config is below, and if anyone would like me to go through it, or have any questions about it, feel free to ask.

#-----------------------------------------------------------
# Tmux Config
#
# Created by Tom "TBSliver" Bloor
#
# Provided as-is, do what you want with it.
# Usual not-my-fault disclaimer if something goes wrong
# after using this!
#-----------------------------------------------------------

# Set Ctrl - a as the standard prefix, globally
set -g prefix C-a

# Unbind Ctrl - b as a shortcut so can use it for something else
unbind C-b

# Bind Ctrl - a as the send-prefix command to stop confusion
# with vim or when using tmux in tmux
bind C-a send-prefix

# set the dafault delay to make tmux more responsive
set -sg escape-time 1

# bind r to reload this conf file
bind r source-file ~/.tmux.conf \; display "Reloaded!"

# set the terminal to use 256 colors
set -g default-terminal "screen-256color"

# set what the current active window status bar should look like
set-window-option -g window-status-current-format "#[fg=colour255, bg=colour27] #I : #W "

# set what the standard status format should be
set-window-option -g window-status-format " #I : #W "

## Set the text (fg) and background
set -g status-fg colour136
set -g status-bg colour235

# set the window status colors and attribute
setw -g window-status-fg default
setw -g window-status-bg default
setw -g window-status-attr dim

# set the pane borders and colors
set -g pane-border-fg colour136
set -g pane-border-bg colour235
set -g pane-active-border-fg colour235
set -g pane-active-border-bg colour136

# set the alert and tmux command line colors
set -g message-fg colour136
set -g message-bg colour235
set -g message-attr bright

# set the window list to centre
set -g status-justify centre

#set utf8 encoding
set -g status-utf8 on

# set the left side of the status bar to show the current active
# session, window and pane
set -g status-left "#[fg=colour234, bg=colour148] #S:#I.#P #[fg=colour0, bg=colour33] #H "

# set the right side of the status bar to show the current date and time
set -g status-right "#[fg=colour136, bg=color235] %a %d-%m-%Y | %H:%M "

# set tmux to monitor for activity in a window, and let the
# window list show activity in a window
setw -g monitor-activity on
set -g visual-activity on
Categories
Arduino Perl Programming

Arduino and Perl

So just started learning Perl (because, well, why not?), and in trying to find something to do with it, I found a module on CPAN for using serial with an Arduino. Now if you have followed this blog at all, you will know that the Arduino is the first device I go to when I need some hardware controlling, so learning a new programming language to then control said hardware was not much of a massive leap. So with that, I pulled out an Arduino, booted up gedit, and set to work!

The first thing to do was to create the Arduino program. This one was quite simple, just accepts characters on the serial port, and then turns on or off its LED depending on what it was sent.


void setup() {
Serial.begin(9600);
Serial.println("Ready!!!");
}

char in;

void loop() {
if(Serial.available() > 0) {
in = Serial.read();
switch(in) {
case 'a':
digitalWrite(13, HIGH);
break;
case 'b':
digitalWrite(13, LOW);
break;
default:
Serial.println("Invalid Character");
break;
}
}
}

As you can see, just a very simple switch that turns the LED on 13 on or off depending on what it reads. So, on to the Perl part!


#! /usr/bin/perl

use strict;
use warnings;

use Device::SerialPort::Arduino;

my $Arduino = Device::SerialPort::Arduino->new(
 port => '/dev/ttyUSB0',
 baudrate => 9600,

databits => 8,
 parity => 'none',
 );

my $in;

print("a or b, q to exit\n");

do {
 $in = <>;
 if(length ($in) > 2) {
 print("Too long!!!\n");
 } elsif($in ne "\n") {
 $Arduino->communicate($in);
 }

} while($in ne "q\n");

Now, this bit is also very simple, at the moment. After calling the module (Device::SerialPort::Arduino) and initialising it, the ‘do, while’ loop just takes and input, and only sends it if it is 2 characters long (a character, and a newline).

Using these two, if I send an ‘a’, the light turns on, and if I send a ‘b’ the light turns off! and if I type in ‘q’ it ends the program. Now, as I’ve said, this is quite a simple piece. So to extend this, I’m going to create a ‘proper’ interface (read: a gui that turns it on and off!). Tune in next time!

Categories
Electronics PCB Manufacture Power Supply

So about 3 months ago, maybe more, I started looking into designing a modular synthesiser. I started off building a simple VCO, and ran into problems straight away with that, which needed a solid power supply with multiple rails. So I looked into building one. It didnt take long for me to design one, based around the LM317 and LM337 linear regulators, however this has really been put on a back burner with life and several other projects getting in the way (including moving the hackspace to a new premises!), but today I knuckled down and made the PCB in the garage.

power supply pcb
the final pcb, pre drilling

Now my workflow for PCB’s does need a bit more work, and the actual equipment does too… This one was done with the toner transfer method as it previously failed with the UV exposure method. It actually failed with toner transfer as well once, but using a clothes iron instead of a Laminator made the difference. I need to upgrade my ‘etch tank’ to something more than a glass baking dish and a tray heater, to a bubble tank. Heating is optional, it just speeds up the process. Will also be looking into the Edinburgh Etch method as well, which uses Citric Acid to improve results.

Anyway, back to the power supply. With the PCB made, I can finish off mounting everything into the case I bought for it – a plastic 19″ rackmount case. May seem a bit overkill, especially as this is only rated at 1Amp per rail, however I am trying this case out for other projects as well, and seems to be quite a good choice.

The case, buried under a few other boxes of projects

Here you can see the main power switch, 5 output rails, and possibly the green LED in the middle. The transformers are already mounted inside the case to a large sheet of aluminium, and just need all the connectors putting in. I will post more pictures of this when I finish the project off, and also go into upgrades I hope to do, such as microcontroller control, current limiting, and a more powerful output. For now though, need to wait until tomorrow to finish this off…

Categories
Uncategorized

Power Electronics and Underestimation

So today I have been working on the mains power side of this SMD Oven, wiring together the solid state relay and the in/out IEC sockets. Which comes to my first (and hopefully only mistake): Never underestimate how much power something will draw. I bought 5A fuses for the box, thinking that the oven itself wouldn’t be that powerful. However, it turns out that the oven will draw 1300W, which is slightly more than 5A…. So need to buy some different ones. Slight mistake, but nothing blown up/broken, so thats a relief. Also need to make a way to mount the relay and the 5v power supply, and im reluctant to actually use the mounting holes on the relay…

Ok, so just messed around with it a bit, and realised I can actually mount the relay to the side of the box, and not have to worry about it. DONE! And can also mount the rest of the electronics in the same box, and have it as an all in one device. I’m so clever. So, without much more ado, (and yes, I did just check the proper use of that word…) here are some pictures of this box as it stands!

Controller box
Inside the controller box

This first picture is the inside of the box, however things will change very shortly with how this is laid out.

Controller box outside
The back of the controller box

And this picture shows the back of the controller box, and the IEC socket and plug that I have used for this. The main input uses an integrated switch and fuseholder, which I’ve used on another project, gives a nice finish and is much easier than drilling/filing 3 holes for the socket, fuse holder and switch. You can also see the output to the oven, or whatever else is wanting to be controlled. This device could probably actually be used to control anything, as long as it uses an IEC lead and powers straight off the mains.

Eventually I will be releasing the design for this, although the current part of it is rather easy to implement. Until I finish the code though, you will have to suffice with this part!

 

Categories
Uncategorized

So what have I been up to?

Well that is a very good question… The answer is, quite a lot! HAC:Man (The hackspace i run with) has finally got a space of its own, and I have been helping to set everything up. I have also changed job, and am now working at Maplin. So yes, what have I been up to?

Well first bit is, helping sort out a Lathe! HAC:Man has had a lathe loaned to it, and was helping to set that up.

Myford ML 7 Lathe
the lathe in all it’s glory

Along with that, I have been developing the controller for an SMD Oven! We have the oven, and almost have a complete controller.

SMD Oven Prototype
The Birds Nest

The only problems I’ve had recently is some interesting stuff with the debug code – when the debug code is there, it works fine. Without the code, it crashes the Arduino… Will have to see what happens when I get the complete code in there though, controlling all the parts.

For now though, watching Real Steel… and tomorrow, finishing the hardware!

Categories
Uncategorized

PCB Manufacture – Part 3

So just did a full board with the new UV lightbox, and it came out pretty good. Need to do something better with the sodium hydroxide, but other than that a success.

image
the finished panel

The board has a few places where the photo resist failed, mainly due to how long i had to develop it for, and using a sponge probably didn’t help. So for next time, no sponge, and heat the developer up a bit beforehand… its a bit cold in the garage afterall.

Categories
Electronics PCB Manufacture

UV Light Box Controller – Part 4

So, that took longer than I thought it would…

Once I put the whole thing together, with the controller board and power board, it didnt work – the Darlington wouldnt switch the power for the UV Array. Some peculiarity of the ones I have, or just the fact that it wont work like that… Either way, I had to go back and re-do that board. Oh and also replace the Atmega 328 – they dont like near on 18 volts into a control pin it turns out! So now I have a completely re-done power control board, with a Darlington, which is in turn switching a relay, which switches the UV Array. Phew! Also I fitted a lump of metal to the 5v regulator, although will need to find a better heatsink soon as its still getting rather warm…

Controller Board

So the controller board itself hasnt changed much, apart from a new atmega chip. Also its now fixed to the front of the UV light box!

Power Board

This is the part that has changed the most, what with the Darlington not working as intended. As you can see, the voltage regulator on the left now has a hefty bit of metal for a heatsink, but needs something bigger. The blue box is a relay from my dads bits box, wouldnt have thought it was powerful enough, looking at it, however it does the job rather well.

The UV Array

And in this last picture, you can see the UV array inside the box. Not much to see here, all the resistors are on the underside of the board, but you can see my amazing wire organisation! Yes the whole box is made of cardboard and gaffa tape, but it works. Eventually I will build something better, maybe even have more LED’s in the array… However for now this will do me nicely.

Now all this is finished though, I can go on to actually making more boards! Woo!! I will eventually sort out some schematics and board layouts for this, however most of the circuit I just made up from previous experience, so that may take a while!

Categories
Electronics PCB Manufacture

UV Light Box Controller – Part 3

So after a little bit of tinkering with the code, changing round the pin assignments mainly, I  built up a permanent version of the board in veroboard/stripboard/whatever you want to call it. And this is what we have!

image
The finished controller board

The left hand board has all the controller, lights, and buttons on it, and the right hand board has the Darlington Transistors, and a 78M05 linear regulator to power the micro. This now just needs connecting to the power socket on the box, and the UV array, and we’re done! Will post an update when its sorted.