OnAir! Home working with Style

So this week someone also called Dave gave me this idea of having an OnAir sign which comes on when you go into a video conference. Being “On Air” for me is when the camera is on. One could also look at being in a conference and or detecting the mute button and that could also be done I suppose. So I had a quick Google around looking for a cheap studio style OnAir sign and I came up with the good British product here. Cheap as chips – all it does is switch on and off and can be powered by USB or batteries.

Detecting whether Windows has an active camera I use a registry hack to establish that posted here.

So time to hack. I had a couple of Adafruit ESP32 Huzzah boards kicking about and that was my preference since I can drive it with Wi-Fi and serial. My first MVP was just serial. Wi-Fi also works very nicely with the ESP and the Arduino Wi-Fi manager. Wi-Fi with batteries probably not the best idea. So in general I’m happy with the USB to PC version so I can drive it with the serial port. Depending on a chosen location – Wi-Fi might be better. But the Serial port means it always works quite well.

Modified Interior View…

The device is very simple. When powered it has a simple push switch that has a full-on mode – a pulse mode and off. Its sequential – so a simple push cycles you thorough these modes. So my approach was to emulate the pushes with the ESP32 and an on/off using the relay. The push switch uses an opto-isolator so that I dont actually touch any of the electronics so it will still work as designed.

So in the above photo, we have an ESP32 at the left- no probs there. Rather than trying to hack up the board I too the safe approach and used a clunky relay to switch on and off the USB port. Reason being I can always guarantee state of the device. The relay is driven by a I/O port on the ESP32. The opto-isolator is on the right and that simply controls the push switch. Again using a GPIO pin on the ESP32.

The simple code for the ESP32 – done with Arduino of course just connects to the serial port and does a digital write as needed. WiFi version coming along. The serial port code listens for a single byte char – 0,1,2,or 9 and takes action and responds with a simple OK. Modem like…. In this example we switch the device off. Relay switch off – all done.

if (incomingByte == 48 ) {
   // Switch off 0
   Serial.println("OK");  
   digitalWrite(ledPin, LOW);
   digitalWrite(onPin, LOW);
   digitalWrite(switchPin, LOW);
}

Simulating in Arduino IDE – it looks like this:

Arduino Monitor app

I use Windows because I like things that work and I also like C# so its easy to create an app – System Tray app that can be used to detect the state of a webcam – on/off and then send a message to the ESP32 device.

The Wi-Fi part is simple enough as well. I use the Arduino web server and set up some routes. So if the IP address was 192.168.1.137 – then a GET rest call will switch it on.

http://192.168.1.137/setOn … setOff and so on – the routes are like this:

void setup_routing() {
  server.on("/setOn", setOn);
  server.on("/setOff", setOff);
  server.on("/setPulse", setPulse);
  server.on("/reset", handleReset);

  // start server    
  server.begin();
}

The reset will reset the whole device and clear the Wi-Fi settings bring you back to the WiFi Manager login screen where you can set you Wi-Fi SSID and password.

The full code is here with the ESP32 – not particularly elegant but you get the idea.

So when one is not in a call – this is the app – although it sits in the Windows System Tray – the Windows app looks like this:

App with off Air Status

When the Webcam is switched on

On Air activated

The detect mode will detect if the camera is in use. You can also set a manual mode where you just switch the device on and off.

The Device works quite nicely – and you can also select which app you want to use – if you have Zoom / Teams etc installed and test connection.

So when you switch on your camera in a home video conference – your light will come on which is handy for other family members that might not want to be seen etc etc. …..

I also added a system tray notification that pops up with a On Air message so that you know if your device has activated.

I am looking at developing an Electron JS version just because I like Electron and of course it could run on a non Windows device – but come on – who wants that ?

OnAir working….

Roomba, Particle Photon, IFTTT and Flic

I did this project on the back of this lad – he did all the work. I had a Roomba 615 that I bought in Spain. Basic model but it still has a serial port. I couldnt find that much info about it – I think it seems to work with the 500 or 600 Roomba serial port interfface descriptions.

But I couldn’t do a few things that I thought should have worked like wake up the robot with hardware – I could change the baud rate – and I can get the battery charge and the current through the motors but in general it seems a bit useless if you cant accurately tell what the darn thing is doing. It drove me potty to be honest and I ended up hacking it.

For example you can send it 135 – which starts cleaning – but lets say someone presses a button – there is no way to easily tell if its still running. This was an older one so more a bit of fun.

The code I wrote is here Its a simpler version to the original. The Particle stuff is also pretty neat because it exposes the board as a Wifi and REST so its easy enough to integrate with and looks quite robust. So for example you can send a command to it – I just kept it simple and use the Roomba defined opcodes to drive it. Its really tasty – for example you can send a command to your board with no fuss like this:

https://api.particle.io/v1/devices/mydevice/wakeup

So building the din plug and voltage reg was simple enough – I thought that the Roomba doesn’t have proper serial flow management – no hardware or software flow control which makes it interesting but not exactly reliable.

I also like flic – and Google Home – so I used IFTTT to create an applet to use Google home and a Flic button. The Particle integration with IFTTT is great and you can send commands to the board from a flic or google home.

I used a simple box and took the plastic cover off the Roomba so that it can be replaced without damaging it.

Here are a few photos of the caper…

Particle Photon connected via USB
Run testing Roomba
Flic Button – this is connected to a flic hub
In Production
Roomba looking a bit dusty
Adding the flic button to IFTTT

Docbrokers in the Cloud

Randy Watson once sang the cloud is our future and so it is especially on Google Cloud which I love dearly. Anyway putting Documentum onto a cloud platform seems like a good idea and avoids all sorts of corp IT complications.

The Docbroker provides the address of a Docbase and its port. If the Documentum server is running on an cloud server it will be running on an internal network address. You need to translate that and its easy enough.  If you dont you will probably get this helpful message:

[DFC_SESSION_DOCBASE_UNREACHABLE] 

[DOCBROKER_CONFIGURATION]
secure_connect_mode=dual

[TRANSLATION]

' Documentum Ports
port = '47625=47625'
port = '47626=47626'
host = '45.324.124.45=10.156.0.2'

So what you need to do is provide the internal and external IP address and port.  The format here is; external=internal

Thats it

 

Freeboard Stuff

Freeboard is one of these things that works really well and you want to bite the back of your hand when you get stuff working.

I had this issue though when developing some local web services with SparkJava and testing them on my local machine with localhost

I was using Chrome. Seems like Chrome doesnt support CORS on localhost. I used IE and Edge and it worked. I was building some simple web services and Java and by adding the following headers it worked fine.

res.header(“Access-Control-Allow-Origin” ,”*”);
res.header(“Access-Control-Allow-Credentials”,” true “);
res.header(“Access-Control-Allow-Methods”,” OPTIONS, GET, POST”);
res.header(“Access-Control-Allow-Headers”, “Content-Type, Depth, User-Agent, X-File-Size, X-Requested-With, If-Modified-Since, X-File-Name, Cache-Control”);

http://stackoverflow.com/questions/3136140/cors-not-working-on-chrome
http://stackoverflow.com/questions/10883211/deadly-cors-when-http-localhost-is-the-origin

DAXCAD Lives on Ubuntu 14.10

My good friend John Lawson is planning to port DAXCAD to the Raspberry Pi..  I have ported this  now  https://bitbucket.org/DaveRobertson/daxcad/branch/LinuxPort – I’ll merge it all back again when I get it fully working..  The current version of gfortran 4.9 looks good and on a Linux machine the whole thing builds in less than a minute.  I seem to remember a full build on an Apollo DN400 would be at least an hour.  Anyway still a testament to Fortran and C for being reasonably portable.

DAXCAD on Ubuntu 14

DAXCAD on Ubuntu 14

Install Documentum 6.7 on Linux

Everything looks good but do these please

yum install libXtst.i686 libselinux.i686 audit-libs.i686 cracklib.i686 db4.i686 pam.i686 libstdc++.i686 zlib.i686 ksh -y

yum install bc

bashrc

# Uncomment the following line if you don’t like systemctl’s auto-paging feature:
# export SYSTEMD_PAGER=

# User specific aliases and functions
export ORACLE_HOME=/u01/app/oracle/product/11.1.0/db_1
export ORACLE_SID=orcl
export TNS_ADMIN=/u01/app/oracle/product/11.1.0/db_1/network/admin
export LC_ALL=C
export JAVA_HOME=/home/ec2-user/documentum/shared/java/1.6.0_17
export DOCUMENTUM=/home/ec2-user/documentum
export DM_HOME=/home/ec2-user/documentum/product/6.7
export DOCUMENTUM_SHARED=$DOCUMENTUM/shared
export CLASSPATH=$DOCUMENTUM_SHARED/dctm.jar:$DM_HOME/dctm-server.jar:$DOCUMENTUM_SHARED/config
@

Amazon EC2 – putty timeouts

I’m getting into this EC2 stuff – its pretty good. But on a putty session – the default session timeouts are like 2-3 mins after inactivity.

I added this to an Ubuntu 13.10 build

sudo vi /etc/ssh/sshd_config

ClientAliveInterval 30
ClientAliveCountMax 5

Works…

DAXCAD 2013 – Eclipse

I have been working a bit on Daxcad this year – if only to get it into GIT and Bitbucket.  My repo is here

https://bitbucket.org/DaveRobertson/daxcad/overview

So I have an eclipse project set up with the original source -this is for CYGWIN 32 bit only -so you will need to download Cygwin with X although other X servers can be used – I used this one as well as cygwin X server which is actually quite good if you use their seamless mode ( startxwin )

http://mobaxterm.mobatek.net/download-home-edition.html

Eclipse Kepler - 2013 using CDT and Fortran perspective

Eclipse Kepler – 2013 using CDT and Fortran perspective

Daxcad drawings are supplied in the build – you can read in DXF and IGES… not for the faint of heart – mind you never was.  This picture is from the mobXterm server.  Looks fast enough.

Daxcad drawing from around 1989

Daxcad drawing from around 1989

Serial Port Mini RS232 to TTL Converter Adaptor Module Board MAX3232 with Arduino

So I buy 5 of these little things when I find out I am dealing with RS232 device instead of a TTL device.  They arrive quick and I am delighted only to find I dont quite know how to wire them up.  The project is to use an Arduino – which I love dearly – to drive an LED rolling display. I am not an electronics expert – so I struggled a little and popped 2 of them good and proper..

Never mind.  I’ll buy this instead http://www.ebay.co.uk/itm/RS232-Serial-Port-to-TTL-Converter-Module-Board-MAX232-for-PIC-ATMEL-MCU-5V-/260995809488?pt=UK_Computing_Other_Computing_Networking&hash=item3cc49000d0

I am as always standing on the shoulders of giants – http://www.sundh.com/blog/2012/04/arduino-library-for-led-message-display/comment-page-1/#comment-93629

T2k60XXmhOXXXXXXXX_!!12774208

So my experience is:

From the RS232 Port – RX, TX and GND.  Thats the -> -<and the – signs.  Easy enough

– GND

-> RX

<- TX

On the TTL (Arduino)  side – DO NOT USE 5V use 3.3V as this toasts the device and heats up and like tops itself.  It certainly got very toasty when I put 5V across it.  This could be because I messed up somewhere in the wiring but it certainly works well for me.  I can also use the SoftwareSerial library as well so I don’t need to use TX/RX on the TTL Serial pins 0 and 1

So TTL is

– GND

-> – PIN X

<- PIN Y

For my device I used PIN 0 and PIN 1 – TX/RX – but I guess you can use other pins.

TTL RS232 Pinouts

TTL RS232 Pinouts

 

 

Hope this helps – it does work!

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");
*/

}

}