this post was submitted on 26 Jul 2023
5 points (100.0% liked)

Arduino

558 readers
3 users here now

This is an UNOFFICIAL Arduino community.

Everyone who uses Arduino board or their clones or associated boards and/or the Arduino IDE is welcome here. If it involves Arduino hardware or software it's welcome here. If it connects to Arduino hardware it's welcome here. If you're building your own boards that you use with an Arduino it's welcome here. There will be no Arduino elitist bullshit in this community.

You may also be interested in:

AVR

RULES:

  1. It's always a floating input.

  2. All Lemmy.ca rules apply here.

  3. Everyone (see rule 98) is welcome.

  4. If you’ve seen a question 100 times answer it the 101st time or ignore it. Even better, write a complete, detailed answer and suggest that the mod(s) pin it to the community.

[Did you actually think there were 98 rules?]

  1. If you present something as fact and are asked to provide proof or a source provide proof or a source. Proof must be from a reliable source. If you fail to provide proof or a source your post or comment may be removed.

  2. Don’t be a dick. Yes, this is a catch-all rule.

  3. The mod(s) have the final say.

founded 2 years ago
MODERATORS
 

I'm trying to use an LIS2MDL ic with an Arduino nano on a custom PCB designed in KiCad. I tried the Arduino example compass script for the ic and it didn't work. It just prints "Magnetometer Test" and nothing else happens

top 4 comments
sorted by: hot top controversial new old
[–] [email protected] 2 points 1 year ago (1 children)

LIS2MDL with Arduino Troubleshoot

User I’m trying to use an LIS2MDL ic with an Arduino nano on a custom PCB designed in KiCad. I tried the Arduino example compass script for the ic and it didn’t work. It just prints “Magnetometer Test” and nothing else happens

ChatGPT If the Arduino example compass script for the LIS2MDL IC is not working as expected and only prints "Magnetometer Test" without providing any sensor data, there could be several potential reasons for this issue. Here are some troubleshooting steps you can follow to identify and resolve the problem:

Verify the connections: Double-check the connections between the LIS2MDL IC and the Arduino Nano on your custom PCB. Ensure that all the required pins are correctly connected, including power (VCC and GND) and communication pins (SCL and SDA).

I2C Address: Make sure you are using the correct I2C address for the LIS2MDL IC. The default address of the LIS2MDL is usually 0x1E. Some modules might have different addresses due to address jumpers or other configurations.

Power Supply: Confirm that the LIS2MDL IC is receiving the correct voltage levels. It typically operates at 3.3V, so ensure that you are providing the appropriate power supply voltage.

Pull-up Resistors: Check if the I2C lines (SCL and SDA) have pull-up resistors connected to the 3.3V line. Pull-up resistors are usually required for I2C communication to function correctly.

Library Compatibility: Ensure that the Arduino library you are using is compatible with the LIS2MDL IC and supports the Arduino Nano. If you are using a library that is specific to another sensor, it might not work with the LIS2MDL IC.

Library Installation: Confirm that the library for the LIS2MDL IC is installed correctly in your Arduino IDE. You can check this by going to "Sketch" > "Include Library" and see if the library is listed there.

Serial Communication: Make sure that the Serial communication is set to the correct baud rate (typically 9600) and that you are reading the Serial output at the same baud rate on your computer.

Serial Monitor: Open the Serial Monitor in the Arduino IDE after uploading the code to see if there are any error messages or debug information being printed.

Test Code: If possible, try the same script on a different development board that uses the same LIS2MDL IC (e.g., Arduino Uno or a breakout board) to see if the issue is related to the PCB design or the sensor itself.

IC Issues: There's a possibility that the LIS2MDL IC might be damaged or faulty. In that case, try a different sensor or a known working module to see if the issue persists.

By following these troubleshooting steps, you should be able to identify the problem and get the LIS2MDL IC working with your Arduino Nano on your custom PCB. Remember to check the datasheet of the LIS2MDL IC and verify that your connections and code align with the specifications provided.

[–] [email protected] 1 points 1 year ago

If this doesn't help, I can try Chat GPT 4.0, but they have some good tips!

[–] [email protected] 2 points 1 year ago* (last edited 1 year ago) (1 children)

Can you upload some screenshots of the layers of your PCB? Edit: also, did you assembly your PCB yourself? What's the state of your circuit? It's hard to get a sense of whether you've hooked everything up correctly and what you're expecting.

Before I would even look at code, go back and try to do some basic diagnostics on your circuit using a multimeter or oscilloscope. Is your IC getting the correct voltage? Are all the pins correctly connected? Are you seeing any signals over the data lines?

Are you trying to talk to it via I2C or SPI?

[–] Pizzarules668 3 points 1 year ago

I think I found a the problem 3 of the pins on my level shifter are shorted together I'm going to try and fix it in the morning

load more comments
view more: next ›