Android communications

Started by Tinine, July 01, 2023, 16:44:33

Previous topic - Next topic

chrisws

Should have also mentioned: the jar holds my compiled java code as well as the ioio-otg and jtermios libraries.

J7M

Would be great, if you can provide this file.

I had the same problem. After first plugin the board to USB it showed up as a serial interface but I couldn't connect. After playing around and plug/unplug several times it suddenly worked. I will check if it was the "playing around" or the unpluging which got it working.


J7M

Thanks for the file. Now I can control the board using SB. But there seems to be an USB connection bug. I need to plug/unplug several times the USB cable until I get a connection. I have to execute the IOIO example program HelloConsole...jar for connecting the first time. When this program reports "connection established" I can quit it and use SB. Without using HelleConsole.jar SB will never connect. It always got stuck at "waiting for handshake".
After a while of playing around, I got annoyed with plug/unplug the USB cable. I found a nice hack to reset the board. Just connect the "mclr"-pin (top left of the board) with a push button to ground and the board resets. I start HelloConsole.jar and press the push button several times until the program reports that it established a connection.

chrisws

That was pretty much my experience as well. There are also ioio.reset() and ioio.hardReset() functions. I wonder if these could be used instread of the hardware button?

I'm not sure what's special about HelloConsole - I'll look into this a bit more as well.

I raised this last year but so far no has answered: https://github.com/ytai/ioio/issues/356 

chrisws

I managed to get my Ambient Light Sensor device (VEML6030) working using the TwiMaster module (i2c).

Next to try is a BME280 which is a bit more complicated, so probably need to refactor a few things.

code is here: https://github.com/smallbasic/smallbasic.plugins/tree/master/ioio

All so entertaining.

chrisws

#36
My bme280 device is now working, in part thanks to some scary python code that I converted to even scarier looking SmallBASIC :)

The device has various calibration parameters that need to be read at startup. These are used with the raw data feed to calculate the temperative, humidity and pressure.

The temperature readings are consistent with my thermometer, so at least is giving the appearance of working.

Also... I solved the "waiting for handshare" issue by switching over to a different java library for dealing with the serial port. Could have saved some headaches fixing that at the start.


J7M

That sounds good. I'll also try to get some sensors running.

chrisws

I started working on the android integration of the ioio project.

I have this idea for making a robot. 

- buy a 'smart' robot kit and replace any control module with the IOIO board.
- strap an android phone to the robot.
- add some support for calling an LLM api (chatgpt or claude etc).
- give the LLM instructions on how to read sensors, control any motors or give feedback.
- this would all be tied together with an SmallBASIC program.
- let it wonder around the house and play with the cats.

I asked claude about this and he/it was pretty excited! 

Tinine

Quote from: chrisws on March 11, 2024, 09:57:14I started working on the android integration of the ioio project.

I have this idea for making a robot.

- buy a 'smart' robot kit and replace any control module with the IOIO board.
- strap an android phone to the robot.
- add some support for calling an LLM api (chatgpt or claude etc).
- give the LLM instructions on how to read sensors, control any motors or give feedback.
- this would all be tied together with an SmallBASIC program.
- let it wonder around the house and play with the cats.

I asked claude about this and he/it was pretty excited!

Exactly  8)

We actually begin with a kick-butt HMI that has processing power, GPU, memory, BT. WiFi, touchscreen, etc and able to control external hardware.

Exciting times  :D


chrisws

It's basically working on android now. I got blinking a led!

I'm using the same codebase as the "PC" version in the modules repository. This builds an android archive file (aar) which can then be included in the Android version of SmallBASIC via a configuration setting. There's just a few general changes to the SB android code to handle "modules".

Handling the USB permission still isn't quite right. Then next I'll need to figure out how "on demand delivery" works, or maybe just share a different version in some other way.

Tinine

I'm like a kid at Xmas, here. Android-based CNC anyone?

I have developed the motion stuff - not mickey-mouse stepper motors but true closed-loop servo-motor stuff. Lots of people frustrated with LinuxCNC and Mach-4. I'd need help with the front-end UI, etc. but we could kick some butt with this combo  8) ;D