a lot more of those hci 0x0f errors will keep appearing but connection holds.

Also got a ‘/dev/input/js0’ device but with much more Axles (15) and Buttons (31). But buttons seem duplicated – for instance the big round button ‘A’ is both Button 0 and Button 15 (previously it was only Button 0).

Nice!

Note 1: this workaround is not permanent.
Note 2: according to wikipedia, ERPM stands for ‘enhanced retransmission mode‘ and is ‘an improved version of retransmission and flow control modes’. Several posts related to using Xbox bluetooth controllers in linux suggest disabling it.

Yes, it is from Microsoft and no I don’t have a Xbox nor even a Windows PC. But it is also a USB HID device.

When it was announced, I liked the simplicity of the idea: a USB controller with lots of digital inputs and also some analog inputs with pretty common connectors: 3.5 mm audio jacks! (yes, TLG, common connectors!!!). And although not officially announced as so, it was not a closed device – it was meant to extend the gaming experience and not only for Microsoft systems.

And it also reminded me the LEGO DACTA Interface A but with inputs only, no outputs.

So now that it is available I ordered one. It arrived today… and linux thinks it is some kind of joystick.

The ‘View’ button is Button 6, the ‘Menu’ button is Button 7 and the big black round buttons (‘A’ and ‘B’) are Button 0 and Button 1. No action detected when pressing the ‘Xbox’ and the ‘Profile’ buttons.

Now if I connect a 3.5 mm jack to the first plug (with the symbol of an arrow to the left and a cross) and shunt it I get ‘-32767’ at Axle 6… the same as pressing the left part of the black cross pad. In fact, the 4 first jacks are mapped to Axle 6 and 7 (left, up, down and right).

So I can connect any kind of switch to these jacks. Including, of course, LEGO switches 🙂

And, of course, I can also connect the XAC to the LEGO MINDSTORMS EV3 running ev3dev.

So what crazy HID shall we create?

Note: the XAC also has Bluetooth. It announces as “Xbox Adaptive Controller” and I can pair it with my Ubuntu but it shows as disconnected (it does connect but when browsing the services it immediately disconnects). Microsoft states that BT only works with Windows 10 so I might need to sweat a bit more before having a wireless controller.

I needed a LEGO mechanism that could turn ON or OFF an electrical circuit using an independent power source. This power source could be a regular LEGO battery but could also be a different type. So a LEGO relay.

I remember seeing somewhere a few LEGO mechanisms with the same purpose, like moving the slider of a Power Functions battery box or rotating an axle inside of a Power Function switch… but could not find them.

So this is my own implementation.

I used a Power Functions switch. We can mechanical control the switch with a Technic axle inserted in two different ways – over the top or through it:

I decided to insert the axle through it. As the idea is using a MINDSTORMS to control the relay, I could have connected the axle directly to a motor and control the time or the angle. But I started with a Power Functions motor connected to a Power Functions battery and since the motor is too strong and fast I used a clutch gear to protect the switch when extreme position is reached.

The switch has 3 working positions where the neutral (middle) is the OFF position and both left and right extremes are ON both with opposite polarities. As I just wanted ON and OFF I needed to limit the motion to just half.

Perhaps not most the efficient mechanism or beautiful design but this works:

The cam gears were the first piece I found with the proper size – when the switch is off the cam gears touch the Technic grey brick so if the motor keeps rotating the clutch gear will slip and protect the switch axle.

The relay works with power Functions cables so regular LEGO batteries and devices can be used. But I used a 2.1 mm female jack with a pair of crocodile cables to connect an old LEGO electric plate to a 12V/1.5A wall power supply and a custom Power Functions cable with male headers soldered to it to connect to a kanthal wire.

I prefer to use kanthal wire instead of nichrome wire for several reasons: it has a higher electrical resistence and also a higher melting temperature… and it is also widely available now that vaping is a trend (I don’t smoke but could not find a single nichrome supplier here in Portugal but have several online vaping stores selling dozens of variants of kanthal wires). Metal strings used with guitars also work and are easy to find but electrical resistance is too low.

So I used a 20 cm piece of kanthal wire to make a coil with perhaps a dozen turns and test it several times:

Then connected the coil endpoints to 2 crimp pins and soldered it to the custom Power Functions wire (it’s not easy to solder kanthal wire so crimping is a better option)

And now I have a MINDSTORMS controlled ignitor. Great for hobby rockets or party candles:

Remember: don’t try to do this if you don’t fully understand it. Also keep in mind that although party sparkles aren’t dangerous per se igniting one near flammable products can start a fire. Always take safety measures.

It works very well with my Pololu Maestro board although I just can get a little less than 180º rotation instead of 270º as the title of the product at Bangood states (to be honestly I didn’t even noticed that title until now as I expect all RC servos to rotate 180º or, when modified, to rotate continuously).

I have a fixation with small LEGO motors and this one motor is smaller than the 4DBrix motor:

4DBrix Servo and Kittenbot Geek Servo motors

Both top studs and bottom reverse-studs connect to LEGO bricks but only bottom reverse-studs give a strong LEGO-like connection. The Technic-like holes work very well and the axle is also Technic compatible.

For monorail or train rail switches I still prefer the 4DBrix Servo because I can attach it directly to the 4DBrix monorail swicthes (of course) and to my Technic-based rail switches as drop-in replacements of Power Functions M or L motors (or even MINDSTORMS EV3 smaller servo). But for my LEGO Rock Concert cameras this little fellow might do a better job. It’s still bigger than the good old LEGO 9V micro-motor but it is already geared and Technic attachable so in the end it might even save more space and give bette results.

The first byte sent is like a read command. I got success with ’02’, ’04’, ‘0F’, ’27’ and ‘FF’ and 3 different behaviors.

The remaining 15 bytes (’00’) are like the inital synchronization commands… I don’t think they are valuable data and sending a ‘break’ to the TX line for enough time would do the same… but I just can’t find a way to send a break.

So the 3 different behaviors:

’02’ gets a lot of 3-byte messages from the Motion Sensor. Probably one message for each ’02’, I suspect 50 messages per second but need to check that. After a few minutes, it stops sending data.

‘FF’ gets much less messages, about 1 per second. And the message is now 5-bytes long: ‘7B C1’ or ‘7B C2’ followed by the 3-byte message above (like ‘C0 00 3F’). And after a few minutes the sensor also stops sending data. So ‘7B C1’ or ‘7B C2’ are warnings from the Sensor stating that it expects something more.

Finally ’04’, ‘0F’ and ’27’ (and probably other values) make the Sensor behave in Mode 0 (i.e. just send data when distance changes). But it also expires after a while (I think sooner than other two modes) and the sensor sends a few ‘7B C1’ warnings followed by a read).

Now the interesting part is that if I keep moving something in front of the sensor it doesn’t “expire”. So it is probably some power saving definition, it would be nice if we could disable it.

So perhaps I’ve found a way to make my own sensor: if I can emulate the AutoID of the WeDo 2.0 Motion Sensor (device type ’23h’) I just need to send it short 3-byte messages (just 11 different values but that would be a start).

One from David Lechner with 2 Powered Up-compatible male plugs with cables already attached (and 4 great ev3dev stickers!)

Other from Mouser Electronics with a few 1.27 mm headers I ordered to try to replicate Philippe “Philo” Hurbain idea to a pseudo female plug

So I finally made my own Powered Up extension cable with a third connector to sniff the communicares between the hub and a sensor or an interactive motor:

Philo hack works but it’s really tough to execute. My soldering skills aren’t great (my hands shake _a_lot_) and my vision is getting worse. But at my third attempt I got a working connection, not 100% tight but stable enough for my purposes.

Too bad I get back to work this week… I hope that spying the WeDo 2.0 tilt and motion sensors I can find something more about the protocol used on Powered Up sensors.

It expects an Init command. And it asks for it (or at least it complains of something). But it also requires some sort of warm up procedure that requires sending to the motor a lot of ’00’ for a while. It seems like a long break before start communication but for some reason it doesn’t work if I use pyserial break command.