I have a big problem in my little project: arduino atmega 168 & gy521 accelator/sensor. I've write a short, test code and it seems good, but I cannot see the 3 axes acceleration values. m168 mini pcb is probably well connected with gy521 pcb sensor. Very, very simple code shows the movement, but cannot show the figures. I tried with serial.print, but in opened IDE (1.8.19) after pressing "serial monitor" I get only "Board at null is not available". Help me please...
Help You..... From where should we start as both schematics and code are absent?
@gbk7
Welcome to the Forum! Read the forum guidelines to see how to properly ask a question and some good information on making a good post. You will get faster and better help if you post more detail about your project, insert the connection diagram, and show all your code as requested by the forum guidelines.
OK, I'm supplying the missing things,
however I thing, the problem is rather general.
Code from arduino GY521 examples:
//
// FILE: GY521_test_1.ino
// AUTHOR: Rob Tillaart
// PURPOSE: minimal demo to test working of the sensor.
// URL: https://github.com/RobTillaart/GY521
#include "GY521.h"
GY521 sensor(0x68);
uint32_t counter = 0;
void setup()
{
Serial.begin(9600);
Serial.println();
Serial.println(__FILE__);
Serial.print("GY521_LIB_VERSION: ");
Serial.println(GY521_LIB_VERSION);
Wire.begin();
delay(100);
while (sensor.wakeup() == false)
{
Serial.print(millis());
Serial.println("\tCould not connect to GY521: please check the GY521 address (0x68/0x69)");
delay(1000);
}
sensor.setAccelSensitivity(0); // 2g
sensor.setGyroSensitivity(0); // 250 degrees/s
sensor.setThrottle();
Serial.println("start...");
// set calibration values from calibration sketch.
sensor.axe = 0;
sensor.aye = 0;
sensor.aze = 0;
sensor.gxe = 0;
sensor.gye = 0;
sensor.gze = 0;
}
void loop()
{
sensor.read();
float ax = sensor.getAccelX();
float ay = sensor.getAccelY();
float az = sensor.getAccelZ();
float gx = sensor.getGyroX();
float gy = sensor.getGyroY();
float gz = sensor.getGyroZ();
float t = sensor.getTemperature();
if (counter % 10 == 0)
{
Serial.println("\n\tACCELEROMETER\t\tGYROSCOPE\t\tTEMPERATURE");
Serial.println("\tax\tay\taz\tgx\tgy\tgz\tT");
}
Serial.print(counter);
Serial.print('\t');
Serial.print(ax, 3);
Serial.print('\t');
Serial.print(ay, 3);
Serial.print('\t');
Serial.print(az, 3);
Serial.print('\t');
Serial.print(gx, 3);
Serial.print('\t');
Serial.print(gy, 3);
Serial.print('\t');
Serial.print(gz, 3);
Serial.print('\t');
Serial.print(t, 3);
Serial.println();
counter++;
delay(1000);
}
// -- END OF FILE --
You're talking about an Atmega168 but are showing a schematic with an Uno. You need to elaborate on that.
You're only referring to Serial Monitor; question is if you can upload your code?
"Board at null is not available" might indicate that you have not selected a COM port.
Thank You sterretje, You are right, but such the schematic is almost the same for UNO and Atmega168. I can upload the code with USBasp programmer. But after removing programmer and connecting Atmega directly to laptop USB I get such an error. It is my first time serial monitor usage attempt. The Tools->Port is greyed/inactive. May be the SD memory card writing is better solution then serial.print?
And how was this done?
On that case you will have to look at the operating system level. Is your board properly recognised by the operating system (which one?).
And the devil is in the details. Please provide the details. Did you design the board yourself? If yes, provide the schematic. If you bought a board online, provide a link. If you bought it in a shop, at least provide focused photos of top and bottom so we can see what we're dealing with?
Note that your problem has nothing to do with serial monitor.
I've prepared a "special plug" USB, connecting VCCplug-VCCboard, GNDplug-GNDboard, TXplug-TXboard, RXplug-RXboard. Such my idea...
And you are wondering.... So you wrote a windows driver also for your "usb-serial"? ![]()
People are having issues even with proper usb-ttl modules and drivers...
- I'm trying to test my Linux-Mint21 USB control
- I know "that devil"
, but that schematic is OK during the programming (USBasp), so "suspicious devil" is rather between Atmega board and Laptop/USB/IDE - "has nothing to do with serial monitor." - why? Without serial monitor it works...
I use Linux Mint, not Windows. What shall I do? Some arduino boards have USB on board, my have not. So I added it manually. What is better way?
I'm not sure if I follow you... It's not the usb-connector that matters, it's the usb-serial converter on the board.
If you want to continue with these boards you have, you can buy a separate usb-ttl converter. Also note that in serial communication tx goes to rx and rx to tx.
Thank You kmin.
Photo of the bottom please. Your board looks very much like a Pro Mini (it isn't exactly as far as I can see). And Pro Minis don't have USB functionality.
An Uno has a built-in serial-to-usb converter to convert the UART's serial data to USB; your board more than likely does not have that.
Serial is not the same as USB. Serial uses Tx/Rx and USB uses D+/D-.
You will have to explain that. And also tell us what your operating thinks of your contraption.
Thank You strretje for clear analysis. You are very helpful. I'm grateful
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.


