MajorAlvega

LEGO WeDO with Linux and Mindstorms EV3

Recommended Posts

Hi all!

I don't know if WeDO fits here at "Technic, Mindstorms & Model Team" but didn't find a better forum theme.

The ev3dev people are preparing a WeDO driver for Linux. It will allow any Linux system [EV3 ev3dev included] to use WeDO. Not just ONE WeDO USB hub but as many as you want/have.

I got excited and got two WeDO USB Hubs and a tilt sensor.

And while waiting done my own tests. There is already a python library for WeDO: wedo. But I could not make it work so I used a variation: WeDoMore. It works fine with my Ubuntu laptop and with Mindstorms EV3 running ev3dev. I believe it will also work seamless with a Raspberry Pi, will try it later.

Some more details at my blog.

I've also found Philo photos of the WeDo internals and used it to reverse-engineering the tilt sensor. With just 4 resistors and a Power Functions connector we can build a 4-switch control and read it as a tilt sensor (one switch for each tilt state). More on this later.

Edited by MajorAlvega

Share this post


Link to post
Share on other sites

Here is the circuit of the tilt sensor.

tilt-sensor.png

I made a basic 4-key gamepad with 4 RCX touch sensors, here my EV3 using 2 WeDo hubs reading the gamepad to control 2 L-motors

More info here.

Share this post


Link to post
Share on other sites

Update: since LEGO WeDo uses the C2 pin as an analog input AND it is possible to read the raw values at C2, we can use the WeDo USB hub as an ADC.

So I connected a 10K NTC thermistor (a resistor that varies with temperature, when temperature increase it's value decrease) to my modded cable, between C2 and 9V, in parallel with a 10K normal resistor (so that the thermistor varies almost linearly with temperarure, see here).

I had not enough time to calibrate yet so here are some in-a-hurry results:

- ambient room, after settling: ~180

- touching ice: ~160

- 10cm over a tea candle: ~215

(with nothing connected, just the modded cable, the tilt raw input is 125)

Later this week I'll show more details. I also intend to:

- read a potentiometer and see if it is usefull for reading a motor position

- read a light-dependent resistor to measure light levels

Share this post


Link to post
Share on other sites

Wow, This is great stuff. I am probably a LONG way away from using one, the EV3's are way out of my price range (I've repaired several RCX's and a few scouts to control my projects). I recently saw a broken WeDo hub for sale on bricklink and considered buying it. Assuming I could repair the problem I wondered what I could use it for...

Share this post


Link to post
Share on other sites

The ev3dev kernel was updated this night with native driver support for WeDo.

So now anyone using EV3 can also use LEGO Power Functions motors and lights through USB with no need for cable modifications and keeping all EV3 motor ports available.

Lets hope this driver goes upstream and reaches other distributions so we can use WeDo on-the-go with the Raspberry Pi or a linux laptop.

Share this post


Link to post
Share on other sites

I found a easier and almost purist way of reading temperatures with the WeDo:

wedo-temperature-02.jpg_thumb.jpg

You just need:

- a WeDo Hub (of course)

- a WeDo tilt sensor

- a Mindstorms RCX Temperature Sensor (9889)

- half Power Functions cable

- half 9V cable

The WeDo tilt sensor is plugged «piggyback» with the half PF cable from which we use C2 and 9V wires to connect to the half 9V cable.

The temperature is read from the tilt sensor in raw mode (just assure the tilt sensor itself is always «flat» so it doesn't interfere with the readings.

If you don't have or don't want to use a WeDo tilt sensor just solder a 3k9 resistor between C1 and 0V wires of the PF cable (to pretend it is a tilt sensor) and a 10K resistor between C2 and 0V (although you might skeep this aswell).

If you don't have or don't want to use 9889 then solder a NTC 10K resistor (less tha €1) between C2 and 9V wires of the PF and use some proper insulation (hot glue, epoxy, duct tape, whatever)

It works seamless with Mindstorms EV3 and a PC with Linux. I don't have LEGO WeDo software to test with Windows so I don't know if it is possible to read raw values from the tilt sensor - if it is, then you don't need Linux at all.

Edited by MajorAlvega

Share this post


Link to post
Share on other sites

The ev3dev kernel was updated this night with native driver support for WeDo.

So now anyone using EV3 can also use LEGO Power Functions motors and lights through USB with no need for cable modifications and keeping all EV3 motor ports available.

Lets hope this driver goes upstream and reaches other distributions so we can use WeDo on-the-go with the Raspberry Pi or a linux laptop.

Hi majoralvega,

I am also doing my firsts steps on this world by using my :) son lego Wedo playset (ref 9580) which includes a USB hub plus some sensors and a M motor.

my goal would be to manage them by using a raspi that i use for playing purposes. Your post question open my eyes about how to face the challenge. I have checked that last 21th december the lego linux drivers you mention were finally published. I am trying to play with it but my previous experience using

python libraries seems not very useful when trying to use linux drivers.

Anyone has become succesfull using them?

Thx

Edited by alf_gon

Share this post


Link to post
Share on other sites

Hi.

I have not played yet with the linux drivers outside the EV3 / ev3dev, I'm not even sure if they are already mature enough. I did use with ev3dev and they worked fine (just the Power Functions LED was not recognized but there was a patch right after) so it's just a matter of days/weeks until you can use it with Raspbian or even Ubuntu.

I've been playing with SBrick and last week got Raspberry Pi working with it, I have to return to the Pi to repeat it and clean up the process. So give me a few days and I'll try my Pi with WeDo again.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.