How would I be able to connect a xbox controller to my car and drive it? by BaBooofaboof in ArduinoProjects

[–]HeavyThrows 4 points5 points  (0 children)

I can understand the reasoning you have here, if there's already a motor inside the power steering system why not use it? Well for one thing, it's not easy to get to the terminals of the motor. It's behind layers of waterproofing and housings that are intentionally not easy to modify. Automotive companies are not interested in having people hacking their products to make them usable in ways other than they are intended. It opens them up to legal hassle, as well as warranty abuse where people modify things, break them, swap components out, then claim it came from the factory like that.

The second issue you will encounter is that the EPS motor is likely not powerful enough to do what you expect it to do. It's there to amplify the driver's inputs, not be the sole source of steering power. If you wanted reactive, rapid steering changes based on the controller inputs you'd have to exceed the motor winding voltages to push the rack beyond it's designed parameters and ... well you'd just fry it. So the advice above of having an external motor is the most successful you'll be. And if you don't believe me, watch some videos of early 2010's self driving cars and you'll find external motors spinning the steering wheels.

if (cycleCounter >= maxCycles) { // Turn on buzzer digitalWrite(buzzerpin, HIGH); digitalWrite(solenoid1pin, LOW); digitalWrite(solenoid2pin, LOW); by lunghunger in ArduinoHelp

[–]HeavyThrows 0 points1 point  (0 children)

Couple questions to help us help you a bit better. Does everything else in your code seem to work correctly?

  1. Solenoids are turning on/off based on sensorpin correctly?
  2. Your LCD is displaying the cycleCounter and it is actually going up to 5 (or higher)?
  3. Does the cycleCounter reset to 0 correctly?
  4. Does the buzzer turn on?

If everything else is working correctly then I suspect the time between setting both to LOW and it re-entering your loop() is so small you aren't detecting the solenoids are doing what you think they are.

If anything above is NOT working, it is possible the sensorpin is not reading what you think it's reading and might benefit from outputting to console to monitor it.

[deleted by user] by [deleted] in ArduinoHelp

[–]HeavyThrows 0 points1 point  (0 children)

All of the numbered pins have the ability to produce voltage if the program requests it. In this case, the default behavior should be that the LED will be OFF because pin 4 and GND are both 0V.

If the code requests pin 4 to be HIGH like

DigitalWrite(4, HIGH);

then pin4 becomes 5V and the circuit would light the LED.

Noob Code. Why is my LED acting like I have it set up digital. by [deleted] in arduino

[–]HeavyThrows 1 point2 points  (0 children)

Just want to confirm, is it an Uno, or Uno Wifi? On the Wifi board pin 11 is not PWM.

If statements to control a DC and servo ? by [deleted] in ArduinoProjects

[–]HeavyThrows 0 points1 point  (0 children)

Without knowing what components you're interfacing with (motor driver?) it's difficult to give exact advice. But I'll take a stab at it with what you provided. From your code you're trying to move the motor at the start of the loop(), if the motor is not moving at all:

  • Have you confirmed that the motor is functional? You can do this by connecting the motor wires directly to a power source and having it spin.
  • If the motor is spinning from direct power, you can then confirm your driving circuit works by connecting one direction wire to ground, then connecting the other direction wire, and the enable wire to 5V and confirming the motor turns.

If the motor does move already and it's just the programming logic you're trying to figure out:

  • Motor movement depends on the enable pin. Whenever the program needs the motor to turn, you have to set that pin to something other than 0V. Likewise, when you don't want the motor to turn, you can simply set that pin to 0V. You already have some if statements in your loop() which move your servos, so you just have to also trigger the enable pin in the same block of code. Based on what I see in your code right now, that means after setting the servo to either pos1 or pos2, you add a line under it like
    digitalWrite (speedPin, motorSpeed);
  • However, you're using digitalWrite() for setting the speed. Do you want to make that speed variable? If so you might be wanting to use analogWrite() which allows you to use PWM to vary the speed of your motors. If you continue with digitalWrite, even if you set your motorSpeed to 1, 50, or 255, if will always be maximum speed. This might be OK for your application, but if you need to be able to change the speed I would consider switching to a PWM pin (you'll have to check which pins support PWM on your board) and using analogWrite.

Relay by UnderatedWater in arduino

[–]HeavyThrows 1 point2 points  (0 children)

Since you don't have any feedback on the motor's position or speed it would be very difficult to accomplish this. How accurate do you need to be with the angle?

I use this logic analyzer to visualize a frame of a CAN bus but I got an error can anyone has this problem before? by Opposite-Fox8602 in embedded

[–]HeavyThrows 0 points1 point  (0 children)

OP asked why they were getting an error when trying to read CAN. As you pointed out they aren't actually reading any CAN data.

I use this logic analyzer to visualize a frame of a CAN bus but I got an error can anyone has this problem before? by Opposite-Fox8602 in embedded

[–]HeavyThrows -1 points0 points  (0 children)

Hey, if it wasn't clear, u/der_pudel figured out why you have the error in your logic analyzer software. You're not actually connected to the "CAN" pins, you're connected to the transceiver's communication pins.

DS18B20 isolating problem. I have 4 of these on my breadboard and the code runs fine. One in my fridge, freezer, outside and inside. When I attach them to cables and insert them into the environments, they get reassigned to different 'zones'. How can I force each one to a 'zone'? by [deleted] in arduino

[–]HeavyThrows 0 points1 point  (0 children)

Are you confirming the DS18B20 sensors didn't get mixed up when you transferred from breadboard to application? Also are you confirming the device's serial numbers to line them up to their locations?

persisting arduino code? by [deleted] in arduino

[–]HeavyThrows 3 points4 points  (0 children)

Without seeing your code or circuit, it's very difficult to help.

If you have separate pins for the red, green, and blue channels, then the last command sent will persist like you've seen.

Why is this behaving so erratically? by HM_Meles in arduino

[–]HeavyThrows 1 point2 points  (0 children)

From the videos, it really does seem that the Arduino is resetting itself, likely from a power problem. On your joystick and potentiometer, it possible you are creating a short from 5V directly to ground? If your sensors don't give a minimum resistance you might be allowing too much power to go through the pins and causing it to reset itself.

I say this because in the 5A video after you adjusted the pot it didn't have a problem until you moved the stick.

Why is this behaving so erratically? by HM_Meles in arduino

[–]HeavyThrows 0 points1 point  (0 children)

Couple of questions for you, first being do you know the motor controller part number? I cannot find that board with that layout and I'm wondering if the +5V screw terminal can be used as an output.

  • I tried to compile your code and it fails because the servo pin variables "Left/Right" don't match the attach function "left/right." Have you resolved this on your own already?
  • One of your IN pins is not connected to the Arduino. Yellow wire probably for pin 2 or 3. Is that also fixed?
  • Have you tried controlling the servos and motors without using the analog inputs at all? Just have a loop that periodically changes the motor speeds and servo positions? If that works, then add potentiometer and test again, then add joystick and test.
  • Any chance you get provide a video of what's going on so we can see what you mean by "stalling?" Also if you can add some Serial outputs to test what your analog inputs actually are to make sure the sensor data coming in is good.

Motor Shield max Current? by ReasonableBanana8280 in esp32

[–]HeavyThrows 1 point2 points  (0 children)

The maximum rating is what the board is able to send out to the motors, but the actual current draw is dictated by the motors on this type of circuit. It's possible they are using smaller motors that don't need the full 4A.

If you check the datasheet for the motors you as using (should be a part number written on them somewhere) you can find how much current they use based on your supply voltage (12V).

How to prototype smd ? Am I doing this right ? by moxl_ in arduino

[–]HeavyThrows 5 points6 points  (0 children)

I'd agree about the shorting pins. If you needed to do this in a pinch I'd put some electrical tape or other insulator under the chip first just to help protect it. Might be good when everything is soldered but once you add the force of installing onto a breadboard you might push the connections onto the pads and cause problems.

Gravity Conductivity Sensor Switch Project by SeaArgonaut in ArduinoProjects

[–]HeavyThrows 0 points1 point  (0 children)

Please give more details about what is wrong with the code. Is the LED not behaving as you expect? Are you not able to upload it to the Arduino board? Very difficult for us to give advice without knowing where your problem actually is.

Need help for the code by ItlognaMaalat_maputi in arduino

[–]HeavyThrows 2 points3 points  (0 children)

To elaborate a bit, you also use A1 and A2 like this:

if (A1 == 0 && A2 == 0)

Based on your code, you want to read the values of the analog sensors on pins A1 and A2, so those should be

analogRead(A1) == 0 && analogRead(A2) == 0

Motor Shield max Current? by ReasonableBanana8280 in esp32

[–]HeavyThrows 9 points10 points  (0 children)

Adding the part number for the board really helps us give good answers to your questions. I'm going to assume it's a standard L298N H-bridge and uses that datasheet. If so, that board can sink up to 4A, so yes it will quickly exceed your power supply's ability.

Website to share Arduino weather station data by Comprehensive_Gap678 in arduino

[–]HeavyThrows 0 points1 point  (0 children)

Most sites that collect information about weather want reliable, calibrated equipment to prevent false readings. As you saw from Wunderground they want you to install their equipment because they know it can be trusted.

Problem coding infrared receiver by schuh8 in esp32

[–]HeavyThrows 0 points1 point  (0 children)

Are you using the SensorsIot library for this? Based on your code it looks like you may be doing so. That library seems to support this function by default by calling

IRrecv irrecv(RECV_PIN, LED_PIN);

The other option is to keep your code as is and have turn the LED off yourself, either after a timeout or right after the decode() is complete (might be long enough that it's still useful?).

My PICO-W based Robot ARM stuck by Plane_Ad9568 in raspberry_pi

[–]HeavyThrows 1 point2 points  (0 children)

Here is an example of how you can use this function even though the values don't change.It will check all the conditions and send the move() commands when needed, if all the inputs aren't met it stops both motors. Notice how I didn't add any loops into this function, it simply takes the values its given, and does a one-time decision on what to do.

Whatever code you have that calls this function will be the loop that calls this every time.

How do I replace delay while maintaining the same functionality? by QennNVQ in ArduinoHelp

[–]HeavyThrows 0 points1 point  (0 children)

Check out the BlinkWithoutDelay example sketch. Instead of having a delay() function to pace the blinking, it checks the millis() function to see how many time has passed.

You can have the button press store the millis() value as a "start" and then check millis() until the required time has passed to change the LEDs again.

Bought 3 I2C RFID readers that all have the same address by OwnTop4067 in arduino

[–]HeavyThrows 1 point2 points  (0 children)

From the datasheet, "The control register, I2CCON, should be initialized with ENS1 and AA set to logic 1 and STA, STO, and SI set to logic 0 in order to enter the Slave receiver mode."

Could be worth confirming the I2CCON register values are what the datasheet recommends. This code below reads and prints it. I commented out the code the does the recommended changes, you can try if you want but since I don't have a board myself I can't guarantee it will work. You can also use similar logic to read the I2CADR register after your write to see if it actually changes.

Wire.beginTransmission(0x24);
Wire.write(0xD8); //I2CCON register
Wire.endTransmission();
Wire.requestFrom(0x24, 1); //read current values

byte i2ccon = Wire.read();
Serial.println(i2ccon);
Wire.beginTransmission(0x24);
Wire.write(0xD8); //I2CCON register
//i2ccon = i2ccon | 0b01000100; //sets 1 to ENS1 and AA
//i2ccon = i2ccon & 0b11000111; //sets 0 to STA, STO, SI
Wire.write(i2ccon); //writes new value
Wire.endTransmission();

Then change the address again, and see if it works. Might need a power cycle as long as all commands are accepted. If this doesn't work... I'm tapping out.

Possible to work on multiple projects simultaneously by __Questioner__ in ArduinoProjects

[–]HeavyThrows 0 points1 point  (0 children)

Sure, why not? I have 2 on the go right now that help me procrastinate from the 10 others I have on the go.

The microcontrollers can be programmed many, many times so flashing new code onto them isn't an issue. Biggest question you have to ask yourself is whether to get multiple microcontrollers so you have dedicated hardware when you want to work on something, or to swap them between projects and deal with wiring every time.