Wozzy
Well-known member
@Wozzy - is this your problem from post #211?
Yes... I definitely missed that (setting Pin 7 high to enable the shields 5V buffers) when looking at the diagram.
I can't wait to get home to try it out.
Last edited:
@Wozzy - is this your problem from post #211?
There is lots of good information and ideas scattered through this thread, it might be helpful, if there was some summary like posting, like updates to posting #1, which gives hints, like:Maybe just create the PDF version and include a small piece of paper with the link might suffice for the first batch? I think it's pretty important to convey information such as the "enable" pins and how to hook up the speaker (no gnd connection) and how many LEDs maximum with USB-power...
... that this would actually be all in the shield webpage when it goes up, with all of the gotcha captured from this thread and nicely distilled in a single coherent 'how to get this shield working' page.
#include <NXPMotionSense.h>
#include <Wire.h>
#include <EEPROM.h>
#include <FastLED.h>
#define NUM_LEDS 11 //number of leds in strip length on one side
#define DATA_PIN 11
#define CLOCK_PIN 13
CRGB leds[NUM_LEDS];
NXPMotionSense imu;
NXPSensorFusion filter;
void setup() {
Serial.begin(9600);
imu.begin();
filter.begin();
// FastLED.addLeds<APA102, DATA_PIN, CLOCK_PIN>(leds, NUM_LEDS);
FastLED.addLeds<APA102, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS);
pinMode(7, OUTPUT);
digitalWrite(7, HIGH);
}
void loop() {
float ax, ay, az;
float gx, gy, gz;
float mx, my, mz;
float roll, pitch, heading;
if (imu.available()) {
// Read the motion sensors
imu.readMotionSensor(ax, ay, az, gx, gy, gz, mx, my, mz);
// Update the SensorFusion filter
filter.update(gx, gy, gz, ax, ay, az, mx, my, mz);
}
// roll = filter.getRoll();
// pitch = filter.getPitch();
heading = filter.getYaw();
if(heading<(-1)){
for (int x=0;x<4;x++){
leds[x]=CRGB(0,55,255);
FastLED.show();
}
}
if(heading>(1)){
for (int x=7;x<11;x++){
leds[x]=CRGB(200,155,0);
FastLED.show();
}
}
if(heading>(-1)&& heading<1){
for (int x=5;x<7;x++){
leds[x]=CRGB(0,155,0);
FastLED.show();
}
}
for (int x=0;x<NUM_LEDS;x++){
leds[x]=CRGB(0,0,0);
FastLED.show();
}
}
// Decide when to print
bool readyToPrint() {
static unsigned long nowMillis;
static unsigned long thenMillis;
// If the Processing visualization sketch is sending "s"
// then send new data each time it wants to redraw
while (Serial.available()) {
int val = Serial.read();
if (val == 's') {
thenMillis = millis();
return true;
}
}
// Otherwise, print 8 times per second, for viewing as
// scrolling numbers in the Arduino Serial Monitor
nowMillis = millis();
if (nowMillis - thenMillis > 125) {
thenMillis = nowMillis;
return true;
}
return false;
}
Scanning...
Device found at address 0x1E (LSM303D,HMC5883L,FXOS8700,LIS3DSH)
Device found at address 0x20 (MCP23017,MCP23008,FXAS21002)
Device found at address 0x60 (MPL3115,MCP4725,MCP4728,TEA5767,Si5351)
done
The fact that the AMP was never working on arrival, and the gyro was working but then stopped
My amp doesn't work either, or rather is makes buzzing and popping noises but no talkie sound out.
Magnetic Calibration
Hard Iron Offset
37.12
14.83
117.04
Soft Iron Mapping
1.0112 -0.0082 -0.0173
-0.0082 0.9917 0.0323
-0.0173 0.0323 0.9986
Flash Memory has 8388608 bytes.
Erasing ALL Flash Memory:
estimated wait: 20 seconds.
Yes, full chip erase is SLOW!
...................
Erase completed
actual wait: 19 seconds.
Raw SerialFlash Hardware Test
Read Chip Identification:
JEDEC ID: EF 40 17
Part Nummber: W25Q64FV
Memory Size: 8388608 bytes
Block Size: 65536 bytes
Reading Chip...
Writing 4096 signatures
Double Checking All Signatures:
all 4096 signatures read ok
Checking Signature Pairs
all 2047 signature pairs read ok
Checking Read-While-Write (Program Suspend)
write 256 bytes at 256
write time was 441 microseconds.
read-while-writing: 00 00 00 00 15 F5 95 4B
test passed, good read while writing
Checking Read-While-Erase (Erase Suspend)
erase time was 166322 microseconds.
erase correctly erased 65536 bytes
read-while-erasing: 00 00 00 00 15 F5 95 4B
test passed, good read while erasing
All Tests Passed
Test data was written to your chip. You must run
EraseEverything before using this chip for files.
void readMotionSensor(float& ax, float& ay, float& az, float& gx, float& gy, float& gz)
#include <NXPMotionSense.h>
NXPMotionSense imu;
const int ledPin = 13;
int ledState = LOW;
elapsedMillis ledMillis = 0;
elapsedMillis serialMillis = 0;
void setup() {
Serial.begin(115200);
while (!Serial) ; // wait for serial port open
imu.begin();
pinMode(ledPin, OUTPUT);
}
float movingAverage[3];
void loop() {
float gyro[3]; //gyro data in order x y z
float dummy; //a dummy int where readMotionSensor can dump the accel data
// get data
if (imu.available()) {
imu.readMotionSensor(dummy, dummy, dummy, gyro[0], gyro[1], gyro[2]);
//recalculate averages
for (int i=0 ; i<3 ; i++) {
movingAverage[i] = movingAverage[i]*0.999f + gyro[i]*0.001f;
}
}
//print to serial
if (serialMillis >= 500) {
serialMillis -= 500;
Serial.print(movingAverage[0], 5);
Serial.print(", ");
Serial.print(movingAverage[1], 5);
Serial.print(", ");
Serial.print(movingAverage[2], 5);
Serial.println("");
}
//blink LED
if (ledMillis >= 1000) {
ledMillis -= 1000;
if (ledState == LOW) digitalWrite(ledPin, ledState = HIGH);
else digitalWrite(ledPin, ledState = LOW);
}
}
-0.84893, 0.86430, -0.09326
-0.84667, 0.86420, -0.09219
-0.84867, 0.86518, -0.09173
-0.84748, 0.86680, -0.09283
-0.84604, 0.86525, -0.09367
-0.84852, 0.86463, -0.09165
-0.84878, 0.86428, -0.09439
-0.85037, 0.86443, -0.09540
-0.85026, 0.86683, -0.09417
-0.85017, 0.86826, -0.09538
-0.85107, 0.86773, -0.09533
-0.85257, 0.86840, -0.09655
-0.85200, 0.86745, -0.09800
-0.85093, 0.86623, -0.09696
-0.85047, 0.86623, -0.09711
-1.34035, 0.90906, -0.11356
-1.33845, 0.91073, -0.11148
-1.33725, 0.91161, -0.11435
-1.33792, 0.91184, -0.11460
-1.34183, 0.91223, -0.11400
-1.34252, 0.91236, -0.11414
-1.34392, 0.91208, -0.11436
-1.34487, 0.91015, -0.11354
-1.34541, 0.91029, -0.11263
-1.34278, 0.91131, -0.11257
-1.34313, 0.91252, -0.11180
-1.34338, 0.91340, -0.11340
-1.34475, 0.91323, -0.11154
-1.34332, 0.91596, -0.11416
-1.34294, 0.91321, -0.11297
-1.34327, 0.91095, -0.11272
-1.34219, 0.91169, -0.11136
-0.05944, -0.16238, -0.14935
-0.05749, -0.16098, -0.14897
-0.05449, -0.16069, -0.14927
-0.05210, -0.15898, -0.15031
-0.05385, -0.15895, -0.15127
-0.05415, -0.15820, -0.14912
-0.05351, -0.15895, -0.15041
-0.05318, -0.15829, -0.15199
-0.05139, -0.15831, -0.15188
-0.05335, -0.15680, -0.15171
-0.05411, -0.15773, -0.15200
-0.05561, -0.15742, -0.15084
-0.03475, -0.14212, -0.12813
-0.03416, -0.14235, -0.12915
-0.03388, -0.14054, -0.12969
-0.03787, -0.14303, -0.12819
-0.03777, -0.14283, -0.12675
-0.03887, -0.14247, -0.12647
-0.03645, -0.14157, -0.12542
-0.03870, -0.14204, -0.12572
-0.04091, -0.14277, -0.12654
-0.04022, -0.14199, -0.12671
-0.04048, -0.14185, -0.12665
-0.04136, -0.14095, -0.12530
start . . . .
-0.04247, -0.10901, 0.02902
-0.06639, -0.18005, 0.04410
-0.11375, -0.24709, 0.06488
-0.13281, -0.31292, 0.08098
5:46 PM 3/17/2016 << SHAKEN ------
-0.59318, -1.51788, 0.42819
-0.58274, -1.51893, 0.42942
-0.58738, -1.51972, 0.42839
-0.57681, -1.52116, 0.42955
-0.59812, -1.50247, 0.42839
-0.65898, -1.38084, 0.43402
-0.25908, -1.63214, 1.44146
0.14189, 0.06166, 8.98632
3.02387, 2.91671, 14.67131
0.66231, -2.42216, 8.66873
-1.31853, -2.32576, 6.60831
-1.17767, -7.79408, 5.01112
-3.46747, -8.11082, 2.89802
-5.42296, -6.96765, 4.24515
-6.10721, -2.44790, 6.41113
-14.44281, -4.94015, 0.33017
2.65920, -0.94411, 1.12840
1.31437, 0.33808, -0.58399
-2.00174, 1.72423, 4.66322
-10.22663, -4.30171, 2.26541
-3.60680, -4.13442, 15.68208
-10.63062, -7.40791, 16.42157
-3.90650, -11.72521, 26.51940
-10.97616, -16.72645, 27.21338
-23.27667, -20.32959, 26.55439
-9.62276, -32.31821, 38.67164
-21.80443, -28.03357, 38.99112
-28.18420, -23.33231, 36.39219
-15.59743, -20.68818, 35.60229
-15.64517, -20.55730, 31.66413
-15.28123, -20.39620, 31.36851
-13.62677, -19.14669, 30.07308
-12.73997, -18.11305, 28.78445
-12.28807, -17.02123, 27.35917
-11.72452, -16.24940, 26.02020
-11.21889, -15.43207, 24.69112
-10.69281, -14.75488, 23.50751
-10.19556, -14.11033, 22.38184
-9.72129, -13.49634, 21.30986
-9.27108, -12.91413, 20.29208
-8.84080, -12.35932, 19.32423
-8.43734, -11.83174, 18.40151
.....
5:47 PM 3/17/2016
-0.48299, -1.55495, 0.44116
-0.48422, -1.55546, 0.44034
-0.48626, -1.55626, 0.43960
-0.48260, -1.55343, 0.43997
-0.48470, -1.55185, 0.43926
-0.48321, -1.55095, 0.43906
-0.48041, -1.55131, 0.44045
-0.47650, -1.55069, 0.43943
-0.47687, -1.54943, 0.43912
-0.47565, -1.54971, 0.43813
-0.47556, -1.54871, 0.43860
...
5:50 PM 3/17/2016
-0.50408, -1.56597, 0.43822
-0.50244, -1.56552, 0.43693
-0.50187, -1.56409, 0.43657
-0.49845, -1.56345, 0.43589
-0.49353, -1.56108, 0.43424
-0.48901, -1.56221, 0.43391
-0.48772, -1.56082, 0.43308
...
5:53 PM 3/17/2016
-0.48281, -1.54704, 0.42940
-0.48391, -1.54445, 0.42945
-0.48389, -1.54641, 0.43032
-0.48273, -1.54937, 0.42987
-0.48642, -1.55147, 0.43049
-0.48792, -1.55275, 0.43046
...
5:54 PM 3/17/2016 SHAKEN -----------
-0.49586, -1.55172, 0.43597
-0.50018, -1.54983, 0.43538
-0.50000, -1.55112, 0.43399
-0.49940, -1.54848, 0.43287
-0.49826, -1.54931, 0.43223
-0.49491, -1.59703, 0.43003
-0.49002, -1.57563, 0.43150
1.28545, -2.61965, 1.63388
6.46129, 3.88872, 10.08814
8.22576, 7.54464, 11.63682
4.93702, 3.75111, 0.01044
5.35784, -19.14593, -4.40086
9.40530, -18.00746, 5.93152
4.47634, -21.19606, 4.80288
3.85115, -22.13147, 4.60667
2.13024, -12.96994, 7.73207
4.80907, -15.34549, 8.33710
5.28452, -16.29916, 7.15517
6.85971, -13.02245, 8.16220
3.80305, -11.93313, 3.55960
5.15795, -9.09268, 1.02516
11.93230, -16.75019, 4.95976
12.76663, -16.15040, 5.06468
7.54164, -4.99982, -1.33484
8.11709, -6.08714, 0.14008
12.11487, -16.91682, 3.41119
7.58032, -16.25744, 3.28042
3.48484, -16.52768, 2.05204
3.53077, -16.89972, 3.21459
2.02319, -15.30025, 2.63088
1.90327, -14.76658, 2.53200
2.47600, -14.14725, 2.36687
2.32917, -13.53267, 2.27178
2.18840, -12.94291, 2.17907
2.06383, -12.38399, 2.09223
1.93189, -11.85363, 2.01160
...
5:56 PM 3/17/2016
-0.58058, -1.50875, 0.42752
-0.57788, -1.50825, 0.42826
-0.58097, -1.50870, 0.42810
...
5:58 PM 3/17/2016
-0.59716, -1.52556, 0.42761
-0.59407, -1.52492, 0.42695
-0.59543, -1.52583, 0.42655
-0.59634, -1.52402, 0.42593
...
6:04 PM 3/17/2016
-0.60611, -1.50448, 0.42727
-0.60418, -1.50658, 0.42704
-0.60132, -1.50609, 0.42868
-0.60488, -1.50792, 0.42989
-0.60348, -1.50779, 0.43117
-0.60405, -1.50784, 0.43032
-0.60153, -1.50988, 0.43049
-0.60123, -1.51133, 0.43034
-0.60304, -1.50955, 0.42771

Michael, do you mean the 5DCG pin area when you say APA102 connection?Be careful when de-soldering the APA102 connection,