• user warning: Got error 28 from storage engine query: SELECT t.*,v.weight AS v_weight_unused FROM term_node r INNER JOIN term_data t ON r.tid = t.tid INNER JOIN vocabulary v ON t.vid = v.vid WHERE r.vid = 2449 ORDER BY v.weight, t.weight, t.name in /var/www/html/myrobotlab/modules/taxonomy/taxonomy.module on line 640.
  • user warning: Got error 28 from storage engine query: SELECT DISTINCT b.* FROM blocks b LEFT JOIN blocks_roles r ON b.module = r.module AND b.delta = r.delta WHERE b.theme = 'superclean' AND b.status = 1 AND (r.rid IN (1) OR r.rid IS NULL) ORDER BY b.region, b.weight, b.module in /var/www/html/myrobotlab/modules/block/block.module on line 460.

DIY Gamecontroller / Joystick

Today I tested if it ws possible to use the small esp8266-01 together with two i2c boards to make a gamepad. It worked pretty well, except that I need to figure out why the response is slow. Probably due to the rest API, but it could also be some waiting for the A/D conversion. 
The Esp8266-01 contains a small webserver so that it's possible to connect to it using the browser to see what i2c devices are  conneted on the bus. The joysticks are simply potentiometers so I connected them to the four A/D channels on the Ads1115 A/D converter board. They also contain switches, so they are connected to the pcf8574 i/o expander board. 
Links to the different services used:
The box is available here: http://www.thingiverse.com/thing:2134841
The script I'm using is available here: 
I also made a small video where I explain more.   

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
GroG's picture

Terrific Mats !

Brilliant .. seeing an I2C address filled out on the web page is a cool feature.

Some quick comments...

you only Runtime.start (...)  is equivalent to Runtime.createAndStart(..) and its less :)
create is usually used when you want to do changes before starting ...

Your I2C work looks really great ! ... and its Worky !   Awesome

Some of the slowness may be because it looks like Serial Default now is to log all data to the swing gui...
I think I already have that changed locally, but still need to check it in.

One thing that I totally missed ...  is :
WHERE IS THE PART WHICH IS POLLING THE ESP8266 ??  (Did I miss that part in the video ... I watched it twice)  Or did I just brain fart ?

Regardless - Great system you put together and thanks for the video 

GroG's picture

Ahhh .. its hardcoded in

Ahhh .. its hardcoded in the Esp8266_01 .. I see it now .. interesting ..

Mats's picture


The polling is done by each service ( Ads1115 and Pcf8574 ). The Esp8266_01 converts the i2cReads and I2cWrites to http post / rest api messages. I first tried to use the Http service, but couldn't figure out how to send the json data using it. So I use the httpclient. Perhaps not the best design. I will try to figure out where the botlleneck is so that I can get it up to speed. When that is done, I can cleanup the code.

interesting.. = GroG would hade done it a different way ? Any suggestions ?

I remember you made a suggestion about using serial as a tcp/ip port, but that got lost when the shoutbox was cleared a while ago.

I expect things to change, but it was so nice to see things that I developed without any final goal, just suddenly fit together like Lego bricks, and I could create something new, that I never intended to do when I started. And the bit's and pieces just joined together.



calamity's picture

Great work Mats. When all

Great work Mats. When all bricks can find there places whatever you a building, it's because you setup a good foundation. 

Now if we can have that tcp/ip server to work in MrlComm, you won't have to use the post/rest api and maybe avoid the bottleneck