That tells me that the level shifter is faulty. But note that I am working on the assumption that (1) the stuttering indicates a restart and (2) the restart is caused by a power problem. That seems most likely to me, but assumptions always need to be tested. However, replacing the level shifter is a cheap and easy place to start.
Hi Matthew
Not too difficult to apply static tests to the level converter.
Connect 3.3V to the Low input
Connect 5V to the High input.
Low to high
Link 3.3V to one of 4 inputs.
You should measure 5V at the corresponding output.
Link this input to Ground.
You should measure 0V (or very close) at the corresponding output.
Repeat for the other 3 channels.
Reverse the procedure for the other direction.
High to Low.
Link 5V to one of 4 inputs.
You should measure 3.3V at the corresponding output.
Link this input to Ground.
You should measure 0V (or very close) at the corresponding output.
Repeat for the other 3 channels.
Easy.
Cheers Bob
Bear in mind this device is meant to operate into high impedance loads. The 3.3 and 5V outputs are via about 10k resistor and any sort of load less that about 100k will have some effect on the output.
Hello Bob,
I tested my and all of them are converting well.
Thanks,
Matthew.
I have a few level shifters that came with the one I have in my circuit right now. Iâm just wondering for future reference, why is the potentially faulty level shifter causing there to be power loss?
Thanks,
Matthew.
Hi Matthew
That is a very good question. Is there any chance of some photos showing wiring detail. Some sort of mistake or funny here is the only thing I can think of. Unless it is in fact not enough supply current available with everything connected. The level shifter should use up nine tenths of just about nothing. At worst 5V to ground via 10k = 0.5mA and 3.3V to ground via 10k = 0.33mA.
Cheers Bob
Can you arrange a supply to the UNO of 7V or more with more grunt than that 9V battery. 2 X 18650 lithiums in series (7.4V to 8.4V) would do if you can or at Max 12V at a few amps for a short period. You will have to keep the 12V time short as the on board linear regulator will run hot with a bit of current.
But Photos first in case there is something obviously wrong.
I am working with the assumption that it is an excessive power load, not a loss, that is causing the reset. That is a common failure mode, for instance for a transistor to short out with low resistance to earth.
For what itâs worth, note that the level shifters come in various different layouts, and in particular there are two versions that are laid out as almost exact opposites of each other. If you are swapping them out you need to pay close attention to confirm how the new one is laid out.
Hi Bob,
Here is an image of my circuit (there is a DF Player and speaker there for one of my projects, but they shouldnât make a difference as they arenât connected to anything.)
Hello Jeff,
The level shifters I am thinking of using are the same model and make as the one I am currently using in my circuit, would it still be worth trying them out. Thanks.
Hi Matthew
It is a bit hard to tell as the camera angle does not line the header pins up. But maybe the accelerometer could be shifted one space. I canât be sure with that angle.
Exactly which level shifter are you using
As Jeff said
and it is pretty impossible to read the screen print properly on that one.
I would agree with Jeff here. Have you measured all the voltages while the set up is mucking about to make sure they are all present and correct. If things are happening quickly you might need something better than a DMM which by their very nature are slow acting. Like an oscilloscope if you have access to one.
Cheers Bob
Hi Matthew,
To make it easier to troubleshoot I recommend removing the speaker and DF Player from the setup at the moment just for some visual clarity.
We can more easily assess whatâs going on then. Could you please shoot through a photo with these updates?
Hi Bob,
Iâm using this level shifter:
(it might be a different seller, but the model is the same/extremely similar)
Also, what would the âcorrectâ voltages I should measure and where should I measure them? Do you mean like check if the voltage levels are converting properly in the level shifter?
Thank you,
Matthew.
@Robert93820 @Jack @Jeff105671
I tried out this code below that I found in the sparkfun LIS3DH library examples:
/******************************************************************************
MultiI2C.ino
Marshall Taylor @ SparkFun Electronics
Nov 16, 2016
https://github.com/sparkfun/LIS3DH_Breakout
https://github.com/sparkfun/SparkFun_LIS3DH_Arduino_Library
Description:
Example using up to two LIS3DHs on the same I2C channel. If only one sensor
is attached, this sketch reports failure on that channel and runs with the
single sensor instead.
Resources:
Uses Wire.h for i2c operation
Uses SPI.h for SPI operation
Either can be omitted if not used
Development environment specifics:
Arduino IDE 1.6.4
Teensy loader 1.23
Hardware connections
Connect I2C SDA line to A4
Connect I2C SCL line to A5
Connect GND and ***3.3v*** power to the IMU. The sensors are not 5v tolerant.
(Multiple I2C devices use the same pins. Up to two LIS3DHs are allowed. Use
the solder jumper to select address 0x19 (default) or 0x18)
This code is released under the [MIT License](http://opensource.org/licenses/MIT).
Please review the LICENSE.md file included with this example. If you have any questions
or concerns with licensing, please contact techsupport@sparkfun.com.
Distributed as-is; no warranty is given.
******************************************************************************/
#include "SparkFunLIS3DH.h"
#include "Wire.h"
#include "SPI.h"
//Create two instances of the driver class
LIS3DH SensorOne( I2C_MODE, 0x19 );
LIS3DH SensorTwo( I2C_MODE, 0x18 );
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
delay(1000); //relax...
Serial.println("Processor came out of reset.\n");
//Call .begin() to configure the IMUs
if( SensorOne.begin() != 0 )
{
Serial.println("Problem starting the sensor at 0x19.");
}
else
{
Serial.println("Sensor at 0x19 started.");
}
if( SensorTwo.begin() != 0 )
{
Serial.println("Problem starting the sensor at 0x18.");
}
else
{
Serial.println("Sensor at 0x18 started.");
}
}
void loop()
{
//Get all parameters
Serial.print("\nAccelerometer:\n");
Serial.print(" X1 = ");
Serial.println(SensorOne.readFloatAccelX(), 4);
Serial.print(" Y1 = ");
Serial.println(SensorOne.readFloatAccelY(), 4);
Serial.print(" Z1 = ");
Serial.println(SensorOne.readFloatAccelZ(), 4);
Serial.print(" X2 = ");
Serial.println(SensorTwo.readFloatAccelX(), 4);
Serial.print(" Y2 = ");
Serial.println(SensorTwo.readFloatAccelY(), 4);
Serial.print(" Z2 = ");
Serial.println(SensorTwo.readFloatAccelZ(), 4);
Serial.print("\nSensorOne Bus Errors Reported:\n");
Serial.print(" All '1's = ");
Serial.println(SensorOne.allOnesCounter);
Serial.print(" Non-success = ");
Serial.println(SensorOne.nonSuccessCounter);
Serial.print("SensorTwo Bus Errors Reported:\n");
Serial.print(" All '1's = ");
Serial.println(SensorTwo.allOnesCounter);
Serial.print(" Non-success = ");
Serial.println(SensorTwo.nonSuccessCounter);
delay(10000);
}
Here is the output:
Accelerometer:
X1 = 0.1371
Y1 = -0.1471
Z1 = 0.9848
X2 = -0.3999
Y2 = -0.3999
Z2 = -0.3999
SensorOne Bus Errors Reported:
All '1's = 0
Non-success = 0
SensorTwo Bus Errors Reported:
All '1's = 0
Non-success = 57
The code shows that the sensor is in motion, but it is actually totally still, is this an issue with calibration?
It seems as if this library is working. I re-tried the Adafruit library, and it is still having issues.
Any idea why this library is working, and, why this library is saying my sensor is moving? Thanks!
Hi Matthew
Is it the same or "extremely similar.
Not good enough. I asked for EXACTLY what you are using.
Make sure you have 3.3V and 5V where they should be. Measure voltages from start to finish right at the boards. It is not unknown to have faulty crimps with these pre made link wires. Also faulty breadboard connections particularly where header pins have been inserted into the lower quality boards and spread the female connection.
Have you done the static tests described above. If not why not.
All the connections look OK. But there are a lot of them and it would only take one faulty one to upset the whole thing. A thorough voltage check should reveal any problem connections.
$7.69 for 10. I think I would be testing all of them before use and even then using them with fingers crossed.
Cheers Bob
It appears that your error has disappeared. Perhaps it had something to do with the library you were using doing something illegal and rebooting the MCU. However as the wiring has changed quite a bit it is also possible that there is an issue with that breadboard.
As you are now getting results from the sensor I would suggest you start a new thread about how to interpret the readings you are getting. It is not usually helpful to mix different problems within one thread.
@Robert93820 @Jeff105671 Thanks for all the time youâve put in to helping me, I really appreciate it!!
Hey All,
Great to see progress being made, thanks for all your help @Robert93820 and @Jeff105671.
Additionally, good advice from Jeff regarding a new thread! Keeps things nice and clean, and the next person to have this issue can scroll to the bottom and start right where the solution was found!