Recent Posts

Pages: [1] 2 3 ... 10
1
From chapter 17 in the 328p datasheet:

"The External Interrupts are triggered by the INT pins or any of the PCINT pins. Observe that, if enabled,
the interrupts will trigger even if the INT or PCINT pins are configured as outputs."

As long as the interrupts are enabled, a change will cause it to trigger. Changing from INPUT to OUTPUT will NOT disable the interrupt. To disable a PCINT you must do so on a pin-by-pin basis or the entire port.

I usually define two macros,

#define pcintX_on   PORTn |= 1 << pcintX
#define pcintX_off  PORTn &= ~(1 << pcintX)

which you can call whenever.
2
I was trying to make this Arduino project where I would control a toy car using an app made with MIT App inventor via Bluetooth. I referred to the website- https://howtomechatronics.com/tutorials/arduino/arduino-robot-car-wireless-control-using-hc-05-bluetooth-nrf24l01-and-hc-12-transceiver-modules (blocks, and source code is there in the website)

The circuit, code all looks fine to me. The app consists of a joystick, I move the joystick and based on the x and y value of the joystick, I the car moves in that direction.

The PROBLEM is that when I move the joystick, the app crashes that is, it freezes and gives the following error- "Error 516:Unable to write:Broken pipe". I have observed that the bluetooth module(HC-05) I'm using starts disconnecting everytime I connect it, hence "broken pipe".

So, I would like to know is there any solution to fix it, if yes then please let me know it.

Thank You!
3
General Electronics / Re: Looking for 3.3V 16x2 I2C ...
Last post by DrAzzy - Today at 06:30 am
I just did some testing - you're right, the 5v screens don't *quiiite* work at 3.3. You can read them at max contrast, but just barely.
4
Microcontrollers / Re: Which chip is this: "ATmeg...
Last post by westfw - Today at 06:28 am
Code: [Select]
avrdude: stk500_recv(): programmer is not responding

The error you are getting is from BEFORE the chip type is checked, so there is probably some error in the way you have loaded the "Arduino as ISP" sketch into your "programmer" Arduino.
try following This Tutorial instead; it's generally better written, more recent, and more correct than the arduino.cc tutorial (which still doesn't mention bypass capacitors, despite YEARS worth of comments that they should be added.  Sigh.)
5
Hi All,

Racking my brain as to why this is no longer working. I can't seem to get the switch to read from my joystick. X and Y work without issue and Switched used to work.

Using these:

5V Dual-axis XY Thumb Game Joystick Module PS2 Rocker for Arduino KY-023

I have tried:

Different switches
Different boards (uno and nano)
Stripping code back to basic purely to test the input.
Tried different wiring (physical)
Different digital pin for switch read

The serial monitor simply shows Switch: 0

I have no resistors etc going from the joystick to the UNO, ie direct connections.

At the moment only the joystick is connected to the Arduino as below:

Digital pin 2 - Joystick switch
GND and 5v
X - A0
Y - A1


Any ideas?

Thank ytou


Code: [Select]
#include <FastLED.h>

// Arduino INPUT PINs
const int SW_pin_in = 2; // digital pin Input from Joystick Switch output (D2)
const int Jaw_pin_out = 5; // INPUTY DOWN (1023) LED Signal Out Digital Pin for JAW HORNS - end connects to positive LED


// FASTLED PIN OUTPUT
  #define LED_PIN     6 // DIGITAL PIN this goes from Digital pin 6 to the input DIN on the LED Strip / controller (ie note ground or power, the other one
  #define COLOR_ORDER GRB
  #define CHIPSET     WS2811
  #define NUM_LEDS    3
  #define BRIGHTNESS  255
  #define FRAMES_PER_SECOND 30


bool gReverseDirection = false;

CRGB leds[NUM_LEDS];

CRGBPalette16 gPal;

void setup() {

// FASTLED

  FastLED.addLeds<CHIPSET, LED_PIN, COLOR_ORDER>(leds, NUM_LEDS).setCorrection( TypicalLEDStrip );
  FastLED.setBrightness( BRIGHTNESS );

 
 // Set initial pin values
 
  pinMode(SW_pin_in, INPUT);
  digitalWrite(Jaw_pin_out, OUTPUT);
  digitalWrite(Jaw_pin_out, LOW);
  Serial.begin(115200);

}


void loop() {
 
//  Serial monitoring for troubleshooting
  Serial.print("Switch:  ");
  Serial.print(digitalRead(SW_pin_in));
  Serial.print("\n");
  delay(1000);

 


}
6
General Electronics / Re: Battery for solar panel
Last post by ChrisTenone - Today at 06:25 am
Your panel is too small.
200 watts is nearer the mark.
Running the pump 24/7 needs 360 wh per day which will require 3.6 sun hours a day over the year.
Unless you live somewhere near the equator and have no cloudy days, your system will fail in winter.
You will also need a MPPT based charger to get all you can out of the solar panel.

Is this the case? I've been using a MPPT (Sparkfun's Sunny Buddy - which then supplied an Adafruit LiPo backpack for a Trinket Pro) and I recently discovered that going directly from the solar panel to the battery charger work better (faster, more consistent charging) than using the MPPT board.

But then I live in Arizona, where we have 3.6 sun hours per day several times over, in the shade. Why this state isn't the major proponent of solar power, I do not know.
7
Project Guidance / Re: Greenhouse Fan control wit...
Last post by wzaggle - Today at 06:24 am
I am sure your fan speed is not linear to the range 0-255.  For example it might not even spin at all until you get to 200.  You could find that starting number and try using that instead of 0.  Then turn it off if less than 24. 

Without knowing the actual response curve of your fan, I would probably manually find about 5 good speeds (if you can) from just moving, to full speed and write down those numbers.  Use nested if statements, or a simple switch/case to set the fan speed with PWM based on temp range or build an index into a small array.  If your temp (T) is >=24 and <25 you can build an index using something like speed = ((T*5)-120) to get a number from 0-4.  So 24deg would be index 0 (just moving), 24.2 would go to index 1 (moving a little faster), and eventually 24.8 would return an index of 4 (full speed).

Good luck...
8
General Electronics / Re: Battery for solar panel
Last post by Wawa - Today at 06:24 am
Solar is unreliable power. Don't exect that you can run that pump 24/7 from a 100watt panel.

A 12volt/15watt pump draws 1.25Amp from a 12volt battery.
That's 1.25*24= 30Ah per day/night.
A deep-cycle battery shouldn't be drained below 50-60% charge if you want it to last more than a year,
so you need at least a 100Ah deep-cycle battery to bridge one day/night.
12volt/100Ah is about twice the size of an average car battery.
Don't be tempted to use a common car battery, unless you don't mind replacing it twice a year.
Rule of dumbs is that you should be able to top up the battery to 100% in four hours with a panel.
That's a panel that can deliver 10Amp during peak sunshine, or 180watt (assuming low battery efficiency and dumb controller).
So the panel must be able to deliver 180watt during rainy days.
100watt panel???
Leo..

9
Ah come on Chris. A bit of continental courtesy?? (I'm Canadian by the way, so we do both.)
10
Where does "Up" come from?

BTW if you need to attach a file that Arduino won't 'allow', copy the contents to a .txt file.
Pages: [1] 2 3 ... 10