I´m a greenhorn and completely new to Arduinos and even Electronics in general. I can programm with C++/Java so i have some experience in that at least.
I decided/wanted to make a Ventilation "System" for my Airsoft Helmet/glasses.
I bought a Nano Every, a 5v Poti which turned out to be analog, one Noctua NF-A4x10 5v PWM fan and a Powerbank with multiple 5v 3A usb connections. I dont count the breadboard and cables into that here.
I have read many articles, most of them were with the Arduino Uno Rev2 and Rev3, but i still have a few questions before i start to play around.
First:
From my quite basic understanding, it would be possible to read the analog input of the Poti and give an Output on an digital pin for the PWM signal i need, right ?
Second:
Would it be easier and or even possible, to give get an PWM signal out of an analog pin ?
This is somewhat complicated on the Nano Every. It can be done, but may change or break several other pwm channels because the prescaler on TCA needs changing in order to set an output frequency of 25KHz frequency on one of the TCB channels.
greenhorn and completely new to Arduinos
You will find the hardware timer control more simple, better documented, and with lots of available examples if you use a classic Nano V3.0
Alright. That's what I expected to hear regarding my questions 1 and 2, thank you.
And to the third question:
I mean, I only need one pin as PWM output. So if achieving that means, other pins are not usable/broken, it would be a risk I would take.
But how to set the frequency to the 25khz is in the documentation of the nano v3, did I understood it right?
And where are the differences between nano every and nano v3 ?
The Nano Every, using the ATmega 4809, is based on an entirely different processor than the Nano which uses the ATmega 328. The only thing the boards share in common is the physical size, the name and the pin out.
The Nano Every is a very powerful device, and the timers which are used to generate the pwm, and the registers which configure them are entirely different. None of the documented procedures for generating 25KHz pwm on the Nano will work on the Nano Every.
Many people, myself included, think that Arduino made an error in confounding the two devices and there are many disappointed Nano Every users who expected to port over programs from the standard Nano.
I put the Arduino into the Breadboard just like the EMC2101 and connected them accroding to their pin& connection documentation. The Arduino gets his power through its own USB port and the EMC2101 should recieve its 5v thorugh the Arduino, but it doesn´t. I tried 3.3v too and nothing there either.
I´m very certain that i didn´t fry the EMC2101 as i followed all steps closely and tripple checked everything before powering. As far as i saw/read, it doesn´t need an external power source either and should run from the 5v of the Arduino.
I had the Arduino on the first time now and just ran some unsuccessful Connection Testing with the Library provided by Adafruit. I did miss something but i dont know what.
I did connect the EMC to the Arduino with the SDA, SCL, GND and 5v Pins
Do you have a multimeter so that you can read voltage?
With just the Nano Every plugged into USB, what do you read at the 5V pin?
If there is indeed 5v, then connect the EMC2101 to the Arduino 5v, Arduino GND, SDA and SCL and run this i2c scanner program. Is the EMC2101 seen on the bus?
// I2C Scanner
// Written by Nick Gammon
// Date: 20th April 2011
#include <Wire.h>
void setup() {
Serial.begin (115200);
// Leonardo: wait for serial port to connect
while (!Serial)
{
}
delay(2000);
Serial.println ();
Serial.println ("I2C scanner. Scanning ...");
byte count = 0;
Wire.begin();
for (byte i = 8; i < 120; i++)
{
Wire.beginTransmission (i);
if (Wire.endTransmission () == 0)
{
Serial.print ("Found address: ");
Serial.print (i, DEC);
Serial.print (" (0x");
Serial.print (i, HEX);
Serial.println (")");
count++;
delay (1); // maybe unneeded?
} // end of good response
} // end of for loop
Serial.println ("Done.");
Serial.print ("Found ");
Serial.print (count, DEC);
Serial.println (" device(s).");
} // end of setup
void loop() {}
The 5v pin of the Arduino is reading a big 0, means nothing (When in Breadboard). And it reads 4.55v with nothing else then the Arduino, so just the Board.
3.3v pin is reading with 3.2v.
The Scanner didnt found anything. But the diode on the EMC, that it is powered isnt on either, not even when i connect the EMC to the 3.3v pin of the Arduino
Edit 10:37 UTC/Berlin
With the Arduino came 2 rows of pins, connected with a black plastic, and they were the issue. Without those, everything is working fine and the EMC2101 is getting detected and I can read the sensors out.
I hoped that I can go without soldering but this is not big deal
It is a big flimsy with the breadboard but it is working.
Here is the Code:
#include <Wire.h> //Needed ?!
#include <Adafruit_EMC2101.h>
Adafruit_EMC2101 emc2101;
const int analogPinPoti = A1; //Poti and his Connected Pin
int poti = 0; //Poti Var
int potiValue = 0; //PotiValue Var
void setup() {
Serial.begin(115200); //Wasnt sure what to take and i went with the Standard Value from the Adafruit_emc2101_test.imo
while(!Serial) delay(10);
//Copied from adafruit_emc2101_test.imo!
Serial.println("EMC2101 Connection Test...");
// Try to initialize!
if (!emc2101.begin()) {
Serial.println("Failed to find EMC2101");
while (1) { delay(10); }
}
Serial.println("EMC2101 Found!");
}
void loop() {
poti = analogRead(analogPinPoti); //Reading Potentiometer Values
potiValue = map(poti, 0, 1023, 0, 100); //Maping Poti Value to 0-100
emc2101.setDutyCycle(potiValue); //Giving the Poti Values as PWM & to the EMC2101
Serial.println(emc2101.getDutyCycle()); //Reading the PWM %
delay(100);
}
Thank you @cattledog for your help!
I consider it done and successful, tho the code maybe can be improved.
Good news that you got everything working. Thanks for the update.
With the Arduino came 2 rows of pins, connected with a black plastic, and they were the issue. Without those, everything is working fine and the EMC2101 is getting detected and I can read the sensors out.
I hoped that I can go without soldering but this is not big deal
If those pins are not soldered to the Arduino it wont work with a breadboard. You would not be the first new user to post on this board who just placed the Arduino on top of the pins. You can often order your Arduino with the pins already soldered in place.
Yeah it was the same with the EMC2101. I soldered everything together now with the focus on making it as compact as I can. so I soldered without the breadboard but it still was quite useful as a test bed. This was also my first time soldering too and it is working just fine.