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.   
 

GroG

7 years 1 month ago

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 

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

7 years 1 month ago

In reply to by Mats

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