Uno - Using 5v and 3.3v pins at the same time?

Hi,

Sorry one what?
Yes a drawn one will be great, we are up to post 60 and no really basic diagram.

Have you got code that JUST reads the nunchuck to the serial monitor and nothing else in the code?
If not then write some and lets see if its is not some other part of your code or hardware causing the problem.

Thanks.. Tom... :smiley: :+1: :coffee: :australia:

1 Like

Could this be an alternative? TCA9617B

There's no limitation on VCCA and VCCB as to which needs to be the higher voltage, so its easy to wire up for highV (UNO) to lowV translation. Also, there's an EN (enable) pin that can be used to isolate a badly behaved slave on power-up reset.

1 Like

It could be, but that is quite irrelevant. There is no reason whatsoever for the common level converter not to work if correctly wired.

If 5 V is supplied to "AVCC", then the board will provide the correct 3.3 V to the"BVCC" pin for the WiiChuck.

Speaking of which, his photos indicate no ground (negative) wire between the WiiChuck and the level converter. As most of us realise, there is no "option" as to whether all grounds need to be connected from one part to the next - travelling bundled together with the supply and data wires.

The suggestion of the correct level shifter being added to the circuit resulting in alteration of the digital I²C data is most bizarre indeed. Presumably what was happening is that faulty communication is actually causing bit shifting conflating data from different registers.

And it is I suppose possible that incorrectly driving with 5 v levels while the ground connection is missing may ameliorate the overloading and "fudge" correct operation. :dizzy_face:

1 Like

In this tutorial, the WiiChuck was connected directly to the UNO. It appears the WiiChuck's I2C lines are 5V tolerant. However, I would add 10K external pullups if this is the only I2C device in the circuit.

Here's the link to the code and example sketch.

1 Like

Yes, you can power something from the 5V pin and something else from the 3.3V pin.

1 Like

I've made a new diagram for just this part of the circuit, all I'm looking to solve right now is being able to accurately print the slave data to the monitor. As the smaller blue board was giving me so much trouble, I'm just going to use the sparkfun board. In case my soldering job caused the issue, I've ordered a second clean board that I'll get some help with attaching the pins next week

I'm using the following code to read the nunchuk data and print it to the monitor, taken from the website in the code . All I want to do is read it correctly at the moment:

/*
 * ArduinoNunchukDemo.ino
 *
 * Copyright 2011-2013 Gabriel Bianconi, http://www.gabrielbianconi.com/
 *
 * Project URL: http://www.gabrielbianconi.com/projects/arduinonunchuk/
 *
 */

#include <Wire.h>
#include <ArduinoNunchuk.h>

#define BAUDRATE 19200

ArduinoNunchuk nunchuk = ArduinoNunchuk();

void setup()
{
  Serial.begin(BAUDRATE);
  nunchuk.init();
}

void loop()
{

  nunchuk.update();

  Serial.print(nunchuk.analogX, DEC);
  Serial.print(' ');
  Serial.print(nunchuk.analogY, DEC);
  Serial.print(' ');
  Serial.print(nunchuk.zButton, DEC);
  Serial.print(' ');
  Serial.println(nunchuk.cButton, DEC);
  Serial.print(' ');
  delay(250);
}

When I run this code on just the 3.3v pin with no level shifter, I get this data back in the board, and it accurately updates when I move the joystick or buttons. This is exactly the data I want

Then, when I use the 5v pin and the shifter, I get this data back. I don't feel like the data is random as it goes between the same numbers.

The rest of my circuit uses 5v. That's why I was asking if I could use both 5V and 3.3v pins, as if that worked, it would bypass the need for a shifter and I wouldn't be dealing with any issues :frowning:

@dlloyd Thanks for the pull up suggestion, but there will be 2 i2c devices eventually in this circuit, I'm just not worrying about the second for now as it is working and connecting fine.

@TomGeorge By one on the way I meant the DMM sorry.

@krishna_agarwal Thanks for answering the initial question, my two posts got merged and I lost a lot of replies about this different question. I was planning to use them in my uni write up of this project and having proof is very helpful :slight_smile:

@Paul_B The photos are wired in that way per the suggestion of the thread. As the schematics for the board strangely show the ground not being connected in the circuit. I am now just using the sparkfun board instead as its being more responsive, the problem is now that the values it reads are wrong.

The shifter would add some timing lag to the signals. Looks like its sometimes printing your baudrate of 19200. Maybe lowering the baudrate would work:

#define BAUDRATE 14400

or

#define BAUDRATE 9600

Just tried altering the code to use 9600, this is the result this time. Using the joystick or buttons seems to have no impact on the numbers being printed

I can't see 14400 in my drop down menu in the monitor, how would I set the monitor to a custom amount to try 14400 These are the options I have

image

Sorry, but what does the baudrate have to do with I²C communications? :face_with_raised_eyebrow:

2 Likes

Sorry, I meant to try this ...

#define BAUDRATE 19200
#define TWI_FREQ 10000L // 10kHz slow clock

Another thing to try is using much shorter wires, as I believe there's a timing issue. Note that when you remove the level shifter and it works, the overall wire length is 1/2 the distance.

@jakedoda
The DWG in Post#66 does not show any connection between
your device's 3V and level-shifter LV back to Arduino 3V.
Accurate or Oversight?

PE - Oof, I guess there's something that maybe has 3V for that as part of the deal (weird). Hard to keep up. Well, all mine have only ever had the 3V supplied externally, always work. Anyway.

It is clear from the OP's pictures that there was no ground connection between the level shifter and the adapter board that connected to the wiichuk, that alone would cause erroneous readings. Four connections are necessary, power, ground, and the two I2C lines, or it will never work correctly.

I understand this, and as stated, I was following the advice of the schematic to not attach the LV ground on the board. I tried adding it back in, just connecting the nunchuck to the Arduino etc. I'm no longer looking to use the board in the pictures, and am attempting to get help regarding the SparkFun board as discussed above :slight_smile: the photos aren't really relevant anymore, I'll edit the post with a note now

Thanks dlloyd, I'll give that a try tomorrow. :slight_smile: Easter break is now over and I'll be able to ask a tutor for some shorter wires - I only have 20cm jumper cables. I'll post an update if I have any luck

As I thought, and as david_2018 seconded, the BOB-12009 requires 5V, 3V, and GND

PE -- Adding DWG

2 Likes

This has fixed it! Thank you so much! It's working!

Please mark his answer as the solution to help future users.

I did as soon as I sent the message :slight_smile:

1 Like

We have really had the royal run-around here!

Two entirely different modules have been mentioned.

The SparkFun level converter has four level converters on it.


But no voltage regulator. It thus requires 3.3 V to be connected to the "LV" side to power the NunChuck.

The twin level converter cited in #12 and others includes the voltage regulator which should be capable of powering the NunChuck given that it requires only a few milliamps.

If correctly connected, this absolutely should work. The only thing that slightly puzzles me is the additional diode connected to the voltage regulator. I thought I had one here somewhere but it turns out to be the SparkFun style.

So - since the level converter FET circuit itself is exactly the same, the only plausible conclusion would seem to be that the board is damaged. :thinking:

1 Like

Hi,
Before you finish, it might be worth it in the long term to desolder, clean and resolder these joints.

Tom... :smiley: :+1: :coffee: :australia:

1 Like