Accelerologger: More Problems With New Code!!!

This is now solved!!! Check it out what a silly mistake! NO VOID SETUP!!!!!!

Here is the new code:

#include <SparkFun_ADXL345.h>

#include <SD.h>
#include <SPI.h>

//ADXL345 adxl = ADXL345(10); For SPI Cumunication
ADXL345 adxl = ADXL345();
File myFile;
const int threshold = 1499;
const int switchPin = 7;
int switchState;
int ctr = 0;
int pinCS = 10;
int x,y,z;
int sumX, sumY, sumZ;

void loop() {
//define int x, y, z in setup instead
// also define int sumX, sumY, sumZ in setup
adxl.readAccel(&x, &y, &z);
sumX += x;
sumY += y;
sumZ += z;

switchState = digitalRead(switchPin);

if (switchState == HIGH) {
ctr++;
if (ctr > threshold) {
if (myFile) {
myFile.println(sumY/threshold);
Serial.println(sumY/threshold);
}
else {
Serial.println("error opening test.txt");
}
sumX = 0;
sumY = 0;
sumZ = 0;
ctr = 0;
}

} else //switchState != HIGH
{
myFile.close();
Serial.println("closed");
}
}

But I am having another problem it doesn’t upload it comes up with the error:

Arduino: 1.8.3 (Windows 10), Board: “Arduino Nano, ATmega328”

C:\Users\ETHANJ~1\AppData\Local\Temp\cclGBXne.ltrans1.ltrans.o: In function `main’:

C:\Program Files\Arduino\hardware\arduino\avr\cores\arduino/main.cpp:43: undefined reference to `setup’

collect2.exe: error: ld returned 1 exit status

exit status 1
Error compiling for board Arduino Nano.

This report would have more information with
“Show verbose output during compilation”
option enabled in File -> Preferences.

I hope we can figure out what is wrong!

EJBuilder

(P.S much thanks to Mike’s help!!!)

Accelerologger (Accelerometer Datalogger): Help needed with code!

Hi Everyone, For the scientific investigation awards I have been designing an accelerologger device that reads the speed of Its movement. So far I have constructed the hardware.

It consists of an Arduino Nano, an ADXL 3 axis gyro/accelerometer  and a Micro SD Card Reader . So far I have got each device (accelerometer/gyro + datalogger module) working succesfully and now have been trying to combine the code. Here is what I have done so far:

 

#include <SparkFun_ADXL345.h>
#include <SD.h>
#include <SPI.h>

//ADXL345 adxl = ADXL345(10); For SPI Cumunication
ADXL345 adxl = ADXL345();
File myFile;
const int threshold = 1499;
const int switchPin = 7;
int switchState;
int ctr = 0;
int pinCS = 10;


void setup() {
Serial.begin(9600);
Serial.println();
pinMode(pinCS, OUTPUT);
pinMode(switchPin, OUTPUT);

adxl.powerOn();

adxl.setRangeSetting(16);

adxl.setSpiBit(0);

if (SD.begin())
{
Serial.println(“SD card is ready…”);
} else
{
Serial.println(“SD card initialization failed”);
return;
}

// create and open a file
myFile = SD.open(“testRun.txt”, FILE_WRITE);
}

void loop() {
int x, y, z;
adxl.readAccel(&x, &y, &z);
switchState = digitalRead(switchPin);

if (switchState == HIGH) {
ctr++;
if (ctr > threshold) {
if (myFile) {
myFile.println(y);
Serial.println(y);
}
// if the file didn’t open, print an error:
else {
Serial.println(“error opening test.txt”);
}
}
ctr = 0;
} else
{
myFile.close();
Serial.println(“closed”);
}
}

That is it. It all most works perfectly. The only issues I am facing is that none of the accelerometer details are serially printed or written on the SD card in a text file. If anyone can help please take a look at the code and do.

 

EJBuilder

Ladybird Remote

This a remote design for the LEGO Mindstorm EV3 robotics product. I was playing around with the IR controller and used some LEGO Bionics pieces to make a stand. I was fiddling around with the stand and noticed that the controller can pop forwards and bars shot outwards much like a lady bug. I decorated it and, vola, the LBR was born.

by T.L.

Gyro demo works!

Hi Everyone,

I got the mpu6050’s inbuilt digital motion processor (dmp) to work, outputing stable yaw/pitch/roll (ypr) values. In the end it was easy.  Jeff Rowberg’s github code has been updated so you don’t have to play with the pin to start the dmp. I just followed the instructions here:

http://www.instructables.com/id/MPU6050-Arduino-6-Axis-Accelerometer-Gyro-GY-521-B/

Download Jeff’s libraries (including examples), uncomment one #define, upload it to Arduino Uno, wire it up as shown in the Instructable (or photos below), then start the serial monitor at 115200. Type any key, hit return, and off you go.

If you have trouble, here is a working sketchbook folder:

http://mrelliott.info/blogFiles/ArduinoSketchbook-mpu6050.zip

It appears very stable. See the video:

 

Have fun!

Bob

Hacking Drone Controller: Another Problem, SERIOUSLY???

Hi Everyone, With the drone controller that has been working well for a while, there has been a problem, again!!! I was fiddling with it the other day and I resoldered some the cables that had come loose and it was working perfectly straight after when I tested it (flying the drone). I came back after that and plugged the power source for it in (carefully making sure the polarity was correct) and it didn’t power on. As soon as this problem occurred the troubleshooting side of me kicked. First I did a continuity test on each of the components on the transmitter PCB. Each of results I compared to the other controller of the H8 Mini that I lost in a gust of wind since that is perfect apart from the missing buzzer. After that, I then did a resistance test on all of the components and compared them results as well. Everything was identical. Going of this I am guessing that it is either a wiring problem or a problem with the chip on the controller. If my dodgy way of troubleshooting is correct then we should be able to take off the chip of the lost H8 and replace it with our current one. So with the hassle that it is not all hope is lost (mabye).

Even if the problem is different we have that other board for parts it should be alright!

I hope we can solve it though!!!

EJBuilder

My Drone: EVERYTHING GONE WRONG!!!

Hi Everyone, Sorry to bring bad news on such a successful streak (great drone hacking success).  There is a way to hook up this thing called “vbat” on my drone and all I needed to do it was some wires, which of course as a electronics nerd, I have. “vbat” is, in other words, “voltage monitoring” for your flight controller. The joints on my quad’s PBD are very large (very big quantities of solder). The point is that I had to reflow some of those big joints (the battery terminals) to add the wires. I was using a 25-watt soldering iron, since that was all I had at the time (my new 40-watt one hasn’t turned up). Becuase the iron was quite underpowered, to reflow it I had it hold the iron to it for quite a while to even get it even close to melted. Anyway, once the “vbat” wires were added I was all happy about the new wires added and I plugged it into the computer and none of the lights turned on and there was no response from the board. I am guessing this big problem was caused by me overheating the board and now the chip is fried. This is not the final diagnosis, this is just an educated guess. There may even be a way to fix it, I do not know. Maybe Makerbob could take the flight controller to hackerspace, That would be good.

So that is how it happened, the ruin of my drone. If worse comes to worse I’ll have to buy a new FC.