Xojo to ADXL345 example

  1. 7 months ago

    Sean A

    2 May 2019 US.WI.North

    Hi all,
    Im hoping for some help with gpio on rpi 3 with NCD I2C shield connected to an ADXL345 3 axis acceleromter. I have the project building and remotely debugging but Im really at a loss as to how to ask the thing for data. I have no experience with the electronics and how to poll this low level I2C device. I believe it can also use the SPI comms but Id really like to use the I2C. Im not seeing any examples or tutorials that poll
    The java is here:
    https://github.com/ControlEverythingCommunity/ADXL345/blob/master/Java/ADXL345.java

    The other forms are here:
    https://github.com/ControlEverythingCommunity/ADXL345

    but i only know RB/Xojo. Any thoughts or nudges in the right direction would be greatly appreciated

    kr,
    -sean

  2. Sean A

    3 May 2019 US.WI.North

    So now I’m seeing the shield and the device are only i2c so I’m just focused on that ...trying to read and find relevant material on how that works.

  3. Jean-Yves P

    3 May 2019 Pre-Release Testers, Xojo Pro Europe (France, Besançon)
    Edited 7 months ago

    tutorial for arduino : https://learn.sparkfun.com/tutorials/adxl345-hookup-guide/all
    datasheet : https://www.sparkfun.com/datasheets/Sensors/Accelerometer/ADXL345.pdf
    tutorial for raspberry : (no xojo) https://www.instructables.com/id/how-to-use-the-ADXL345-on-Raspberry-pi/
    GPIO on a Pi with Xojo : http://developer.xojo.com/interfacing-hardware-with-gpio
    I2C library for WiringPi : http://wiringpi.com/reference/i2c-library/

  4. Sean A

    3 May 2019 US.WI.North

    Thank you kindly Jean-Yves. The last link is quite useful as I htink i am hitting some black listing on the rpi. Too bad theres no examples of reading i2c sensor data - it makes me read a LOT on the topic and try to figure out how its done with the xojo GPIO module. I hope to have some time over the weekend to crack the nut!

    If you see any i2c read exaples out there in the xojo module please let me know!

  5. Jean-Yves P

    3 May 2019 Pre-Release Testers, Xojo Pro Europe (France, Besançon)
    Edited 7 months ago

    there is a demo project for onewire, may be you can get inspiration on it and adapt it to i2c ?
    https://forum.xojo.com/36484-ds18b20-temperature-sensor-one-wire-interface-a-start/0

    sorry I mainly do these things on an arduino or esp8266 or esp32 , I find the raspberry overkill for such projects
    I will dig into these once I have a project that need a raspberry for it.

    edit: this example project seems nice, but not a real i2c example in it just classes
    https://github.com/UBogun/Xojo-pigpio

  6. Robin L

    4 May 2019 Xojo Inc Europe (Germany, Rehlingen)

    Sean,
    Do you have a link to the actual I2C shield being used?
    There have been some reports (not on this forum) of I2C shields having problems with the Pi's on-board 3.3v regulator.

  7. Robin L

    4 May 2019 Xojo Inc Europe (Germany, Rehlingen)

    Having said that if all you are driving is an ADXL345 the Pi's regulator shouldn't be the problem.
    But I'd still like a link to the shield. Might get one for myself for testing :)

  8. John A

    4 May 2019 Pre-Release Testers Las Vegas, Nevada

    @Robin L-Mitchell
    Following a couple of links in the original post, this looks to be the device:
    https://store.ncd.io/product/adxl345-3-axis-accelerometer-13-bit-i2c-mini-module/

    I2C is built in and is strictly 5V, so you will need a voltage level shifter.
    Here's a 10 pack for around $9 US:
    https://www.amazon.com/Cylewet-3-3V-5V-Channels-Converter-Bi-Directional/dp/B074M8TM81

    I like the I2C loop connection, what use is a multi-device bus when you can only attach 1 device?

  9. Sean A

    4 May 2019 US.WI.North

    Heres the link Robin:
    https://store.ncd.io/product/i2c-shield-for-raspberry-pi-2-3-with-outward-facing-i2c-and-xbee-port/

    Its running as expected in python and I am able to finally ping the unit from RB and get the devID so thats a start - the problem is I dont know what im doing so struggling to form the right calls and supply the memory block to it, decode all the different notations, etc. I am just a hobbyist so thats a bit of a struggle. I just dont want to pop for the 300$ unit+modem combo until I know it will do what I want. Right now I just want to get back a stream of x,y,z coordinates...

    @John, thats not needed with this shield as it is built for the rpi. I did get an adafruit version though that i will try later via the bread board so i do appreciate the 5v tip, but theres a 5v on the rpi isnt there? Like I said I am an amatuer so the convenience of not having to breadboard the unit is clean, easy and i only want to test it for suitability prior to spending money on the unit I will use for winderz and mac.

    thanks all!
    kr,
    -sean

  10. John A

    5 May 2019 Pre-Release Testers Las Vegas, Nevada

    @Sean A ...,but theres a 5v on the rpi isnt there?

    There is a 5V supply, but do NOT use this for any of the GPIO pins/signals. You will destroy the Pi.
    You can breadboard +3V to a GPIO pin to test signal inputs and levels.

    The level switchers attach to the 5V and the 3V supply and automatically adjust the voltage between sides.

or Sign Up to reply!