Ideas for the project

Showroom for MicroPython related hardware projects.
Target audience: Users wanting to show off their project!
tommyerols
Posts: 3
Joined: Sat Jan 04, 2014 7:56 am

Ideas for the project

Post by tommyerols » Sat Jan 04, 2014 8:12 am

What ideas do you all have for using the board?
I would like to interface a good resolution six axis accelerometer so the position and orientation of the device can be calculated. Then it could be used to map the stairs and tunnels of our Paris metro. Or it could be packaged into a disposable buoy with SatCom to measure waves in the ocean.
Does anyone know more about such accelerometers?

fma
Posts: 164
Joined: Wed Jan 01, 2014 5:38 pm
Location: France

Re: Ideas for the project

Post by fma » Fri Feb 28, 2014 2:06 pm

As first exercice, I will replace the Arduino Mini running the JIXClock I build, for which I re-wrote the firmware using OO approach. But C++ is not really my cup of tea!

Then, I think I will replace the electronic of my vent. unit. This device uses a F103 (LQFP100) chip, which is too small to run micropython. But I found that F40x LQFP100 have exactly the same footprint, with all I/O availabe on the same pins. The only problem is about pins 19/20: on the F103, they are VSSA/VREF-; on F40x, they are VDD/VSSA. Which means that there could be a short circuit, depending how VSSA is wired on the board. But I can hack the PCB a little bit.

Then, I would like to try to develop a micro python-based 3D printer controller...
Frédéric

User avatar
Neon22
Posts: 18
Joined: Fri Feb 28, 2014 11:53 pm

Re: Ideas for the project

Post by Neon22 » Thu Mar 06, 2014 9:42 pm

tommyerols wrote:What ideas do you all have for using the board?
I would like to interface a good resolution six axis accelerometer ...
Does anyone know more about such accelerometers?
The MPU6050 is a cheap good device with I2C support. It'll probably be a good start.
Many places sell a breakout board - E.g. Adafruit or one of the Ali-Express Chinese suppliers.

I hope to port the I2C lib to python soon... ish... but feel free to get started without me.
Original C code is here: http://www.i2cdevlib.com/devices/mpu6050#source

Neil Higgins
Posts: 6
Joined: Sun Apr 27, 2014 10:25 am

Re: Ideas for the project

Post by Neil Higgins » Mon Apr 28, 2014 10:21 am

Just how useful is the accelerometer? A post elsewhere suggests it is not so good. However it might be good enough for gesture recognition in, for example, a "magic" wand. This is an idea I have been cooking up for a while: A "wand" (embedded controller in a tube) which can respond to gestures and/or button pushes with sound and/or lights, and interact with other wands via bluetooth and/or WiFi. It should also have an IR transceiver for line-of-sight interaction (spells and counter-spells). I built a very basic version for my son many years ago and he really liked it. With the ultimate possibility of a curved OLED display on the surface of the tube (or a micro-projector), and/or voice recognition for user interaction, the possibilities are limitless! The Micro Python board is about the right size to fit inside a piece of electrical conduit, as a proof of concept - buttons conveniently placed for handgrip at one end, lights and IR projecting out the other.

nickludlam
Posts: 1
Joined: Sat May 24, 2014 5:26 pm

Re: Ideas for the project

Post by nickludlam » Sat May 24, 2014 5:29 pm

Neon22 wrote:The MPU6050 is a cheap good device with I2C support. It'll probably be a good start.
Many places sell a breakout board - E.g. Adafruit or one of the Ali-Express Chinese suppliers.

I hope to port the I2C lib to python soon... ish... but feel free to get started without me.
Original C code is here: http://www.i2cdevlib.com/devices/mpu6050#source
Hi Neon22, did you get anywhere with this? I've just received my 6050 for a game head-tracking project and next week I'm going to get started with using the pyb.I2C module to start digging into the protocol to try and extract some values from the sensors.

Nick

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: Ideas for the project

Post by pythoncoder » Mon Aug 11, 2014 3:49 pm

... six axis accelerometer so the position and orientation of the device can be calculated. Then it could be used to map the stairs and tunnels of our Paris metro.
I'm very doubtful whether this could be made to work. Converting from acceleration to position requires a double integration: the slightest error in the measured acceleration will result in severe drift in the reported position. In above-ground applications such drift can be corrected by GPS readings, but below ground this wouldn't work.

The idea of measuring waves has more potential since the absolute value of sea level changes only very slowly (in response to the tidal cycle). So I'd imagine that it would be possible to use digital filtering to avoid the drift problem.

But perhaps someone knows a solution I haven't considered.

Regards, Pete
Peter Hinch
Index to my micropython libraries.

raszga
Posts: 10
Joined: Sat Sep 10, 2016 2:06 pm

Re: Ideas for the project

Post by raszga » Sat Sep 10, 2016 2:41 pm

Hi,
The MPU 6050 can be used in a variety of applications with appropriate filters and fusion algorithm.
I 'm able to read on ESP8266 -12 (using AI tinker) on I2C the MPU 6050 , ( Debian 8 / Espexplorer ) but everything looks to be fairly unstable and it looks to be mostly an micropyton implementation issue.

The Python on Raspberry pi works very good in I2C with MPU6050. I built a small robot driven exclusively with 4 MPU's ( in an XY space)

I try to built an inertial glove to drive the robot thru WIFI but I have problems in the basic code for MPU6050 on ESP 8266 -12.

The second while loop which reads the low byte can't exit the try test though the results shouldn't generate an error ( as printing the conversion value works)

I'm sure I'm missing something here as I'm not used to bytearray's .
Is muicropython 1.83

Suggestions very welcomed !
Thanks.
this is the code:

#---------------------------------------------------------------------
from machine import Pin, I2C
from time import *
i2c = I2C(scl=Pin(4),sda=Pin(5) , freq=100000)
power_mgmt_1 = 0x6b
power_mgmt_2 = 0x6c
#******************************************************************
def read_word(adr):
tst=True

while tst:
try:
high =i2c.readfrom_mem(address,adr,1)
h=str(high)
print('h=',h[4:6])
ih=int('0X'+h[4:6])
tst=False
except:
tst=True
#___Second loop for low byte which behaves very strange_________________
tst=True

while tst:
try:
low = i2c.readfrom_mem(address,adr+1,1)
l=str(low)
#print('l=','0X'+l[4:6])
il=int('0X'+l[4:6])
print(il)
tst=false
except:
tst=True
print('succes')
return ih,il
address = 0X69 # This is the address value read via the i2cdetect command
buf=bytearray(b'\x01')
i2c.writeto_mem(address, power_mgmt_1,buf)
#**********************************************************************

i=0
while i<5:

AX= read_word(59)
AY= read_word(61)
AZ= read_word(63)


print('----------------------------------------')
print('AX=',AX)
print('AY=',AY)
print('AZ=',AZ)

i+=1

raszga
Posts: 10
Joined: Sat Sep 10, 2016 2:06 pm

Re: Ideas for the project

Post by raszga » Sat Sep 10, 2016 3:45 pm

Got it :
This is the tricky with "try:"... .. I wrote false .. not False for exit condition... is working now..
Thanks,

User avatar
deshipu
Posts: 1388
Joined: Thu May 28, 2015 5:54 pm

Re: Ideas for the project

Post by deshipu » Sat Sep 10, 2016 4:52 pm

That's what you get for using naked excepts. Your code is throwing an exception, and you can't even see it. If you correct this, such that only the i2c operation is in try-except, and you only catch the OSError exception, you will see the problem.

raszga
Posts: 10
Joined: Sat Sep 10, 2016 2:06 pm

Re: Ideas for the project

Post by raszga » Sun Sep 11, 2016 12:39 am

You are right .

Post Reply