Updated RoboSapien IR Control – Arduino
There is a brilliant hack for these http://playground.arduino.cc/Main/RoboSapienIR. I wired this up – but I ended cutting up the poor thing – so I thought I could try it with an IR transmitter instead to do the same thing. Also means you dont have to ruin your soldering iron punching a hole through the body
I decided to use the Ken Shirriff IR library. Its work of genius.
http://www.righto.com/2009/08/multi-protocol-infrared-remote-library.html
But it didnt have one for Robosapien. The way it works is pretty cool – but you need a couple of days hack time to figure it out. The codes from the sapien controller seemed to be in single bytes – so with some effort I managed to get it to transmit those codes. I tried it on 6 sapiens I bought for a school project.
I updated three of the library files. I have not included the whole library – just the updated files – so best way is to downloaded Ken’s library and then just replace with these files here
You’ll need an IR Transmitter with an Arduino board. Something like this http://emartee.com/product/42200/ This project looks like the sort of thing you want to do: http://jerrylparker.com/?p=94
Wire it up with Pin 3 and make sure you hold the transmitter close to the Robots head. These arduino ones dont have much power and I found the transmitter needed to be within 10-15cm. However the idea is to be able to replace the onboard controller with Arduino – so you can still do that and without hacking up the toy.
I mapped out the buttons to codes – so in the Arduino sketch – use commands like irsend.sendRSV1(142); The sketch is at the bottom. Its pretty simple. I had done two types – ones where you have a set sequence. The other was to initiate the sequence from a PC. Hence the Serial.read(). I use Processing for that stuff – its amazing as well.
This was done in Excel – which you can download here. This is the simple pasted version.
| Button | Controller | Function | Presses | Arduino Code |
| 12 | Red | Turn Right | 1 | 128 |
| 1 | Red | Right Arm Up | 2 | 129 |
| 4 | Red | Right Arm Out | 2 | 130 |
| 5 | Red | Tilt Body right | 1 | 131 |
| 2 | Red | Right Arm Down | 2 | 132 |
| 3 | Red | Right Arm In | 2 | 133 |
| 11 | Red | Walk Forward | 2 | 134 |
| 15 | Red | Walk Backwards | 2 | 135 |
| 14 | Red | Turn Left | 1 | 136 |
| 6 | Red | Left Arm Up | 2 | 137 |
| 9 | Red | Left Arm Out | 2 | 138 |
| 10 | Red | Tilt Body Right | 1 | 139 |
| 7 | Red | Left Arm Down | 2 | 140 |
| 8 | Red | Left Arm In | 2 | 141 |
| 13 | Red | Stop | 1 | 142 |
| 19 | Red | Master Command Program | 1 | 144 |
| 20 | Red | Program Play | 1 | 145 |
| 16 | Red | Right Sensor Program | 1 | 146 |
| 18 | Red | Left Sensor Program | 1 | 147 |
| 17 | Red | Sonic Sensor Program | 1 | 148 |
| 12 | Green | Right Turn Step | 1 | 160 |
| 1 | Green | Right Hand Thump | 1 | 161 |
| 4 | Green | Right Hand Throw | 1 | 162 |
| 5 | Green | Sleep | 1 | 163 |
| 2 | Green | Right Hand Pickup | 1 | 164 |
| 3 | Green | Lean Backward | 1 | 165 |
| 11 | Green | Forward Step | 1 | 166 |
| 15 | Green | Backward Step | 1 | 167 |
| 14 | Green | Left Turn Step | 1 | 168 |
| 6 | Green | Left Hand thump | 1 | 169 |
| 9 | Green | Left hand Throw | 1 | 170 |
| 10 | Green | Listen | 1 | 171 |
| 7 | Green | Left Hand Pickup | 1 | 172 |
| 8 | Green | Lean Forward | 1 | 173 |
| 13 | Green | Reset | 1 | 174 |
| 19 | Green | Master Command Program | 1 | 176 |
| 20 | Green | Wake Up | 1 | 177 |
| 16 | Green | Right Sensor Program Execute | 1 | 178 |
| 18 | Green | Left Sensor Program Execute | 1 | 179 |
| 17 | Green | Sonic Sensor Program Execute | 1 | 180 |
| 12 | Orange | Right Hand Strike 3 | 1 | 192 |
| 1 | Orange | Right Hand Sweep | 1 | 193 |
| 4 | Orange | Burp | 1 | 194 |
| 5 | Orange | Right Hand Strike | 1 | 195 |
| 2 | Orange | High 5 | 1 | 196 |
| 3 | Orange | Right Hand Strike | 1 | 197 |
| 11 | Orange | Bulldozer | 1 | 198 |
| 15 | Orange | Oops | 1 | 199 |
| 14 | Orange | Left Hand Strike 3 | 1 | 200 |
| 6 | Orange | Left Hand Sweep | 1 | 201 |
| 9 | Orange | Whistle | 1 | 202 |
| 10 | Orange | Left Hand Strike | 1 | 203 |
| 7 | Orange | Talk Back | 1 | 204 |
| 8 | Orange | Left Hand Strike | 1 | 205 |
| 13 | Orange | Roar | 1 | 206 |
| 19 | Orange | All Demo | 1 | 208 |
| 20 | Orange | Power Off | 1 | 209 |
| 16 | Orange | Demo 1 | 1 | 210 |
| 18 | Orange | Demo 2 | 1 | 211 |
| 17 | Orange | Dance Demo | 1 | 212 |
/*
Based on IRSend demo from ken Shirriffs library - this sends simple commands to a RoboSapien V1 using
and IR Transmitter with Arduino
*/
#include <IRremote.h>
IRsend irsend;
IRrecv irrecv(11);
void setup()
{
Serial.begin(9600);
}
void loop() {
irsend.sendRSV1(142);
delay(1000);
if (Serial.read() != -1) {
Serial.println("started");
irsend.sendRSV1(129);
irsend.sendRSV1(199);
/*
irsend.sendRSV1(129);
irsend.sendRSV1(129);
delay(1000);
irsend.sendRSV1(169);
delay(2000);
irsend.sendRSV1(162);
delay(2000);
irsend.sendRSV1(173);
delay(2000);
irsend.sendRSV1(196);
delay(2000);
irsend.sendRSV1(206);
delay(2000);
irsend.sendRSV1(199);
delay(2000);
Serial.println("Done");
*/
}
}
Mac with Windows
I have been experimenting with the best way of having both Windows and MAC. Linux is great for servers – but you dont need it for apps. I’ve got Lion on a 27 Inch iMac. So I loads up Oracle VirtualBox. Its like VMWare except its free and its amazing. So within maybe 1/2 hour I got Windows 7 running in a seamless mode – which means I really do have the best of both. I need Mac for development and xcode – but I can also run the Windows sessions on Visual Studio – works like a charm.
https://www.virtualbox.org/ – you can get the Mac version here. It’s really very easy to set up.
I am going to get a 4Gb upgrade for starters – I put Windows 64 bit on as well – so it makes sense to have a bit more. But you can’t do two things at once so VB seems to allow you to reallocate. I really like the seamless mode – just works together very nicely.
Arduino – Pond Filler Upper
I have this little pond see. Its not terribly big and it looks quite nice – but it has a small leak somewhere. And its driving me nuts. So in a moment of geekery I thought the problem could be solved with a bit of software and an Arduino board. So I concocted a small plan to keep the pond topped up. Nothing too complex – just used a water level sensor and a solenoid driven water valve. I also used the excellent Ciseco relay for Arduino. Simple and elegant. Some pics here of the installation. It’s really just a prototype – if it works I’ll put a more rugged version together.
- Project Box with LED and Switches
- Arduino and Power Supply
- Hose Solenoid Valve
- Tank Sensor in Pond
- Outlet Hose
Parts List
- Arduino Duemilove
- Hose Solenoid ( This is one from Ebay ) Its 12v
- Tank Sensor ( Again from Ebay )
- Ciseco Relay
- Wires of various kinds
- Project Box
- Switches
- LED
- Resistors – 10k, 1k – switch controls
- 12-9V Regulator – I used this with a Capacitor so I can drive everything off a 12v DV PSU
- 12V DC PSU
This is the Sketch to control the board
The sketch is rather simple and a bit clumsy. I used the timerone library. It works by trying to detect if the water has been running for more than WATERTIMEOUT. If it does it waits for WAITIME. If it does that more than SYSTEMJAMED times – then the system switches off. This should protect it if the sensor jams open. I reckoned 1 minute at my water pressure was enough to fix the leak.
Still got to check if the sensor bounces for a few seconds but so far it works quite well.
#include <TimerOne.h>
/*
* Pond Relay
* August 2011 (c) Dave Robertson
* Arduino based pond relay with CISECO relay http://www.ciseco.co.uk/content/
*/
#define SYSTEMJAMMED 10 // Number of times the system starts a wait look
#define WATERTIMEOUT 60 // Number of seconds to run the sensor
#define WAITTIME 60 // Number of seconds to wait until running again
// constants won't change. They're used here to
// set pin numbers:
const int sensorPin = 2; // the water sensor switch
const int switch1Pin = 3; // control switch 1 - Manual Override
const int switch2Pin = 5; // control switch 2
const int ledPin = 13; // the number of the LED pin ( ardunio diag only )
const int relayPin = 7; // the number of the relay pin that controls the valve
long timerRunning; // Number of seconds since we started
long waterrunningTimer = 0;
long waitingTimer=0;
const int ledStatus = 4; // the number of the LED pin
int systemJammed=0; // The system is jammed so switch it off
int overrideSystem=0; // Override the system and shut off the valve regardless
int s1State = 0; // variable for reading the pushbutton status
int s2State = 0; // variable for reading the pushbutton status
int sensorState = 0; // variable for reading the pushbutton status
int oldsensorState = 0; // variable for reading the pushbutton status
int ledFlash =0;
int beginwait=0; // Controls waiting for next
void setup()
{
pinMode(10, OUTPUT);
Timer1.initialize(1000000); // initialize timer1, and set a 1/2 second period
Timer1.attachInterrupt(callback); // attaches callback() as a timer overflow interrupt
pinMode(ledPin, OUTPUT);
pinMode(ledStatus, OUTPUT);
// initialize the pushbutton pin as an input:
pinMode(switch1Pin, INPUT);
pinMode(switch2Pin, INPUT);
pinMode(sensorPin, INPUT);
pinMode(relayPin, OUTPUT);
digitalWrite(relayPin, HIGH);
delay(2);
digitalWrite(relayPin, LOW);
Serial.begin(9600);
Serial.println("Starting Now 5 Second Delay");
// Flash to indicate we starting up
for (int i=0;i<100;i++) {
delay(50);
digitalWrite(ledStatus, digitalRead(ledStatus) ^ 1);
}
Serial.println("Entering loop");
}
//
// Timer call back here - update timers and LED for status
//
void callback()
{
// Flash the led to show valve is on
Serial.println(s1State);
Serial.println(s2State);
if (systemJammed>SYSTEMJAMMED) {
Serial.println("System Jammed - all off");
for(int i=0;i<10;i++) {
digitalWrite(ledStatus, digitalRead(ledStatus) ^ 1);
delay(1000);
}
return;
}
// if (ledFlash)
// digitalWrite(ledStatus, LOW);
// else
// digitalWrite(ledStatus, HIGH);
if (sensorState && !beginwait) {
waterrunningTimer+=1;
Serial.print("Water is running now for secs: ");
Serial.println(waterrunningTimer);
}
timerRunning += 1;
// We rest after 24 hours as this a fine time window for what we want
if (timerRunning == 5184000) {
timerRunning = 0;
waterrunningTimer = 0;
Serial.println("Time now");
}
// Increment the waiting timer
if (beginwait) {
digitalWrite(ledStatus, digitalRead(ledStatus) ^ 1);
Serial.println("Water ran too long - switched off waiting");
waitingTimer++;
}
}
void loop()
{
// Get the state of water sensor and switches
sensorState = digitalRead(sensorPin)^1;
s1State = digitalRead(switch1Pin)^1;
s2State = digitalRead(switch2Pin)^1;
if (s2State == HIGH) {
// System off - no action
digitalWrite(ledPin, LOW);
digitalWrite(relayPin, LOW);
waterrunningTimer=0;
digitalWrite(ledStatus, LOW);
oldsensorState = LOW;
waitingTimer=0;
beginwait=0;
systemJammed=0; // Reset jammed sensor counter
//Timer1.stop();
return;
}
else {
// Timer1.start();
}
if (s1State == HIGH) {
// Override sensors and reset everything
if ( oldsensorState == LOW)
{
waterrunningTimer = 0;
oldsensorState = HIGH;
}
//digitalWrite(ledStatus, LOW);
digitalWrite(ledPin, HIGH);
digitalWrite(relayPin, HIGH);
digitalWrite(ledStatus, HIGH);
systemJammed=0;
return;
}
if (systemJammed > SYSTEMJAMMED)
return;
if (sensorState == LOW ) { // Clear everything as water has filled
// Sensor has read water filled
digitalWrite(ledPin, LOW);
digitalWrite(relayPin, LOW);
waterrunningTimer=0;
digitalWrite(ledStatus, LOW);
oldsensorState = LOW;
waitingTimer=0;
beginwait=0;
systemJammed=0; // Reset jammed sensor counter
}
if (waterrunningTimer > WATERTIMEOUT ) {
// Water has been running for over a minute and the sensor is still high
sensorState=LOW; // Switch it off
digitalWrite(ledPin, LOW);
digitalWrite(relayPin, LOW);
digitalWrite(ledStatus, LOW);
oldsensorState = LOW;
if (!beginwait) {
Serial.println("Water running too long");
waitingTimer=0;
beginwait=1;
systemJammed++;
}
}
if (beginwait && waitingTimer>WAITTIME){
Serial.println("Timeout - switching off");
beginwait=0;
waitingTimer=0;
waterrunningTimer=0;
}
// The sensor state read
if (sensorState == HIGH ) {
if ( oldsensorState == LOW)
{
waterrunningTimer = 0;
oldsensorState = HIGH;
}
//digitalWrite(ledStatus, LOW);
digitalWrite(ledPin, HIGH);
digitalWrite(relayPin, HIGH);
digitalWrite(ledStatus, HIGH);
}
}
CMIS
Content Management Interoperability System.
Had a quick look at this for a client last week. Managed to get it working with Documentum from .NET clients – a bit slow but it does work.
I used the DotNET client from openCMIS – Apache Chemistry. http://incubator.apache.org/projects/chemistry.html
DotCMIS is the best thing I found – although I really struggled to get web services working with Documemtum – so I used the AtomPub binding and the session factory.- that seemed to work reasonably well.
openVMS
I must be mad – going back in a timewarp to my first job – programming on a DEC PDP 11/34
So anyway I needed to do a DCL script for openVMS – which is still alive apparently. So using FreeAXP and openVMS – I managed to get a VMS session up again.
Why people think VMS is good in the world of Unix and Windows is beyond me. Navigating around the filesystem is just plain confusing. But I was able to boot it up and get it working – so all credit to those folks at FreeAXP – works fine for me.
SO I’m writing DCL again…
Maybe I’m in dreamland…
Arduino and LadyAda Wave Shield
I’ve been messing around with my fantastic Arduino board. The whole Arduino thing is without question an Italian masterpiece of our generation. I could spend 24 hours a day just messing with it. The software side is as elegant as the hardware side – the idea you can add C++ and Java libs is stunningly brilliant.
Anyways – I wanted to do something with it – and I decided I wanted to build a simple SFX box for my little rock band. We use sequencers and MIDI – but I wanted to do AC/DC’s For those about to rock. The song has some nice cannon fire effects and this really has to be in the mix for a live performance. So I thought that if the Arduino can be used. I’ll be doing a more complex project later using Arduino to drive MIDI for live performance.
So I bought a kit for a the Wave Shield from AdaFruit – very very good business that – and sampled some effects. I then put together a new app based on the supplied player code on the AdaFruit site – hooked up a couple of footswitches on the Arduino and thats it – super fast special effects in WAV format – for the AC/DC song – some nice real cannon fires. Hook it all up to the PA and boom.. nice.
This is the Arduino with a Wave Shield all hooked up in test
Footswitch found in dump… RS good quality – works well on stage
Buy the Arduino at RS Components and get the Wave Shield and info at www.adafruit.com/waveshield. Get the footswitch at your local tip/dump/junkyard/scrapyard
Afternoon Tea – A Review
I’m not a theatre critic as you can probably tell but I do like the theatre. An so it was that I went to see a play in Manchester City centre on Saturday evening.
Afternoon Tea, a short play written by Lindsay Kernighan was performed at the Taurus Bar in Canal Street in Manchester. The basement of the bar had been transformed into a small 50 seater theatre – an intimate setting for a uniquely intimate play.
On descending to the basement theatre – we were met with a tea room setting. Walking past the actors – you immediately had a sense of attention to detail that would make this short play interesting. As the actors nibbled on their cakes – my appetite for a good performance was whetted.
I was not disappointed. This was the last of 4 performances and it was clear that the actors and the director had established themselves and were comfortable in the setting and their roles. The writing was sharp and observational and at the same time had a touch of surrealism – like Father Ted without the priests – Mrs Doyle would not have been out of place serving her tea sandwiches and goading with a few go-ons
For me – the main thrust of the story was the young girl /old guy couple – struggling to find common ground and although the plot thread was clichéd to an extent – it was well performed and believable. The other couple – a two well heeled ladies of lunches who have a good old gossip – was nicely interwoven. I particularly liked the character of the “old guy” – William – whom having managed to catch himself a 25-years-younger female was aptly demonstrating that he was not satisfied by admiring himself having caught the eye of a presumably even younger checkout assistant in Tesco… You knew this would end with a soaking!
The performance of the ladies was engaging as it was funny. Clearly the actors were comfortable and the banter and the gestures led to a sharp and comical interpretation of the roles. “Making a dozen sweaters out of her mop” – nicely delivered.
The story was lightweigth – I didnt lose any sleep - but it wasnt meant to change hearts – only make sure you’d enjoyed your visit. I did.
The 35 minutes went by far too quickly and for me and the rest of the audience enjoyable. I’d go back again and I ended up staying in the bar for some food and some nicely poured Leffe Blond. As an evening – well it was memorable, enjoyable and I’d recommend them went they go back to the Buxton Fringe..
Webtop Browser Tree
In webtop or any WDK app if you see
This folder has more than 1000 objects, use doclist to browse to desired folder, then modify this thing:
wdk\strings\com\documentum\web\formext\control\docbase\DocbaseFolderTreeNlsProp.properties (version 6.5)
Adding text to Webtop delivered documents
I always thought that it would be pretty cool to use Webtop as a viewing tool directly – something that access a Docbase directly. If you have umpteen million users – then caching is a good idea – but in a corporate environment where a few thousand users – well why not.
So I use Webtop as the delivery platform and the virtual link component. I’m sure you could do this better – but this works fine. The idea is that a user access a document using a virtual link – a straight HTTP link. The document must be PDF – and when it comes out of the repository – its stamped with a small watermark. This gives a better level of integrity – if you print it off for example then you’d know where it came from. With everything being in Webtop it gives you a good opportunity to add in any Documenutm properties/values that may be appropriate for content.
You need iText – without doubt brilliant.
Add that as an external JAR to your Webtop Eclipse project. I put the iText jar into the tomcat lib.
Create a custom package area in webtrop/custom/src/com/document/web/virtuallink – place this file in it. http://www.dhrobertson.com/projects/vlink/VirtualLink404Handler.java That should recompile and replace the class file in the webtop app. You could also do this by subclassing the whole thing – but it seemed easier to do it this way.
All that happens is when the document eventually gets extracted from the repository – an iText function is called to create a new file – this is the one thats viewed. Its all done in a local folder so everything gets deleted by Documentum – which is handy
Thats it – the watermark I’ve applied is a bit crap – but you can buy the iText book – details here http://itextpdf.com/book/index.php and do your own thing… If you want.
You can also extend the view action – so that you can do same sort of thing with a view of a document. Its a bit more involved – but extending webtop view action.
Again I did this with full debug on Webtop – that works very well I have to say and using iText means that it works on ‘nix and Windows platforms…
Rails Standalone
My employer proxy just makes it difficult sometimes… So to install Ruby on Rails standalone
Do everything on http://rubyonrails.org/download until yu get to gem install rails
Then you need to download and install these packages from http://gemcutter.org
H:\Development\ruby>gem install rails
Successfully installed rake-0.8.7
Successfully installed activesupport-2.3.5
Successfully installed activerecord-2.3.5
Successfully installed rack-1.0.1
Successfully installed actionpack-2.3.5
Successfully installed actionmailer-2.3.5
Successfully installed activeresource-2.3.5
Successfully installed rails-2.3.5
8 gems installed
Thats it- not much but if you get this post it might have a valuable 5 mins off your time to rails and that could make all the difference
-
Archives
- May 2013 (1)
- October 2011 (1)
- September 2011 (1)
- March 2011 (1)
- February 2011 (1)
- October 2010 (1)
- April 2010 (1)
- February 2010 (4)
- December 2009 (1)
- June 2009 (1)
- March 2009 (1)
- February 2009 (1)
-
Categories
-
RSS
Entries RSS
Comments RSS






