UXDE dot Net Wordpress Themes

#WearTheRose tweet activated light up rose


The idea

A light up England rugby rose, which flashes every time someone tweets about the rugby. This year during the 6 Nations O2 promoted their own #WearTheRose hashtag for support for their sponsored England side.


The Rose

To see how to make the rose, please see my blog post over here on my craft blog, (it seemed a more appropriate place for a how to make pattern).

TLDR; I crocheted a rose, a couple of rows of which contained wire, I then sewed LEDs on the rose in a parallel circuit. This post describes how I made it flash when someone tweets with a specified string, head down to the bottom of the post if you don’t care about the code, there’s a cool video :)

Along with the rose, I needed an Arduino (I used an Arduino UNO), a script that looked for tweets containing the string I specified and broadcasted them to an Arduino script, which turned the LEDs on when triggered.

The Code

It took a lot of searching but most of the code came from one post, which due to the law of sods, I can not for the life of me find :( (I had it open for all the time – as soon as I find it I’ll update).

I had to make a few amendments. The first was adding in the Gemfile. (FYI I’m assuming you have ruby installed and are familiar with gems). For some reason it also wasn’t broadcasting the servo code, so I added line 33.

>require 'tweetstream'
require 'serialport'
input=ARGV.shift || "#bordeaux,#strasbourg"
#params for serial port
port_str = "/dev/tty.usbmodem1411"  #may be different for you
sp = SerialPort.new(port_str, 9600, 8, 1, SerialPort::NONE)
TweetStream.configure do |config|
  config.consumer_key       = 'CONSUMERKEYHERE'
  config.consumer_secret    = 'CONSUMERSECRETHERE'
  config.oauth_token        = 'OAUTHTOKENHERE'
  config.oauth_token_secret = 'OAUTHSECRETHERE'
  config.auth_method        = :oauth
buffers=words.map{|w| []}
sp.puts "512 0 0" # reset the servo
@client.track(words) do |tweet|
  p "beginning track of #{tweet.text}"
    words.each_with_index do |word,i|
      if search.include? word
        puts 'got something'
        sp.puts "broadcasting tweet"
    if (Time.now−last)>0.11
        str=ratio.to_s+" "+flags.join(' ')
        puts str
        sp.puts str

There’s a few things you have to set to make sure it runs. One is to create a Twitter app and add your own creds in where it specifies, the other is to make sure the USB port on line 6 is correct. Plug your Arduino in, and in the Arduino IDE go to Tools > Serial Port and type what ever is next to the tick onto line. (E.g. “/dev/tty.usbmodem1411”).

If you navigate to the file in your terminal window and run ruby app.rb “stringtolookforhere” the tweets should start to be echoed out.

Next came the Arduino code, which seemed to work off the bat. I would recommend opening the Serial Monitor (again under Tools in the IDE) as you can visually see the broadcasts and when the lights should be on and off.

>int ledPin=13;    // select the input pin for the potentiometer
int nbLed=1;
void setup() {
  // Open serial communications and wait for port to open:
  while (!Serial) {
    ; // wait for serial port to connect. Needed for Leonardo only
  for(int i=0;i<nbLed;i++){
   pinMode(ledPin−i, OUTPUT); 
// Utility function to get a value from a string at a given pos
String getValue(String data, char separator, int index)
  int found = 0;
  int strIndex[] = {0, −1};
  int maxIndex = data.length()−1;
  for(int i=0; i<=maxIndex && found<=index; i++){
    if(data.charAt(i)==separator || i==maxIndex){
        strIndex[0] = strIndex[1]+1;
        strIndex[1] = (i == maxIndex) ? i+1 : i;
  return found>index ? data.substring(strIndex[0], strIndex[1]) : "";

void loop() {
  if(Serial.available() >0) {
    String str=Serial.readStringUntil('\n');
    for(int i=0;i<nbLed;i++){
      // look for the next valid integer in the incoming serial stream:
      if(!getValue(str,' ',i+1).equals("0")){
        digitalWrite(ledPin−i, HIGH);  
  for(int i=0;i<nbLed;i++){
    digitalWrite(ledPin−i, LOW); 

Hooking it all up

All that’s left to do is upload the Arduino code to your Uno and attach the rose.

Attaching the rose was a very delicate operation, I’d already marked the positive and negative sides of the circuit, it was just a case of winding the wires carefully and making sure they didn’t touch and therefore short.

It did all manage to come together, however, even I was pretty amazed! Here’s a video of the whole thing in action:

Looking forward I can not wait to take this idea further. There’s a Red Bear (bluetooth enabled Arduino) just sitting ready to try this with, which would make it much more portable (as long as I can find some power), as well as some much more fancy programmable LEDs.

Watch this space, I think there’s a lot more to come :)

Young Enterprise Challenge

  • Events
  • Comments Off

Earlier this week I was lucky enough to visit The Charter School in Southwark, London along with my fellow Lab colleague Fahran to judge their Young Enterprise Challenge. The Young Enterprise Challenge is now in it’s second year at the school and tasks year 7 students to design an app to fulfil a problem set by a real organisation.

This year three challenges were set, one by us at O2 which challenged the pupils to design an app to advertise a new device to our customers and to help them understand all of the great benefits the device could give them. The other two challenges were set by businesses local to the school, one to advertise the services provided by a local therapy centre and another to provide information about the local area. The challenges were set around 10 weeks prior to our visit and were undertaken by all year 7 students during their IT classes.

Upon our arrival the students were in their weekly assembly and were ready to begin presenting their apps to myself and Fahran along with the other organisations involved. We had the chance to listen to presentations from nine teams and also ask them questions and it’s fair to say that we were blown away by the effort that the students had put into their designs. We were also impressed by the confidence they had shown when presenting in front of strangers, their entire year group and their teachers.

They didn’t just create wireframes and add them to a presentation either, they had created fully functioning apps using AppShed. They included features such as Google Maps integration for directions to the nearest store, contact details to enable direct calls to our customer service teams and links to be able to be able to purchase a device directly from the O2 website.

After the presentations we left the assembly room to determine the winning team…now that was a hard task! Every team deserved to win as they were all fantastic but in the end we did have to pick one team and went back to the assembly room to award them. The winning app had been designed to provide information about the local therapy centre and was packed with features and content. It also had a great UI and the students had clearly thought about UX as they had chosen a relaxing colour theme which really brought the essence of the therapy centre to life.

This whole experience left me feeling inspired. It’s great to see a school that really values technology, IT, computing and business education. As the students progress through school they will begin to learn more about programming starting with Scratch and using tools like App Inventor to program Android applications. By the time these students leave school and enter the world of work they really will be ready for the challenge proposed by a world which is becoming more and more defined by software and technology in general.

Bringing GSM to Electromagnetic Field – Part 2

  • Events
  • Comments Off

EMF is a camping festival that ran over a long weekend from 29th–31st of August this year.

The festival is full of geeks, crafters and technology enthusiasts. Who better to turn up than us here at The Lab!. The site offered a power grid and internet access, so we rocked up with three base stations under our arms

The Lab, along with Geeks of London, Sam Machin and some other great people covered the site with a test GSM layer for attendees of the camping festival. The GSM layer that we are talking about here is a basic 2G coverage that you would expect to have on your normal mobile handsets, provided through one of many Telecommunication operators available. The 2G network usually provides us with voice, text and data. However, as we are were running on a very small scale, we were only going to offer voice and possibly text.

The base stations were provided by range networks that offer multi-protocol IP wireless platforms that enable simplified, lower cost mobile networks.

Turning Up To The EMF Site

It was a nice sunny afternoon on Thursday when I finally made it to the camp site and parked up.

There I found Sam Machin (Ex-Lab member and all round good guy) already on site and plotting out where to set up the 3 large tents that were arriving with Kevin (supplied by O2, thanks guys :D ). When Kevin arrived, we got started setting up our base with the help of Dan Knell.

Next we had to find a data cabinet, where we could secure and run the RangeNetwork base stations.

This was the Data Cabinet :)

As you can see the data cabinet was a porta-loo, which actually worked really well for securing the equipment and for keeping them safe against the elements. Each data cabinet was kitted out with a power feed and network switch.

We managed to feed the antenna cable out of the data cabinet, (thanks to Sam for that), in order to mount the antenna pole to an existing light fixture. Then there was just the matter of networking the base station so that it could talk to our asterisk box inside the main operations centre. We setup another two base stations at other ends of the field in order to provide 99.99% coverage :). All base stations were talking to the same asterisk server in order to register and manage calls.

Running FieldPhone

On the Friday morning we performed a few checks to make sure calls were working ok and then started to get ready to run the shop (our front tent facing the main path, stocked with phones, sims and an example of the RangeNetworks BTS we were using).

The camp site started to get rather busy :).

Technical Part

The fieldphone setup is as below:

We had a SIP (Session Initiation Protocol) core built upon Asterisk, OpenBTS was running on the Range base stations that provided the GSM interface. We were also using Twilio for outbound calls to non-field phones as well as incoming calls via the Twilio number. The inbound call to Twilio linked to an IVR that requested an extension number to enable routing the call to the correct field phone handset. The GSM network provided was 2G and is a development network built upon OpenBTS. We operated it on 1800mhz at 100mw.

Over the Weekend we had around 100 EMF users on our GSM network and making calls. It was great to see so many people interested in the technology and popping over to our village to find out more. Most people who visited us left with a SIM that they inserted into their spare handset (this had to be an unlocked device) and were away making calls over field phone!

Bringing GSM to Electromagnetic Field

Over the past year we in the Lab have been playing a lot with OpenBTS including taking our developmental network to Over The Air last year.

Happy Kev

This weekend we will be testing an expanded network to provide the GSM layer of the Field Phone project. We will have three base stations covering the site provided by Range Networks.

You can find out more about the project at the fieldphone site.

EMF runs August 29th–31st at Bletchley Park, tickets are still available.