• Building an automatic infrared remote control for the shop

    ArduinoUnoSmdMy second Arduino based project has been to build an infrared remote control that will turn on a TV when the TV is powered up and defaults to standby mode.

    Here the background. I have a showroom that sells kitchens, bedrooms and bathrooms. On the second floor one of the displays has a TV that we use to play videos from suppliers along with our own youtube videos (which we still haven’t got around to creating).

    However, we don’t get very many customers during the day (we’re a specialist shop) and so to save energy I had our electricians install an infrared timed switch for all the upstairs power.  The lights turn on automatically when people walk up the stairs and turn off 15 minutes later.  The original TV was connected to this power circuit and everything was good. Except it died. The replacement TV doesn’t automatically turn on when the power comes on but it does remember the channel that was selected.

    So, I needed to find a way of turning the TV on when the power came on. I couldn’t find any off the shelf solutions so I built my own remote control using an Arduino.  Arduino is

    “an open-source electronics prototyping platform based on flexible, easy-to-use hardware and software. It’s intended for artists, designers, hobbyists, and anyone interested in creating interactive objects or environments.”

    For me, I treat it like a simple small computer. I can plug in various components like LEDs, flow meters and LCD display screens and program it to respond to events in the way that I want.  I’ve used an Arduino to build a flow meter for the showroom so we can compare the performance of different showers. I’ve realised I’ve never blogged about that so I may do later.  This weekend though I wanted to build an InfraRed remote control.

    Buying some components.

    componentsI ordered about £50 worth of parts on the internet.  The Arduino board was about £24, the IR receiver, LED IR emitters, a suitable resistor (all in pack quantities far larger than I needed) about £10 and a prototyping board and jumper cables made up the difference.

    If you’re trying to replicate my remote, the important bits I bought are:
    Infrared LED 5mm, 940nm 22deg Vishay TSAL5300
    IR Remote Receiver 38KHz 45m Vishay TSOP38238
    PR01 Resistor, A/P,AXL,1W,5%,39R Vishay PR01000103909JA100  [remember to size the resistor according to the LED you get]

    Putting them together

    It’s important to remember that I don’t work out all this stuff. I’m not that clever. I rely on a lot of googling and a little past experience.   For this project, I relied upon Ken Sheriff’s Multi Protocol Infrared Remote Library for the Arduino. You’ll want to read that blog post. It may be old (2009) but  it worked just like described there.  I also found a useful hint at this blog about prefixing HEX output.

    I put it all together just like Ken Sheriff said. Well, almost. I had a different IR Receiver so I had a slightly different pin setup there. I had my IR Led connected to pin3 of the Arduino which is a requirement of the library.

    buildandtestMy plan was to: 1) get the IR reciever working to record the code from my remote. 2) Send the IR code from the LED, make sure I’m receiving it. 3) Test it on the TV.

    Step 1 worked very well. The sketches (example code) included with the IR library worked perfectly. I used it to get the power code from my remote (It reported the TV uses NEC codes and FE50AF is power).

    Step 2 I thought worked very well, but I later discovered it didn’t work at all. I did read that the library could only send or receive and not do both at the same time. To test sending, you’d need a second Arduino.   So the code I wrote to send and receive wasn’t working and the result I got which I thought was a success was a coding error on my part.  See how I’ve lined my LED up with my receiver?  Well, don’t bother, it won’t work.

    When it didn’t work on the TV I started to fault find. Seeing an IR LED is a little difficult.. seeing as our eyes can’t see it. Fortunately a camera can so I used my smartphone to see the LED. I couldn’t see it.  It took me a while to discover, because the LED is sending a command it’s modulating so fast and that on my smartphone it was very faint.  When I wrote some code to test the IR Led I was giving it full constant power so it was nice and bright on my screen. When I used the library to send a remote command it was dim, but working fine.  Here’s a video, if you look really closely, you’ll see the IR LED pulsing slightly.

    http://youtu.be/3gVDKSJln2s

    So why didn’t my IR LED turn on my TV? I’d forgotten to prefix the HEX code with 0x.  I’ve learnt that before… but forgotten. Now I know it again, at least until I forget again.

    With that fixed, my remote was working. All I had to do was tidy up the code, position the Arduino and LED somewhere in range of the TV and watch it work. Here’s what it looks like:

    CabinetWiring

    Here’s the code:

    //Steve Root's IR signal to turn TV on when Arduino powered
    //
    //Created because our showroom TV doesn't turn on when the power comes on
    //The power only comes on when people walk into the showroom
    //So this arduino will pause for a short while then send the command
    //TV_on via infrared to the TV.
    
    #define NECPower 0xFE50AF //NEC TV power. the 0x in front is because FE50AF is hex
    
    #include <IRremote.h>
    
    IRsend irsend;
    
    void setup()
    {
    //when the device is powered, pause then send remote TV on by IR
    delay(15000);
    //15 second delay. the tv takes a while to wake up.
    irsend.sendNEC(NECPower, 38);
    
    }
    
    void loop() {
    //nothing to do here now.
    }

     

    Note for future me: IR LED connects pin 3 to ground


  • A quick review of WordPress comment and trackback spam

    One down side of running a blog has got to be the amount of comment spam.  I’m going to have to put in place better systems to stop it but before then, here’s a brief unscientific analysis of the last 23 spam comments (they all get held until I approve them) and what I think the spammers are trying to do:

    1) Trying to flog fakes

    Brand name sunglasses are popular. Rayban and Oakley frequently appear.  Also hand bagsThe destination sites appear to like Western Union money transfer and a good number are based in China.

    Sometimes the link(s) they include point to another site which then links to their site

    They comment with phrases like

    “Have a good day!I’m very pleased when see your post.I quite approve of your point of view.I will continue to following on your blog.I believe that the future I will see more about your wonderful views….”

    “If you thinkI do not care to set eyes on this article, the next time I am concerned about your article, I think I will never again careless. Do you be satisfied of yourself, you do not know your article can make people so obsessed with….”

    One of my recent favourites, several appear to have an error in their code,

    Have a {great|good|excellent|fantastic} day!I’m very {happy|glad|pleased} when see your post.I quite {agree with|endorse|approve of} your {point of view|viewpoint|standpoint|views on politics|opinion on public affairs}.I will continue to {focus|atte…

    My web server is in Paris. A fair number of spammers appear to recognise this fact, spamming with French phrases like “longchamp pas cher”

    2) … actually, it appears they all want to sell fakes

    All the spam was trying to sell fakes and it was all priced in US dollars.  My really simple anti spam question commenters have to answer stops a lot of the robots.  Here’s an extract from the logs which shows one persistant robot being refused.

    www.steveroot.co.uk 175.42.80.130 - - [28/Apr/2013:18:21:37 +0200] "POST /wp-comments-post.php HTTP/1.1" 500 4132
    www.steveroot.co.uk 175.42.80.130 - - [28/Apr/2013:18:21:44 +0200] "POST /wp-comments-post.php HTTP/1.1" 500 4132
    www.steveroot.co.uk 175.42.80.130 - - [28/Apr/2013:18:21:47 +0200] "POST /wp-comments-post.php HTTP/1.1" 500 4132
    www.steveroot.co.uk 175.42.80.130 - - [28/Apr/2013:18:21:52 +0200] "POST /wp-comments-post.php HTTP/1.1" 500 4132
    www.steveroot.co.uk 175.42.80.130 - - [28/Apr/2013:18:21:58 +0200] "POST /wp-comments-post.php HTTP/1.1" 500 4132
    www.steveroot.co.uk 91.121.64.168 - - [28/Apr/2013:18:31:23 +0200] "POST /wp-comments-post.php HTTP/1.0" 500 4130
    www.steveroot.co.uk 175.42.80.130 - - [28/Apr/2013:18:32:02 +0200] "POST /wp-comments-post.php HTTP/1.1" 500 4132
    www.steveroot.co.uk 175.42.80.130 - - [28/Apr/2013:18:32:07 +0200] "POST /wp-comments-post.php HTTP/1.1" 500 4132
    www.steveroot.co.uk 175.42.80.130 - - [28/Apr/2013:18:32:12 +0200] "POST /wp-comments-post.php HTTP/1.1" 500 4132
    www.steveroot.co.uk 175.42.80.130 - - [28/Apr/2013:18:32:15 +0200] "POST /wp-comments-post.php HTTP/1.1" 500 4132
    www.steveroot.co.uk 175.42.80.130 - - [28/Apr/2013:18:32:25 +0200] "POST /wp-comments-post.php HTTP/1.1" 500 4132
    www.steveroot.co.uk 175.42.80.130 - - [28/Apr/2013:18:32:29 +0200] "POST /wp-comments-post.php HTTP/1.1" 500 4132
    www.steveroot.co.uk 142.4.209.47 - - [28/Apr/2013:18:32:36 +0200] "POST /wp-comments-post.php HTTP/1.0" 500 4130

     


  • How to get noticed on LinkedIn (before LinkedIn existed)

    What a pleasant surprise!  I had a contact through LinkedIn (which, to be honest, I don’t really use very much) from Hannah Skerritt of Qube Recruitment Ltd saying

    Hi Steve
    you just popped up on my “people you my know” screen and for the first time I think I do!! I think we studied together for a very short while many many years ago… Did you study software engineering at Mid Kent?

    Whilst I didn’t study Software engineering, I did do a business studies course there as part of a training scheme with GEC Avionics in Rochester.  So a short email conversation with Hannah later she explained she remember me from the induction training week we both did there.  There were about 40 of us starting different training schemes that week.  So having met me for that short period of time she remembered me because of the way I introduced myself.  She says that I said:

    I’m Steve Root, that’s Steve with a V and Root like a tree

    Wow! I remember using that in the past but didn’t realise it had such an effect. It’s impressive and humbling to be remembered for that long simply because of a few words of introduction. Maybe I’ll need to start future presentations with that phrase.

    Also worth noting is how lucky it was that LinkedIn made the connection. I’ve not put on linked in that I worked at GEC or that I studied at Mid Kent College so I think the only connection it could have had to work on was that I’m also in the ME postcode area. We have no other links in common.


Search this site


Free apps

  • birthday.sroot.eu – Your birthday or other celebration date based on [years on other planets] / [how many seconds/days] / [how far you’ve travelled around the sun]
  • stampulator.sroot.eu – Calculates the combination and how many 1st, 2nd, large 1st and large 2nd class Royal Mail stamps you need on large envelopes and packets

Recent posts


Archives


Categories