sparkfunX / Qwiic_Blower_Fan

2-Wire Controllable Nintendo Switch Cooling Fan Breakout
0 stars 0 forks source link

QWIIC BLOWER FAN EXAMPLE FAILS TO RUN #3

Closed JimKruk closed 2 years ago

JimKruk commented 2 years ago

https://www.sparkfun.com/products/18561 Qwiic Blower Fan

downloaded the code from here: https://github.com/sparkfun/SparkFun_Qwiic_Fan_Arduino_Library

Example1_SetFanSpeed using a blackboard. when I plug in the USB the fan comes on before any code is downloaded. After compiling and downloading it see this error in setup:

Qwiic Blower Fan Example 1: Setting the Fan Speed Device failed to setup - stopping thoughts ?

dlkeng commented 2 years ago

That is usually caused by the incorrect I2C address being used. By default, the Qwiic Fan Arduino Library uses the default I2C address of 0x36. Your Sparkfun Qwicc Blower Fan has probably had its I2C address changed. You probably need to run an I2C scan sketch to determine what the I2C address your Sparkfun Qwicc Blower Fan is using.

Once you determine its I2C address, you can change the "blower.begin()" line in the Example1_SetFanSpeed to "blower.begin(Wire, )" and it should then work.

JimKruk commented 2 years ago

Hi Dan Here is the code I am using based on example1 I added a I2C scan function but it says no devices found, When I try and pass a value of 36 I get a compiler error, I am using a blackboard and arduino 1.8.10

no matching function for call to 'PCFan::begin(int)' thanks

/* This is a example written for the SparkFun Qwiic Blower Fan SparkFun sells these at its website: www.sparkfun.com Do you like this library? Help support SparkFun. Buy a board! https://www.sparkfun.com/products/18561

Written by Nick Poole @ SparkFun Electronics, October 258h, 2021

This example code demonstrates how to set and get the fan speed by randomly generating fan speeds between 0 and 8000 RPM and sending them to the board. It then reads the fan tachometer for comparison.

https://github.com/sparkfun/SparkFun_Qwiic_Fan_Arduino_Library

Development environment specifics: Arduino IDE 1.8.7

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/. */

include

include

// Initialize the board PCFan Blower;

void setup() { Wire.begin(); Serial.begin(115200); // Start serial communication at 115200 baud scanI2C(); Serial.println("Qwiic Blower Fan Example 1: Setting the Fan Speed"); if (Blower.begin(36) == true) // Function to check if the board will ACK { Serial.println("Begin"); } else { Serial.println("Device failed to setup - stopping"); while (1); // Just sit and do nothing } Blower.disableFan(); }

void loop() {

// Pick a random speed between 0 and 8000 RPM (In 1000 RPM increments) int randSpeed = random(0,8) * 1000;

// Print the number to the terminal Serial.print("Setting Fan Speed to "); Serial.print(randSpeed); Serial.println(" RPM");

// Set the fan speed Blower.setFanSpeed(randSpeed);

// For the next 3 seconds, once per second, ask the board for a tachometer reading // and report it to the terminal for(byte i = 0; i < 3; i++){ delay(1000); Serial.print("Tachometer Reads "); Serial.print(Blower.getFanSpeed()); Serial.println(" RPM"); }

// Print an empty line to make the terminal more readable Serial.println(); delay(1000);

}

void scanI2C() { byte error, address; int nDevices;

Serial.println("Scanning I2C devices...");

nDevices = 0; for (address = 1; address < 127; address++ ) { // The i2c_scanner uses the return value of // the Write.endTransmisstion to see if // a device did acknowledge to the address. Wire.beginTransmission(address); error = Wire.endTransmission();

if (error == 0)
{
  Serial.print(F("I2C device found at address 0x"));
  Serial.println(address, HEX);
  nDevices++;

}
else if (error == 4)
{
  Serial.print("Unknown error at address 0x");
  if (address < 16)
    Serial.print("0");
  Serial.println(address, HEX);
}

}

// clear row 3 that was display i2c devices found

if (nDevices == 0) { Serial.println("No I2C devices found\n");

} else { Serial.print(nDevices);Serial.println(" I2C devices found");

} delay(1000); // wait 5 seconds for next scan

}

On Wed, Dec 29, 2021 at 9:38 AM Dan @.***> wrote:

That is usually caused by the incorrect I2C address being used. By default, the Qwiic Fan Arduino Library uses the default I2C address of 0x36. Your Sparkfun Qwicc Blower Fan has probably had its I2C address changed. You probably need to run an I2C scan sketch to determine what the I2C address your Sparkfun Qwicc Blower Fan is using.

Once you determine its I2C address, you can change the "blower.begin()" line in the Example1_SetFanSpeed to "blower.begin(Wire,

*)*" and it should then work. — Reply to this email directly, view it on GitHub , or unsubscribe . Triage notifications on the go with GitHub Mobile for iOS or Android . You are receiving this because you authored the thread.Message ID: ***@***.***>
JimKruk commented 2 years ago

fyi I added a second I2C device (TMP117) and it discovered that but not the fan so the scan routine seems ok

Scanning I2C devices... I2C device found at address 0x48 1 I2C devices found

On Wed, Dec 29, 2021 at 9:38 AM Dan @.***> wrote:

That is usually caused by the incorrect I2C address being used. By default, the Qwiic Fan Arduino Library uses the default I2C address of 0x36. Your Sparkfun Qwicc Blower Fan has probably had its I2C address changed. You probably need to run an I2C scan sketch to determine what the I2C address your Sparkfun Qwicc Blower Fan is using.

Once you determine its I2C address, you can change the "blower.begin()" line in the Example1_SetFanSpeed to "blower.begin(Wire,

*)*" and it should then work. — Reply to this email directly, view it on GitHub , or unsubscribe . Triage notifications on the go with GitHub Mobile for iOS or Android . You are receiving this because you authored the thread.Message ID: ***@***.***>
PaulZC commented 2 years ago

Hi @JimKruk ,

Which processor board are you using? If you're using an Artemis-based board, this might be a clock-stretching issue.

Have you tried ignoring the result of Blower.begin()? What happens if you comment the while(1); // Just sit and do nothing? Does the rest of the code run normally?

Best wishes, Paul

dlkeng commented 2 years ago

Jim, The fact you can scan and find another I2C device says you might have a problem with your Qwiic Blower Fan. Are you sure you are providing about 3.3V to it? You can measure it on the labeled point near the edge on the top or bottom of the board. Also, make sure your SDA and SCL (and GND) connections are all OK in the Qwiic wiring cable if that's what you're using.

If your Qwiic Blower Fan is getting power and your connections are OK, then you might have a defective Qwiic Blower Fan. If that's the case, I'm afraid I can't help you. (If you are familiar with electronics troubleshooting, you could also check that pin 2 of the 6-pin AVR ISP Connector holes on the back side of the board measures about 5V. If not, there could be a problem with the onboard U3 DC-DC Converter - see schematic. Everything on the Qwiic Blower Fan runs on 5V)

Also, two things about the use of the alternate "Blower.begin()". First, you are missing the "Wire" parameter and second, the address you used was decimal and you probably want the hex number with a leading '0x' (that's what the scan tool provides). That's why you had the compile error. The "begin()" optionally takes two parameters: TwoWire &wirePort and uint8_t deviceAddress.

JimKruk commented 2 years ago

Hi Paul I am using the sparkfun blackboard with a qwiic connection I am not home right now but will try commenting out the loop and let you know. Kinda doubt it will work since the i2c scanner does not see anything. Thanks On Wed, Dec 29, 2021 at 11:34 AM Paul @.***> wrote:

Hi @JimKruk https://github.com/JimKruk ,

Which processor board are you using? If you're using an Artemis-based board, this might be a clock-stretching issue.

Have you tried ignoring the result of Blower.begin()? What happens if you comment the while(1); // Just sit and do nothing? Does the rest of the code run normally?

Best wishes, Paul

— Reply to this email directly, view it on GitHub https://github.com/sparkfunX/Qwiic_Blower_Fan/issues/3#issuecomment-1002678478, or unsubscribe https://github.com/notifications/unsubscribe-auth/AI3Q37P7GYQFHMHRAY7E7Q3UTM2DFANCNFSM5K265ULQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you were mentioned.Message ID: @.***>

JimKruk commented 2 years ago

Hi Dan Do you have an example of what I would code on the begin() line ? When I get home home I will try and get some voltage measurements. I am using a blackboard and a qwiic cable so no wiring per say. Thanks

On Wed, Dec 29, 2021 at 11:38 AM Dan @.***> wrote:

Jim, The fact you can scan and find another I2C device says you might have a problem with your Qwiic Blower Fan. Are you sure you are providing about 3.3V to it? You can measure it on the labeled point near the edge on the top or bottom of the board. Also, make sure your SDA and SCL (and GND) connections are all OK in the Qwiic wiring cable if that's what you're using.

If your Qwiic Blower Fan is getting power and your connections are OK, then you might have a defective Qwiic Blower Fan. If that's the case, I'm afraid I can't help you. (If you are familiar with electronics troubleshooting, you could also check that pin 2 of the 6-pin AVR ISP Connector holes on the back side of the board measures about 5V. If not, there could be a problem with the onboard U3 DC-DC Converter - see schematic. Everything on the Qwiic Blower Fan runs on 5V)

Also, two things about the use of the alternate "button.begin()". First, you are missing the "Wire" parameter and second, the address you used was decimal and you probably want the hex number with a leading '0x' (that's what the scan tool provides). That's why you had the compile error. The "begin()" optionally takes two parameters: TwoWire &wirePort and uint8_t deviceAddress.

— Reply to this email directly, view it on GitHub https://github.com/sparkfunX/Qwiic_Blower_Fan/issues/3#issuecomment-1002679916, or unsubscribe https://github.com/notifications/unsubscribe-auth/AI3Q37OWL6HOBX6FQOUBI7LUTM2QJANCNFSM5K265ULQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you were mentioned.Message ID: @.***>

dlkeng commented 2 years ago

Jim, Assuming you can get the I2C scan to find your Fan, for example: I2C device found at address 0x40

then use: if (Blower.begin(Wire, 0x40) == true)

in place of the default: if (Blower.begin() == true)

Note: The Blower.begin() basically does a scan of one particular I2C address looking for a device at that address to acknowledge the query of that address. So, if a I2C scan sketch can find the Fan's I2C address, a Blower.begin() that implicitly (at 0x36) or explicitly at a specified address should also be successful.

As far as I can see from the Sparkfun Blackboard schematics, it is essentially the standard Arduino UNO compatible with Qwiic connections and being able to optionally run the processor at 3.3V instead of 5V. As to Paul's comment about clock-stretching, this should not be an issue as its ATmega328 TWI supports clock stretching.

JimKruk commented 2 years ago

Hi Dan I commented out the //while (1); // Just sit and do nothing

The code continues but does not change the fane speed.

Scanning I2C devices... I2C device found at address 0x48 1 I2C devices found Qwiic Blower Fan Example 1: Setting the Fan Speed Device failed to setup - stopping Setting Fan Speed to 7000 RPM Tachometer Reads 0 RPM Tachometer Reads 0 RPM Tachometer Reads 0 RPM

Setting Fan Speed to 1000 RPM Tachometer Reads 0 RPM Tachometer Reads 0 RPM Tachometer Reads 0 RPM

I actually bought two of these fans and both have the same problem. The fact the i2c scanner can find the tmp117 sensor makes me believe there is something wrong with the boards. Are you a SF employee ? could you pull one from stock and see if it has the same issue ? thanks

dlkeng commented 2 years ago

Jim, Sorry, I'm just a long time Sparkfun customer and product user. You'll have to contact Sparkfun Customer Support to get help in resolving the problem with your bad boards.

I don't actually have one of their Fan boards but have compiled its firmware to run on an Arduino Nano to simulate some of its operation to better understand how it works. In my simulated testing, I've turned off the PI loop operation and have just used its proportional throttle operation.

Since you can't find the Fan's I2C address, you'll never be able to control or communicate with the Fan. Commenting out the while(1) is unlikely to change anything - it just allows blindly sending commands to the I2C bus with nothing responding to them. If you've confirmed all of the Qwicc connections, it sounds like your units are defective!

JimKruk commented 2 years ago

Hi Dan Ok, thanks for all your help, greatly appreciated ! I am disappointed in SF right now, they would not even look at the issue in their forums and told me to post here but I will reach out to their customer service team to setup a return.

NPoole commented 2 years ago

Hi everyone, Sorry for the delay. I'm the engineer who designed the product and I'm on holiday vacation. It is, of course, our (SparkX) fault that you were directed away from Tech Support. They've been instructed to direct tech support requests to us so we don't burden them with our "experimental" products.

It sounds possible that you got a defective board, since it isn't responding on any I2C address. Have you tried both Qwiic connectors on the fan board?

If you have experience using the "upload using programmer" function in Arduino (and an ISP or arduino board that you can load ArduinoISP on, then you can attempt to reprogram the firmware.

Otherwise, if your board has never worked, we can replace it.

Also, @dlkeng, thanks for being on top of this! It sounds like you did everything you could considering you don't have the unit in front of you.

JimKruk commented 2 years ago

Hi Nick Thanks for getting back to me, I did try both qwiic connectors. I don’t have any experience with reprogramming the firmware, probably out of my skill set :( I don’t want to burden you on your vacation, this can wait until next week.

Any chance you could pull one from stock next week and see it it also fails or should I go ahead and mail them back ? Could someone test the new ones before mailing them back ? Thanks again for the quick reply! Jim

On Wed, Dec 29, 2021 at 7:32 PM Nick Poole @.***> wrote:

Hi everyone, Sorry for the delay. I'm the engineer who designed the product and I'm on holiday vacation. It is, of course, our (SparkX) fault that you were directed away from Tech Support. They've been instructed to direct tech support requests to us so we don't burden them with our "experimental" products.

It sounds possible that you got a defective board, since it isn't responding on any I2C address. Have you tried both Qwiic connectors on the fan board?

If you have experience using the "upload using programmer" function in Arduino (and an ISP or arduino board that you can load ArduinoISP on, then you can attempt to reprogram the firmware.

Otherwise, if your board has never worked, we can replace it.

Also, @dlkeng https://github.com/dlkeng, thanks for being on top of this! It sounds like you did everything you could considering you don't have the unit in front of you.

— Reply to this email directly, view it on GitHub https://github.com/sparkfunX/Qwiic_Blower_Fan/issues/3#issuecomment-1002824926, or unsubscribe https://github.com/notifications/unsubscribe-auth/AI3Q37PCPU6EHLD4UFV7LUDUTOSDDANCNFSM5K265ULQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you were mentioned.Message ID: @.***>

NPoole commented 2 years ago

No worries!

Yes, I'll email someone at the office and see if we can do that. I'll let you know when I hear back

JimKruk commented 2 years ago

Great, thanks Nick !

On Wed, Dec 29, 2021 at 8:21 PM Nick Poole @.***> wrote:

No worries!

Yes, I'll email someone at the office and see if we can do that. I'll let you know when I hear back

— Reply to this email directly, view it on GitHub https://github.com/sparkfunX/Qwiic_Blower_Fan/issues/3#issuecomment-1002833867, or unsubscribe https://github.com/notifications/unsubscribe-auth/AI3Q37PTURFVLY2DTAMQ7WLUTOXYBANCNFSM5K265ULQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you were mentioned.Message ID: @.***>

NPoole commented 2 years ago

Hey @JimKruk, just want to let you know that we're working on testing a unit to ship you as a replacement, no need to send us back the busted one. I'll make sure someone emails you from SparkFun when the replacement ships. Sorry again for the delay.

JimKruk commented 2 years ago

Awesome, thanks for the update Nick. Btw Russell Turner from sf emailed me about this also, not sure he is coordinating with you on this.

Curious, is this a firmware issue or just bad luck on the two fans I received? Thanks

On Wed, Jan 5, 2022 at 1:24 AM Nick Poole @.***> wrote:

Hey @JimKruk https://github.com/JimKruk, just want to let you know that we're working on testing a unit to ship you as a replacement, no need to send us back the busted one. I'll make sure someone emails you from SparkFun when the replacement ships. Sorry again for the delay.

— Reply to this email directly, view it on GitHub https://github.com/sparkfunX/Qwiic_Blower_Fan/issues/3#issuecomment-1005415677, or unsubscribe https://github.com/notifications/unsubscribe-auth/AI3Q37N244KNWWHMAGPE3KLUUPP3JANCNFSM5K265ULQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you were mentioned.Message ID: @.***>

NPoole commented 2 years ago

I just messaged him to make sure we're not duplicating our efforts

It seems to me that there was no firmware on the unit that you received and right now we're trying to determine whether a few units were faulty or if an entire batch made it into stock without getting programmed.

JimKruk commented 2 years ago

Ok, thanks.

On Wed, Jan 5, 2022 at 2:38 PM Nick Poole @.***> wrote:

I just messaged him to make sure we're not duplicating our efforts

It seems to me that there was no firmware on the unit that you received and right now we're trying to determine whether a few units were faulty or if an entire batch made it into stock without getting programmed.

— Reply to this email directly, view it on GitHub https://github.com/sparkfunX/Qwiic_Blower_Fan/issues/3#issuecomment-1006021160, or unsubscribe https://github.com/notifications/unsubscribe-auth/AI3Q37JUTM6O4UYVWDUOHDDUUSM27ANCNFSM5K265ULQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you were mentioned.Message ID: @.***>

JimKruk commented 2 years ago

Hi Nick I received replacement fans today, order # 6900103, still not working, the i2c scan routine does not detect it. If it is a firmware update and something that is documented or someone has time to walk me through I am willing to try it vs mailing back and forth, let me know, thanks

JimKruk commented 2 years ago

Hi Nick Russell just replied and said you would take the lead on this. If you want me to attempt updating firmware and can walk me through it I’ll try. I have no special hardware, etc but willing to try

JimKruk commented 2 years ago

Hi Nick Was wondering if you were able to get an updated firmware to work ? I have four boards now if you want me to try and test something, thanks

NPoole commented 2 years ago

Hi Jim! Sorry for the delay. The problem you have isn't that you got a firmware that doesn't work, but that you didn't get any firmware at all. As far as I can tell, we've somehow sent you a number of completely unprogrammed units.

You could program the firmware on these units using a SparkFun Redboard/Arduino Uno/etc. as a programmer, if you want to attempt it, I'll give you instructions here. I've just tried it on my end to make sure it works.

Step 1) Program Redboard with the ArduinoISP sketch Since you mentioned that you don't have a programmer on-hand, we're gonna use a Redboard (or other Uno-style Arduino board) as a programmer. The Arduino IDE actually includes the sketch for doing this as a Built-In Example.

ArduinoISP

Open this sketch and Upload it

Step 2) Attach the RedBoard to your Qwiic Fan Blower Now you'll need to connect the RedBoard to the programming header on the Qwiic Blower Fan. The programming header is the 2x3 pin header on the backside of the board. I soldered pins to mine during firmware development, and this is the most reliable way, but you could theoretically just push header pins against it to make a temporary connection.

20220111_184702

Here is the pinout of the Qwiic Blower programming header. Pin 1 is the one marked with a line on the silkscreen:

Pin 1*: MISO  | Pin 2: 3.3V
Pin 3: SCK    | Pin 4: MOSI
Pin 5: D10    | Pin 6: GND

Step 3) Install the board package Before you can program the Qwiic Blower, you'll need the Arduino Board Package for the attiny841 that the board is based on. You can do this through the Arduino Board Manager. Search "attinycore" and install the package as shown

boardsman

Step 4) Open the firmware in Arduino You can find the firmware Arduino sketch in this repo. Either clone the repo or download the zip file and open "Qwiic_Fan_Controller" in the \Firmware directory.

Step 5) Set the board options There are a number of options that need to be correctly selected in order for the firmware to be compiled for the correct target. Here is a screenshot of the correct options. Make sure your menu matches this (the COM port doesn't matter)

Step 6) Select "Arduino as ISP" as your programmer

ArduinoISP_Settings

Step 7) Run the "Burn Bootloader" option in the "Tools" menu Even though we've selected the No Bootloader version of the board profile, we still need to run "Burn Bootloader" in order to setup the attiny chip according to the selections we made in the tools menu. It should take a few moments. If it's successful, you should see "avrdude done. Thank you." in the output pane. If it fails, check your wiring.

Step 8) Program the firmware You should now be able to select the "Upload" or "Upload using Programmer" option and program the firmware to the board. This will take a few minutes because of the throughput limitations of the "Arduino as ISP" setup. Your output pane will look like this while it's writing:

ArduinoISP_Running

Once this is finished, the board should be programmed. If you decide to attempt this, please let me know how it goes. I'm going to close this issue for now. If you wouldn't mind carrying on the conversation with me at Nick.Poole@SparkFun.com we'll continue to troubleshoot and hopefully get you some working units soon!