Hi all, I am comparing force sensor usage between a ChipKit Max32 board and an Arduino MEGA2560.
(using vcc 5v on both cards)
I am using a force resistor with a 47k resistor.
I notice that using MEGA2560 I obtain a good precision when I apply different forces on the sensor.
little force = little value
medium force = medium value
high force = high value.
So using MEGA I got a very good result.
int fsrAnalogPin1 = 0; // FSR is connected to analog 0
int fsrReading1; // the analog reading from the FSR resistor divider
BUT using MAX32 I obtain a different situation.
I notice a very bad precision and the values going from zero to max applying little or big forces.
little force = near big value
medium force = high value
high force = high value
So no precision!
How I can set a smooth behaviour using MAX32 board?
Before to start using 5v pin, I carefully reead some technical review about and I learn that MAX32 is fully 5v tolerable.
unfortunately are all Italian language reviews.
I took a little piece and translate :
"The 5V issue"
I repeat this once again because I know that many people do not understand it even if there is nothing difficult to understand: even if the PIC on board works at 3.3V, some tricks have been taken so that they can be used 5V devices without any problem. This means that you can still use your 5V displays (just to give an example). The only problem could be represented by some CMOS peripherals that could not be able to recognize 3.3V as a high logic level (but there is no risk of burning anything! Measures have also been taken for analog inputs. In the manual it is written very clearly (I always pray that people, before opening their mouths, start reading, but it seems that reading, for some, is a very difficult thing):
The digital I / O pins on the PIC32 microcontroller are 5V tolerant.
So: no problem on the digital pins: they can accept 5V input "natively". It 'obvious that if the digital pins are set as output will not pull out 5V but at most 3.3V since the PIC runs at 3.3V, a pointless explanation, no? But let's continue to read:
The analog capable I / O pins are not 5V tolerant.
This means that the PIC, natively, is not able to accept 5V on the analog inputs, MA:
To provide 5V tolerance on those pins, the Max32 contains clamp diodes and current limiting resistors to protect them from 5V input voltages
So even the analog inputs can accept 5V because precautions have been taken. But beware: it says that the inputs are protected by 5V: which means that having to read an analog voltage with a certain precision, you avoid getting the 5V running the risk that the clamping diodes deprive us of the dynamics, so in these cases a divider must be used or the sensor must work at 3.3V if it is possible. I repeat it in the macaronic: the 5V on the analog inputs can reach us, but it is obvious that after 3V is "cut" all at 3V, then after 3V always read 1024 on the AD converter and then get 5V is not an intelligent choice also if possible. I think that was quite accurate with this, so I hope I do not read more super-crap on the forums. But I do not think about it anymore.
So the 0-3.3volt analogue inputs are 5volt tolerant.
That does not mean you should power the FSR or pull up from the 5volt supply.
Connecting to 5volt could explain the different behaviour you see compared to the Mega.
1/3 of the range is cut off when you connect a 0-5volt sensor to a 0-3.3volt input.
Leo..
Wawa:
So the 0-3.3volt analogue inputs are 5volt tolerant.
That does not mean you should power the FSR or pull up from the 5volt supply.
Connecting to 5volt could explain the different behaviour you see compared to the Mega.
1/3 of the range is cut off when you connect a 0-5volt sensor to a 0-3.3volt input.
Leo..
mmm interesting.
the force sensor I am using works on 5v.
I wired it giving 5v (using MEGA and using MAX32 too).
When I choose 5v pin on the MEGA32 to power my FSR I am surely following the sensor indication about voltage.
And I assume that the 5v pin on MAX32 board is a pure 5v pin.
In fact the force sensor is working fine! I think my thread issue is due to the very superior performances of MAX32 compared with MEGA (I am speaking about to see the data printed in a processing3 panel)
The main problem is the MAX32 processor that want 3.3v. but now we know is nicely 5v tolerant.
Actually I have simultaneously on my MAX32 :
MPU6050 (3.3v) working fine using a 5v level shifter (power by 5v pin of MAX32 board).
Adafruit Servo board (5v) working fine (12 servos linked) (power by 5v pin of MAX32 board).
four force sensors (5v) working good (power by 5v pin of MAX32 board).
I have no particular issues at this point.
The biggest problem was MPU6050 (two days to make it working fine) but now all ok
You have to use 3.3v on the FSR when using the MAX32, because 3.3V will be the FULL ADC output count.
If both ADC are 10bit, that is max 1023 count.
The Mega will read 1023 for 5V
The MAX32 will read 1023 for 3,3V.
So you will see a different count.
Please a schematic diagram of BOTH circuits please, NOT a Fritzy PICTURE.
Draw it with pen and paper and photograph it please.
Label pin names and component designators.
You have to use 3.3v on the FSR when using the MAX32, because 3.3V will be the FULL ADC output count.
If both ADC are 10bit, that is max 1023 count.
The Mega will read 1023 for 5V
The MAX32 will read 1023 for 3,3V.
So you will see a different count.
Please a schematic diagram of BOTH circuits please, NOT a Fritzy PICTURE.
Draw it with pen and paper and photograph it please.
Label pin names and component designators.
Thanks.. Tom..
Thank you Tom, I put my best MEGA2560 wires schema, the only difference when i am using MAX32 is that I am using PWM/DIGITAL pin number 3 instead 2 (for interrupt matter).
So I think the DEFAULT type for MAX32 is understood as 3.3V as you wrote.
At this point I'm thinking about to use pin 5v of my MAX32 to power :
A) MPU6050(with level shifter)
B) Adafruit servo board
And to use pin 3.3V to power the tactile sensors.
But obviously this should lead to an exceeding of the maximum voltage level available.. (I am powering my MAX32 via USB!)
No. Do not try that you may damage the processor if you don't know what you are doing.
aldoz:
At this point I'm thinking about to use pin 5v of my MAX32 to power :
A) MPU6050(with level shifter)
B) Adafruit servo board
And to use pin 3.3V to power the tactile sensors.
But obviously this should lead to an exceeding of the maximum voltage level available.. (I am powering my MAX32 via USB!)
Both A and B are (sort off) wrong.
This is a 3.3volt processor.
All logic and power connected to the processor must be 3.3volt.
How you connect the MPU to the MAX32 depends on which breakout board you have/buy.
It could be a stripped down 3.3volt version without voltage regulator and without level shifters.
Just don't connect it then to the Mega, with it's 5volt logic.
A PCA9685 breakout board can work both with 5volt and 3.3volt power and logic.
For the MAX32 it must be powered from the 3.3volt pin.
5volt/USB power has little to do with the voltage the processor operates on.
Leo..
Wawa:
Both A and B are (sort off) wrong.
This is a 3.3volt processor.
All logic and power connected to the processor must be 3.3volt.
How you connect the MPU to the MAX32 depends on which breakout board you have/buy.
It could be a stripped down 3.3volt version without voltage regulator and without level shifters.
Just don't connect it then to the Mega, with it's 5volt logic.
A PCA9685 breakout board can work both with 5volt and 3.3volt power and logic.
For the MAX32 it must be powered from the 3.3volt pin.
5volt/USB power has little to do with the voltage the processor operates on.
Leo..
mm currently the posted schema is working very fine with MAX32!
MPU6050 working very good (as it working with MEGA).
force sensors working with no problems (just the scale 0-5v problem)
And I haven't any breakout board!
I am testing for 2 or 3 days without problems for now.
One big question : my code running (on MAX32) as same speed of MEGA..
I expected a very big up step of FPS but virtually is the same
why?
Hi,
You are powering the GY-521 from 5V, you do not need the level shifter, in fact it is not working as a level shifter in the configuration you have.
The LV terminal is not connected to anything, it should be connect to the 3.3V supply of the device being communicated with, however your device is 5V and will cope with 5V logic.
TomGeorge:
The LV terminal is not connected to anything, it should be connect to the 3.3V supply of the device being communicated with, however your device is 5V and will cope with 5V logic.
Hi again!,
mmm but MPU6050 is working fine!
anyway I read that GY-521 are 3.3v.. but I remember I got it working fine only using 5v power.(+ level shifter). far code battles, I don't remember details about.
Currently all devices linked to the MAX32 working fine; what (technically speaking) happen if I link LV to 3.3v of MAX32, considering all devices are powered by 5v.