#help-with-arduino

1 messages · Page 73 of 1

hollow prairie
#

oop that word is not allowed

#

alright, was hoping there was an other way..

#

so there is no way to convert a male to male wire into a male to female wire?

north stream
#

The other way is easier, but if you have any female to female wires, you can put them end to end. You can also just replace the internal wires, but it's tricky and you have to have the properly terminated wires available. https://www.adafruit.com/product/3633

lone ferry
#

I've got some male jumper wires here. It looks like it's possible to snip off the pin and then stick another pin inside it. The pin isn't really a pin but it's bent, and the gap between the two sides becomes larger the closer the pin is to the wire.

hollow prairie
#

I don't have any female to female no, then I think it's better to buy a female to male or female to female pack

#

@lone ferry Yeah I tried that too, was experimenting with it for a bit but I couldn't manage to do it

lone ferry
#

For temporary solutions, a crocodile clip wire can work. 🙂

reef ravine
#

@sweet sleet It was 2am local when you came back on. As IoTPanic was saying you can't use the hardware serial to talk to the "green board" (those pins are used by PC<>Node comms and are fixed). See the image here, https://forum.arduino.cc/index.php?topic=605324.msg4108046#msg4108046, you will use the hardware serial for USB to the PC (GPIO 1 & 3) and setup a "software serial" (GPIO 4 & 5) for comms thru the levelshifter to the green board. The diagram isn't exactly what you are doing but it illustrates the idea. All is not lost, it'll just take some more coding to setup the second serial port. Welcome to software debugging 😉

sweet sleet
#

#include <SoftwareSerial.h>

reef ravine
#

@sweet sleet You need ESP8266 SoftwareSerial, not the standard Arduino one, chores to do, be on and off today...

wanton forum
#

Silly question, but what language does the Arduino use?

stuck coral
#

It uses what they call wiring, which is C++ with a framework

wanton forum
#

Ok then

sweet sleet
#

"You don't need level shifters because, even if the ESP8266 runs at 3.3V, its IO ports are 5V tolerant."

#

"In case you decide to transmit binary data please also consider the two devices use a different architecture: Arduino is 8bit, ESP8266 is 32bit, meaning they have different word size (the minimum allocation unit size)."

#

hmmm. i am sending binary

sweet sleet
#

i'm a bit discouraged at the moment

safe shell
#

I wouldn't use 5v on any ESP8266 input pins unless the board specifically has level shifters on RX. Data sheet says max is VDD + 0.3v (VDD typ. 3.3v, max 3.6v).

#

It might work, but risky at best.

sweet sleet
#

i am now shifting rx and tx

#

although i may be using the wrong pins

#

😦

#

i need help with the software now i believe. anyone willing to look at this with me?

#

i need to figure out how to communicate with this PIC board

#

and what i should expect from it.

north stream
#

Did your USB-serial device ever show up?

sweet sleet
#

Well i see nothing on the monitor

#

So no :/

#

but my logic analyzer did show that i was using the correct TX/RX pins

#

from the nodemcu

#

i am thinking that my 'serial write' command is wrong

obtuse spruce
#

Woot! Ordered huge pile of bit from Adafruit: more M4s, DACs, OLED displays.... more project supplies!

stuck coral
#

@obtuse spruce nice! @sweet sleet youre sending 7 bits not 8

#

Binary is from right to left, so your value is shifted

obtuse spruce
#

@sweet sleet - write(1110011) does not do what you think! What you want is write(0b1110011)

stuck coral
#

And that, yes 😜

sweet sleet
#

😯

stuck coral
#

write(1110011) sends the number 1110011, while 0b1110011 is a binary representation

sweet sleet
#

do i need to set a debug port?

#

and right now i'm testing this on the d1 main controller not the esp with the level shifter

stone dirge
#
#

I am using these parts for the build

stuck coral
#

Looks good, are you building this on a breadboard @stone dirge? And from what I have seen, many people use Wake on LAN which most computers have but I see what you're doing that that will work aswell

stone dirge
#

I am using a solderless breadboard for testing and soldering breadboard for final product

stuck coral
#

Got it, yeah it should work, Ive seen this exact setup just not with Adafruit IO, which that should work fine

stone dirge
#

The problem I am having is that when I have the optocouple connected to the GPIO 0 pin, there is no wifi signal (i.e. the blue signal led does not flash, and the emitter/collector does not switch on)

#

any thoughts on why this is?

#

Ive tested the circuit with a simple led and it works fine

stuck coral
stone dirge
#

but when I connect the pc817 it stops working

#

what do you mean?

stuck coral
#

Try another GPIO, and read the link I sent, IO0 is for programming

stone dirge
#

ok let me try that

#

I will try with the gpio 2

stuck coral
#

From what I see, that needs to be pulled up too, might want to use 15

stone dirge
#

which pin is 15? lol

#

Late preface: I am new to arduinos and coding

#

I am using esp-01

stuck coral
sweet sleet
#

I'm thinking I will get a pro mini running at 5v since the person who made these PICs has used them and has told me it works

stone dirge
#

@stuck coral ok thank you for your help, I will read up on what you showed me rn

stuck coral
#

@stone dirge no problem, feel free to come back if you need more help

stone dirge
#

will do, I will let you know if i figure it out

#

quick question, should i be powering the esp-01 with 3.3v or 5v?

stuck coral
#

3.3V

stone dirge
#

ok cool

#

Correct me if I am wrong, but it looks like the esp8266-01 doesn't have a pin gpio 15

stuck coral
#

Ah yes, I never use ESP01s. You have 0, 1, 2, and 3. Could use IO3, but be warned on boot it will output a high signal for a moment

stone dirge
#

I see

#

hmm

sweet sleet
#

how do i not get sparked or shocked by touching the board when plugging in lol

stone dirge
#

rubber gloves... lol jk I have no idea

stuck coral
#

Idk what you're really asking @sweet sleet which board

sweet sleet
#

my esp

#

also is there a specific order in which to plug in wires

stuck coral
#

Well its not high voltage AC that can travel through your body

sweet sleet
#

i cannot seem to flash it when it's plugged in

stuck coral
#

Yeah, I tried telling you you wouldnt be able to earlier

sweet sleet
#

unplug every time

stuck coral
#

The way you have it wired, yes

sweet sleet
#

should i always plug in ground first

stuck coral
#

Eh, just plug power in last, doesnt matter too much

sweet sleet
#

if i plug power in first is that bad

stuck coral
#

Not really, just in general its good to do power last because there are cases where that is a yes

#

Good habit to have

sweet sleet
#

this is the board my friend used that apparently he was successful with

stuck coral
#

I am aware of the board, but from what I see the hardware isnt the issue

sweet sleet
#

he buys these because it is cheap, have native usb onboard and plug right into a breadboard

#

:/

stuck coral
#

Yeah but its a old ATMEGA32 and Im not a fan, you can use it if you'd like, but your current board will work if you use it right

sweet sleet
#

it'll take a month to get here

#

so i'd definitely prefer to just use my current hardware

stuck coral
#

Okay, first thing you need to do is create a software serial port, and connect the green board you have to it

#

Then you can put code on the ESP and either control it with the ESP, or have it bridge the serial the USB is using with the software serial

#

This is what me and I think madbodger were saying last night

sweet sleet
#

okay i'll try my best

stone dirge
#

@stuck coral if i am using gpio 3, should i change my code?

    Serial.println("HIGH");
  else
    Serial.println("LOW");``` 
should i swap the highs and lows?
stuck coral
#

Nope

#

Might want to add in setup bringing the line though just for a good known state

stone dirge
#

... if you have a sec, would you explain that or give me an example lol

cunning reef
#

Hey, I have a question: do my components have lead solder on them? I was wondering if it was zinc or lead, and I've heard it's been banned, but I just wanted to check.

stuck coral
#

@stone dirge within setup(), after you use pinMode(PIN_NAME, OUTPUT); add in a digitalWrite(PIN_NAME, LOW);

stone dirge
#

ok i see thank you

stuck coral
#

@cunning reef you will need to give us more info on that one

cunning reef
#

Okay, I have an Arduino Mega2560 (not Arduino brand) that I recently got for my birthday

stuck coral
#

And idk what you mean by being banned, I dont know anywhere were leaded solder is banned

sweet sleet
stuck coral
#

If its a china knock off it probably has leaded solder, just done melt it and lick it

#

@sweet sleet you also need your hardware serial port to be in there

cunning reef
#

Yeah, I think it's a China knock-off. It's from a brand called "Agoal"

sweet sleet
#

how's that?

stuck coral
#

Good, I always include a message at the start though just to make sure everything booted right, like Serial.println(" === Booting ==="); or something

sweet sleet
stuck coral
#

Yeah, there you go, I would after you send any command, use the following which will print the output of the green board to your hardware serial-

if (s.available()) {     // If anything comes in Serial1 (pins 0 & 1)
    Serial.write(s.read());   // read it and send it out Serial (USB)
}

And that would assume you dont want USB, and you have the logic converter

#

I think ed told you its still a good idea to include the converter

sweet sleet
#

i'm now getting gibberish in the serial monitor

#

when i boot

cunning reef
#

The RoHS compliance guide says that any amount of lead over 1000 ppm is illegal.

stuck coral
#

Yes, I explained to you that the ESP outputs serial at 115200 when you boot @sweet sleet

sweet sleet
#

i'm really trying to understand so i'm sorry. but which is pin 0 and 1? i still have tx as gpio1 and rx as gpio3

#

got it.

stuck coral
#

Try changing the serial speed in the monitor to 115200 and the hardware serial speed to 115200, you can leave the software serial as 9600.

sweet sleet
#

i don't see the == booting == text

stuck coral
#

The RoHS compliance guide says that any amount of lead over 1000 ppm is illegal.
@cunning reef where does it say illigal, RoHS is a compliance not a law

sweet sleet
stuck coral
#

Did you change the serial speed in the code to match?

sweet sleet
#

oops

bold island
#

hey there, i have a noob question, what is the correct syntax to pass a for loop variable in this example?

for (int i=0; i<5; i++){
float voltage = pzem[i].voltage(); client.publish("/topic/pzem[i]",String(voltage).c_str());
}

in mqtt explorer i can see it created topic called /topic/pzem[i] instead of /topic/pzem1 - /topic/pzem5
thanx for suggestions

sweet sleet
stuck coral
#

Press the reset button, with the monitor still up @sweet sleet what do you see then?

sweet sleet
#

gibberish

#

"s$�$ܞ⸮⸮l⸮|⸮$⸮p⸮r⸮⸮⸮s⸮B⸮b⸮⸮Nn⸮�lNn⸮⸮⸮"p⸮⸮#d rdp⸮N⸮⸮l⸮⸮"o⸮|⸮⸮⸮b⸮|⸮N⸮l⸮⸮l⸮no$Nr⸮⸮⸮ocd {⸮⸮⸮"l`⸮"⸮⸮d⸮l{⸮ ⸮⸮N⸮���"

stuck coral
#

@bold island because you have in the function call to post to the topic "/topic/pzem[i]",

#

Hm, what if you unplug the logic converter @sweet sleet ?

#

And which pins are you using for software serial?

bold island
#

@stuck coral yes i know the quotes is the issue, but dont know hot to use variable in topic for client publish

stone dirge
#

lol I was gonna ask you another question, but it seems you have your hands full. I'll ask later

stuck coral
#

The quotes isnt an issue, you are defining a string

#

You are misunderstanding C as a language

sweet sleet
#

@stuck coral i didn't even have it plugged in to anything. just the usb to nodemcu

bold island
#

@stuck coral yes i am beginner with C

stuck coral
#

@sweet sleet you defined the software serial on the hardware pins? That is probably the issue

sweet sleet
#

i think gpio1 and gpio3 are the hardware pins

#

so you are saying i need to define it as other ones.

#

like gpio5 and gpio4 or something

stuck coral
#

Correct, you want to create two serial ports, one in hardware going to USB, and another to your other board

#

That will let you populate a number into a string in a formatted mannor

bold island
#

@stuck coral thanx let me see...

granite sequoia
#

anyone on who can help me getting two CD Drive stepper motors working on an UNO with a HW-130 shield using Universal G-Code Sender?

sweet sleet
#

note to self to make these the serial ports (gpio15 - rx & gpio13 - tx)

stuck coral
#

I wouldnt use 15, it will fail boot if pulled high, try 12

sweet sleet
#

oof

stuck coral
north stream
#

@granite sequoia That's an oddly specific request. I'm unfamiliar with the HW-130 shield and G-Code sender (strange combination, seems like). Do you mean the spindle motor or the head positioning motor?

granite sequoia
north stream
#

Ah, the AdaFruit Motor Shield. That's easier for me to recognize than HW-130.

granite sequoia
#

That's the shield. its an uno shield that will work with 5v bipolar stepper motors

sweet sleet
#

how do i know what software serial pin # goes to what pin

#

is it indexed?

stuck coral
#

Well you configure in code which is which, hence software serial

sweet sleet
#

but say i chose SoftwareSerial s(9,8);

#

what pin is 9 and what pin is 8

stuck coral
sweet sleet
stuck coral
#

Wow, I struggled with that copy paste

sweet sleet
#

lol

stuck coral
#

Read the link I just sent, you will find the answer

sweet sleet
#

okay reading it

north stream
#

The SoftwareSerial constructor takes the receive pin first, and the transmit pin second (in case that was what you were asking)

stuck coral
#

I was trying to help show him how to find the answer himself but thank you @north stream 😜

sweet sleet
#

my question is say my rxPin= 2

#

what pin is that referring to on the pinout board

#

gpio1?

#

3 = gpio3?

stuck coral
#

If you dont see a 2, it is not exposed on your board

#

2 is used for programming anyways

#

You dont want to use it

sweet sleet
#

for example if i want to use gpio12 as tx. is that "6"?

stuck coral
#

No, its 12

sweet sleet
#

gpio13 = 13?

stuck coral
#

6 would be a good choice though

#

Right

sweet sleet
#

ooohhh ok

#

so i will do SoftwareSerial mySerial(13, 12);

#

and my software rx = gpio13, software tx = gpio12

stone dirge
#

@stuck coral not that it seems a little quieter, could i ask you another question?

stuck coral
#

Sure

stone dirge
#

So I have my optocouple now using pin 3 on the esp-01, but as soon as I power the whole setup, the pin pulls high and stays high. Even after adding digitalWrite(LED_PIN, LOW); to my setup

#

am i doing something wrong?

stuck coral
#

Do you set the pin as an output first?

stone dirge
#

not likely, as i don't know what that means nor how to do it

#

yes this is the code ```void setup() {

pinMode(LED_PIN, OUTPUT);
digitalWrite(LED_PIN, LOW);```

stuck coral
#

Okay, you said you were using a breadboard?

stone dirge
#

yes

stuck coral
#

How are you fitting the ESP02 on that?

stone dirge
stuck coral
#

Got it, are you testing if its high or low with a multimeter?

stone dirge
#

no, i have an led connected to the other side of the optocoupler

stuck coral
#

Oh, do you have a multimeter?

stone dirge
#

yes

stuck coral
#

Would you mind removing the wire to the optocoupler, and testing the IO line with a multimeter?

#

We also dont know if its booting, if you attach a wire that prevents it from booting it will stay high

stone dirge
#

its high

stuck coral
#

Okay, does it stay if you remove all lines but GND and power?

stone dirge
#

do you mean does the pin 3 still stay high when i remove all cables but vcc and gnd?

stuck coral
#

Yes

sweet sleet
#

rl�d⸮⸮⸮⸮l⸮|⸮⸮d⸮c|⸮⸮⸮⸮r⸮c⸮b⸮Nn⸮�dNn⸮⸮⸮cp⸮cl rdp⸮n⸮⸮l⸮⸮⸮bN⸮o⸮$⸮⸮⸮bŒ⸮Nn⸮$⸮⸮�d ⸮noln{⸮⸮⸮ocd r⸮⸮oc$⸮"⸮⸮$⸮lr⸮`⸮⸮o⸮ === Booting ===
hi
hi

#

this is on 115200 baud

stuck coral
#

There you go @sweet sleet ! I guess the debug info on boot isnt 115200 for the 8266, it is for the ESP32

sweet sleet
#

so nothing's coming in on the rx software serial pins

stuck coral
#

Are you sending a command via software serial?

sweet sleet
#

yes

stuck coral
#

Code?

sweet sleet
stone dirge
#

so the only other cable connected was the ch_pd, after disconnecting that, the gpio 3 did not pull high anymore

stuck coral
#

The s.Write() is still only seven bits, not eight so its shifted @sweet sleet its not the command you want to send

#

@stone dirge that means it wasnt able to boot because you were using a pin used for uploading. Those ESP01s are... somethin

stone dirge
#

So I shouldn't use gpio 3?

sweet sleet
#

do i have to hold flash when flashing

stuck coral
#

@stone dirge what are you using 3 for? Im having a hard time remembering if that was the opto pin

#

@sweet sleet might have to press it

stone dirge
#

You suggested pin 15, but the esp01 doesn't have that, so you said pin 3 might work.

stuck coral
#

Ah yes, no its a different pin causing the issue, what other pins were you using?

sweet sleet
#

@stuck coral i'm getting random 's' now printed

stone dirge
#

The pins i was using was vcc, gnc, ch_pd

sweet sleet
#

looks like i dont have to unplug anymore!

#

to flash

stuck coral
#

Correct, since you now no longer have a serial connection with three devices on it

sweet sleet
#

i changed 'hi' to '****'

#

stars

stuck coral
#

Than the s is from the green board

sweet sleet
#

🇸

stuck coral
#

@stone dirge so you have VCC and GND going from the breadboard right? and For now you have 3 unconnected and now its going low right?

sweet sleet
#

@stuck coral sorry. i made a mistake and wrote to the hardware serial which is why the s was printing

#

it's gone now

stone dirge
#

@stuck coral yes

stuck coral
#

@stone dirge if you connect that to the opto, does it stay low?

stone dirge
#

Let me try after I eat dinner, I'll let you know

stuck coral
#

Sure thing

#

And same

stone dirge
#

yes it goes low, but weirdly enough, when i put my hand close to the circuit, the led turns on. when i move my hand away, it turns off lol

#

so confused

stuck coral
#

Part number for opto isolator?

stone dirge
#

pc817

#

specifically i think pc817c

stuck coral
#

Im not sure why your hand would be coupling to that circuit

stone dirge
#

it happens specifically when i get close to the ch_pd pin

#

that is unplugged

stuck coral
#

Oh you must have a floating reset pin

#

So when the ESP boots because of a reset the pin goes high

stone dirge
#

ah i see

#

that's... interesting

#

lol

#

and confusing

stuck coral
#

Connect the wire to that line to 3.3V

#

Does that fix it?

stone dirge
#

goes back to pulling high all the time

#

i forgot to mention

#

when i turn on my circuit from off without the opto inserted and then inserting it after the fact, everything works great

#

meaning my original setup, on pin 0

stuck coral
#

Yeah, youre having the stupid boot issues, I hate the ESP8266

stone dirge
#

everything is responsive

#

i see

#

yeah it seems really touchy

#

have you heard of anyway around having to unplug and plugging on boot?

stuck coral
#

Its because every pin on the ESP01 is a pin that does something for the boot process, I never recommend using ESP01s

stone dirge
#

yeah, that makes sense. I bought it before i did any research. going back, i wouldn't buy it again

#

that being said do you have a recommendation on a better wifi module?

stuck coral
#

The ESP32 is wayy better, it still has some pins that do this but on every ESP32 board I have seen most of the pins are exposed that are just general IO. I like to recommend the Adafruit ESP32 feather if you want WiFi

stone dirge
#

ok good to know

#

welp, unless you can think of anything else on the matter, thank you for the help.

stuck coral
#

You're welcome, could troubleshoot more but those modules are such a pain in my existence and if I used a ESP8266 IC I wouldnt have anything but the programming circuit connected to the pins you have available to you

sturdy bobcat
#

I'm replacing my ESP8266 HUZZAH breakouts with ESP32 HUZZAH breakouts.

#

Because, yah, ESP32 is a lot less trouble.

stone dirge
#

good to know, thanks

bold island
sweet sleet
#

@stuck coral

#

Showed My friend a pic and he says

#

Looks like the pic isn't powered, where's your external 5v supply? (the 5v pin on the module doesn't supply 5v unless you connect 5v externally)

#

So i guess i need to externally power

stuck coral
#

Correct, I told you that the first time we spoke

#

Did you never connect power to the green board @sweet sleet ?

#

@bold island You are using it incorrectly, you should use it like this - sprintf(topic, "pzem[%d]/voltage", i); within the for loop

#

Though I would like to note, it is smarter to use pzem/ID/voltage in MQTT so you can use wildcards easier

sweet sleet
#

🤦🏻‍♂️

#

What kind of power supply do i need to use?

stuck coral
#

5V, if the boards doesnt draw much you can connect the USB pin on that ESP to the 5V pin on the green board

#

Looks like on the nodeMCU USB is labeled Vin

bold island
#

@stuck coral its working thanx a lot for pointing me the right direction

sweet sleet
#

So vin to 5v?

#

Directly?

#

I dont need level shifter?

stuck coral
#

Yes, that is the power from the USB which is 5v, the level shifter shifts logic, is isnt for regulating voltage. But the 5V from the USB is what you want to feed into 5V in the green board so you dont need anything between them

sweet sleet
#

So instead of me currwntly using the 5v red wire

#

I will plug it directly from vin to where it is now on the green board

stuck coral
#

You still need that wire for the level shifter

sweet sleet
#

Hmmmmm

stuck coral
#

I see a second 5V pin on that green board, am I right?

sweet sleet
#

I think that’s for 5v out to the next green board

#

There are 3 green boards

#

Supposed to be like this

#

The 12v is for powering the mechanics of the display

stuck coral
#

Did you get rid of the level shifter?

sweet sleet
#

No I’m testing it now

#

Because the d1 controller wasnt working so I’m using the esp with the level shifter

#

But just plugging into one of them for testing

stuck coral
#

If you have only one, then connect that other 5V line to the Vin

#

The 5V lines will just be connected

#

Unless that is some really niche board with isolation but I doubt it.

#

Otherwise it would be marked

sweet sleet
#

Like this

#

I also have this

#

5v usb power supply

#

But then how do i read from the serial monitor?

#

Or is the computer usb 5v sufficient

stuck coral
#

Computer USB is probably OK, what does the green board do?

sweet sleet
#

they are counter displays

stuck coral
#

Oh very cool, do you know how much a digit draws for power?

sweet sleet
#

very little power

stuck coral
#

Just use the computers USB

sweet sleet
#

okay

stuck coral
#

If its less than 500mA you're fine

#

Try to use a blue USB port

#

USB 3

sweet sleet
#

ok cool. plugged it into usb 3

#

i'm still not getting any debug msgs

#

it should be powered now

#

the 12v i am ignoring on the green board

#

but i have the gnd plugged in thru the level shifter.

#

5v plugged in thru lvl shifter

#

and then another 5v directly from the esp vin

stuck coral
#

Oh okay, than that will draw very little nevermind I thought the coils were on 5V you can throw that on any USB. And correct, you are supplying power from the Feather to the board that you have from USB, 5v. Than you supply 3.3V on the low logic level side, so it knows what voltage to use on the 3.3V side. The 5V from the board than goes to the level shifter, so the level shifter knows what voltage to use on the 5V side. One both sides you have a ground, which are shorted together, so that the ground on the ESP is the same ground as on the level shifter, and the board. Than you have the RX and TX on their respected sides for communication at the voltages you fed on the LV/HV pins

sweet sleet
#

there should be a red light on the green board when it's powered sufficiently

#

so it seems it's just not

#

i may need a separate supply, but have the logic go thru this shifter?

#

sorry i could be wrong

stuck coral
#

Well you have your RX/TX for each on either side. And let me see how you wired it

sweet sleet
#

I added a ground

stuck coral
#

Nice, so that does not work?

sweet sleet
#

maybe it is a power issue...

#

maybe the rx pins don't work??

#

the maker of the board sent me that

#

(the 5v pin on the module doesn't supply 5v unless you connect 5v externally)

#

i don't know if he's being overly cautious

stuck coral
#

Yeah, he means you need to connect it to power, which you did, via the USB power

#

Do you have a multimeter?

sweet sleet
#

No. Should i get one?

stuck coral
#

If you plan with working with electronics more than this one time, yes

sweet sleet
#

Is this one ok

stuck coral
#

It will probably get the job done for a while, for that price dont be sticking it into wall sockets but itll work alright

sweet sleet
stuck coral
#

You get what you pay for with multimeters, and that second one is autoranging which is nice

sweet sleet
#

Ok I’ll go for that one

#

Does this perform a similar function to the oscilloscope?

pine bramble
#

Oscilloscope is a graphing instrument depicting signals that change with time.

sweet sleet
#

Oh i just realized i have a friend who is an electrician

#

He may have an oscilloscope

pine bramble
#

Electricians don't own oscilloscopes. ;)

sweet sleet
#

That’s what he just told me

#

Lol

pine bramble
#

haha.

#

They know more about electrical safety that electronic techs typically do.

#

I couldn't rewire the house without consulting one, and even then.

fallen canyon
#

iunno rewiring a house is fairly simple in compairison to microcontroller stuff... just make sure ya turn the breakers off first

sweet sleet
#

More power is more dangerous

#

Troubleshooting is so difficult for a noob

#

Thrown into a new world of confusion

#

Good community here though. Thanks for the help

sweet sleet
#

@stuck coral the light on the board is on! i think it's properly powered

austere valve
#

Hi, does anyone have an idea how to best diagnose a defective sensor? I've recently bought 4 Sensirion SHT31 and I cannot get them to work at all, despite not having any trouble with a SHT 20 in exactly the same shell. I've tried with different cables, used 2 different Arduino MKR 1010, 4 different ESP32-S2 Saola in any combination with the sensors but I've been continuously unable to produce a reading. Connecting the SHT 31 to the Arduino MKR actually prevents the board from being recognized by my PC, which leads me to suspect that the wiring might be faulty, but I have no idea how I would go about testing that without risking breaking the sensor or board.

sweet sleet
austere valve
sweet sleet
bold island
#

i am reading 2 values from 19 sensors and pushing to mqtt, but i dont know why messages count in mqtt explorer are not same, seems like not all messages delivered.
example: sensor 1 - 2013 messages, sensor2 - 1794; none of these values can be divided by 19, it starts to be off almost immediately. Anyone got idea what it can be ?

brazen dew
pine bramble
brazen dew
#

Unfortunately that's way above me as I don't know how to read schematics. Is there a way using the arduino software to just download what's on the trinket instead of uploading to the trinket?

pine bramble
#

You use SWD physical interface (similar to JTAG but only two wires) to talk to the target on a hardware level, bypassing the USB interface entirely.

#

Presumably, you can lift the binary image off the target's flashROM.

brazen dew
#

It should be noted that I'm using the Trinket Mini and not the M0

pine bramble
#

Even that doesn't quite generate the assembler source code, but it can give a window into what's happening.

#

I don't know the Trinket Mini, but I'm guessing it's AVR based.

brazen dew
pine bramble
#

I don't know anything about AVRs at this level. ;)

brazen dew
#

Well thanks for your help! I appreciate your time.

pine bramble
#

Atmel ATtiny85.

#

The question is: what is the JTAG/C2/SWD-work-alike interface to that chip. ;)

#

When a flashROM based microcontroller is made at the factory, it's uninitialized to any running code.

#

These electrical interfaces I mentioned are usually the first thing used to talk to a new chip off the assembly line.

#

Where I was going with this:
a) You saved the binary image to disk, and can find it again
b) That at least gives you something to compare with.

#

or,
c) You are willing to disassemble the binary image to learn from it.

#

objdump is used to map source code to a binary image.

#

It requires the source code, to make use of it.

brazen dew
#

Ok, well you definitely gave me some things to look into. I was hoping the answer was a quick "download this software and it will pull the source code off the chip".. as I'm not super technical, but this is a good project.

#

Thank you again for your help

pine bramble
#

You're welcome. For what it's worth:

#

I tend to store identifying marks in the binary image that allow me to identify that particular program version, uniquely.

brazen dew
#

Definitely a good idea.

pine bramble
#

I also sometimes physically store an inexpensive USB thumb drive, with all code and documentation, with the project.

#

Usually inside the case that holds it, if there's room.

brazen dew
#

I'm normally good at backing things up, and I had it backed up on a 2TB external drive.. but a crazy ex decided to throw it.. 😢

pine bramble
#

;) those crazy ex's.

brazen dew
#

The worst.. lol

pine bramble
#

github is a good tool here, also.

#

It's been reliable enough for me that I don't bother with the USB thumb drive, in practice, anymore.

#

The hard part: making a small change and failing to annotate it.

#

Also, I rely too much on my (human) memory/recollection, which is a bad habit. ;)

#

The J-Link EDU is the way to go, for first try at lifting code (binary only) off a target.

#

(also provides live debugging so it's a big win, the rare times a novice will try to use it)

#

Works on the majority of targets you'll work with.

#

Hardest part of that system is physically interconnecting to the pads on the target board, as they are rarely brought out to thru-hole connections on the edge of the target board.

Usually just pads in the middle of the board (usually the the back of the board, away from component side of the board).

#

The STM32F4x Discovery board (from st.com) is USD $20, has the same MCU family as the Adafruit equivalent.

#

It has an on-board ST-LINK program (separate MCU!) that will do these binary dumps in a pleasant user interface.

#

Nothing else to buy; USD $20, but (of course) it's an STM32 MCU.

#

I think you can bypass the ST-LINK and go for a DFU interface, as well, by setting jumpers on that board.

#

(also runs CircuitPython)

#

@austere valve @sweet sleet @bold island each asked questions in recent scrollback. ;)

brazen dew
#

I'll check these things out

pine bramble
#

Questions were wrt

a Sensirion SHT31 sensor not responding in MKR 1010 and ESP32-S2 environments,

Serial Monitor printing gibberish (SoftwareSerialConstructor),

and

2 values from 19 sensors pushed to MQTT, where messages sent and messages delivered (in count) were unequal.

#

In general, upload code and schematics and physical photographs of the implementations, to get better answers. I prefer github for code repositories, but some 'pastebin' type sites can be more convenient for quick questions, if there's no github repository yet.

#

Also basics like part numbers, software dev environment (Usually Arduino IDE, for this channel) and short, meaningful test results from experiments performed. ;)

#

Mention the communications protocol used, such as i2c and SPI if they apply.

#

https://git-scm.com/book/en/v2

Good git reference book.

Note that uploading a respository to github can be very simple. The vast majority of code found on github has no revision history at all. ;)

bold island
#

i am reading 2 values from 19 sensors and pushing to mqtt, but i dont know why messages count in mqtt explorer are not same, seems like not all messages delivered.
example: sensor 1 - 2013 messages, sensor2 - 1794; none of these values can be divided by 19, it starts to be off almost immediately. Anyone got idea what it can be ?
@bold island i am running HA on i7 via xpenology. Once i switched to external mqtt ( on the same host eclipe mpsquito via docker) i have no more lost messages. Is the mqtt installed via HA less powerfull than the one outside HA ?

pine bramble
bold island
#

@pine bramble maybe

pine bramble
#

Also your pastebin in that channel has expired.

pine bramble
#

(checked in CircuitPython and Feather M4 Express schematic)

stable forge
#

@pine bramble could you file an issue? Thanks.

pine bramble
honest obsidian
#

Has anyone been in the situation where you updated someone’s Arduino library, but they don’t check GitHub very often. So you’re not sure if you submit a pull request to their library or just submit your own updated library to the library manager?

stuck coral
#

You should submit the PR, if everyone submitted variations to the lib manager there would be chaos

#

If someone would like the fixed version, they can download the fork

honest obsidian
#

I would change the name of the library so it wouldn’t conflict in the library manager.

#

And it’s not that their library is broken. The one I have just has a more useful (at least for me) variation.

stuck coral
#

Arduino is beginner friendly, so having multiple of the same library but different forks is unhelpful to people who may not totally understand, you can submit it if you want but I recommend PR

honest obsidian
#

That makes sense. I usually spend hours comparing libraries to make sure I’m using the most useful variant or implementation, so I can see your point there.

short sigil
#

I am using an Arduino Leonardo to have hotkeys for OBS but they dont work

#

I have it press Ctrl + Alt + Shift + F7 to change a slide but when i press the button on the leonardo when the OBS window is not focused it doesnt work

#

But when the OBS window is focused it works fine

stuck coral
#

Sounds like an OBS issue, since the Leonardo is sending the right key stroke

pine bramble
#

So does anybody have any idea why it's doing this and How i can get rid of it

north stream
#

Seems like a bad or missing connection

pine bramble
#

i have doubled or even trippled check every connection also in that tutorial he is saying to connect the Anode(A) pin to digital pin ~9 which doesn't work for me so i connected it to 5v

north stream
#

The anode pin is just for the backlight, I was thinking maybe EN or RS or DC wasn't hooked up properly and causing it to occasionally miss commands or data.

digital olive
#

need help getting canbus data. i have an uno r3 with a canbus shield, connected to can h and can l to device. i installed mcp can library already, and using an example sketch to receive can, i edited the baudrate to the correct one and then uploaded- now what do i do? is there a saved file somewhere? serial monitor shows all unrecognized characters

pine bramble
#

EN and Rs are connected fine with Digital pin no 11 and digital pin no 12

#

E = D11 and Rs = d12

stuck coral
#

@digital olive could I have a pastebin of your code?

digital olive
#

@digital olive could I have a pastebin of your code?
@stuck coral sorry how do i paste bin

stuck coral
digital olive
#

so the issue might be that the hardware, i know it's 250 and my crystal is 16mhz however i have a can h can l grnd and 5v pinout

#

i only have the can h and l connected to the source, im wondering if it needs to be grounded to the source

stuck coral
#

You need a common ground, yes

digital olive
#

i can't find specific info on my canbus shield, it's inland, aka microcenter

stuck coral
#

A can transceiver has a maximum common mode voltage. If the common mode voltage of the differential CAN signals exceeds the maximum, then the transceiver will not be able to recognize the bits. In practice, this means that the grounds of CAN nodes have to be connected (although a small voltage differences between grounds can be tolerated).

#

However some CAN systems dont need a common ground due to isolation

#

In a perfect world you dont, but in most cases you do

digital olive
#

ok, do i need to utilize the 5v pole

stuck coral
#

Wdym by utilize?

digital olive
#

connected it to anything from the shield

stuck coral
#

No..? If both devices on either side of the wirs are already powered you do not need to run positive voltage from one to the other

digital olive
#

right ok

stuck coral
#

Sorry for the ..? but I was still a bit confused

digital olive
#

alright i have everything connected, wehen i run that sketch then go into serial monitor it says failed

stuck coral
#

Means the micro and your can shield cant communicate

digital olive
#

that sketch was sent to me from a dev, however if i run the example sketch from the library for can receive, it enters config mode successfully

#

but i need extended id's with that sketch

stuck coral
#

Without modification?

digital olive
#

only modifying the baudrate

stuck coral
#

I see in the examples they use a CS of 10, while the code you gave me uses pin 53

digital olive
#

this is with example and modified baud-

stuck coral
#

Are you talking about the serial baud? That makes no difference with the CAN shield, what are you using in hardware for a SPI chip select?

digital olive
#

so, i may be missing something, i have a sense

stuck coral
#

You chip select is wrong, thats why you cant talk to the CAN shield

digital olive
#

ok

stuck coral
#

MCP_CAN CAN0(53); // Set CS to pin 53 on Arduino Mega 2650 your UNO doesnt have a pin 53

#

If I had to guess, replacing 53 with 10 will fix it

digital olive
#

yeah i discussed the mega vs uno r3 discrepancy with the person who sent me the code but not helping

stuck coral
#

If you change MCP_CAN CAN0(53); to MCP_CAN CAN0(10); does your sketch start working?

digital olive
#

yes! ok

#

both successful now

stuck coral
#

Awesome

digital olive
#

but still unknown characters

stuck coral
#

Are you running the exact code you sent me? Minus the change I told you to make?

digital olive
#

exact code, 53 changed to 10

stuck coral
#

Try changing the serial monitor from 250000 to 115200

digital olive
#

stops there

stuck coral
#

Okay, if at the start of loop() you add

Serial.println("Test");
delay(1000);

before your if statement, what prints out?

digital olive
#

it says what i previously posted and test test test over and over again

stuck coral
#

Great, so the code is working as it should, your if statement isnt becomming true

#

You can remove what I had you add

#

if(!digitalRead(CAN0_INT)) this isnt becomming true

digital olive
#

hmm

stuck coral
#

Do you know which pin the IRQ is on your shield?

digital olive
#

Not exactly

stuck coral
#

Do you have any documentation for it?

digital olive
#

standby

#

okay so i ran an example again with the serial baud rate down and this is what i got

stuck coral
#

Yep, the example doesnt use the IRQ right? I'll be back at my desk in a sec

#

Oh it does #define CAN0_INT 2

#

Change your IRQ pin to 2

#

Line 18 which is currently #define CAN0_INT 11 should be #define CAN0_INT 2

digital olive
#

success!

stuck coral
#

There you go, you just had the connections to the shield wrong, easy fix

digital olive
#

i changed that and then had to hit the reset button and turn on the battery immediately while in serial mon

stuck coral
#

Hm, not sure. If you press reset mow on the Arduino, then reopen the monitor does it work or no?

digital olive
#

doesnt even matter now because this is all i needed

stuck coral
#

Okay, great

digital olive
#

this battery pack does not indicate green fully charged until delta mv is 100 or less between cells

#

been on the charger for a week already

#

wanted to know how far off it was

stuck coral
#

Hm, is it an old battery?

digital olive
#

no its a refurbished one which received updated firmware in order to prevent imbalanced cells from getting way out of wack over time, thus creating a long initial charge to get them aligned

#

can literally take 2 weeks

stuck coral
#

From what I know about batteries, that doesnt sound right

north stream
#

Some battery managers switch in an impedance across one cell while charging the others at very low current (like 5mA). With a big pack, this could take days.

stuck coral
#

Days though, not weeks

#

Well actually, how big is the battery?

digital olive
#

54.4v

#

li-on

stuck coral
#

Capacity, not voltage

digital olive
#

297wh, 5.7ah

stuck coral
#

Oh dang, okay, well Im looking at the battery board and yeah nevermind if its super slow it would take 7.91 days

#

From bodgers 5mA figure

#

And looking at the itty bitty current resistors they are using for balancing I would believe 5mA

digital olive
#

yeah thats what ive been told, 5ma

stuck coral
#

Weird the board looks super over engineered as far as a processor and stuff, but I see very few legit power components

digital olive
#

thank you so much man for your time, very valuable

stuck coral
#

You're welcome, glad to help

digital olive
#

since the co went out of business, people are reverse engineering everything in order to troubleshoot problems themselves, this includes battery bms, ESC, and remote firmwares, 3 different firmwares with features

stuck coral
#

Oh thats right, I forgot they went out of business, dang

digital olive
#

believe it or not, venutech.ca has successfully been able to flash firmwares, somehow, the files are not publicly available as Lime scooter bought the company and all encryption codes went with them

#

i thought the firmware was physically on the chip

stuck coral
#

It looks like a bog standard micro, so it probably is. But there should be a debug interface

#

If you dont lock the chip, you may not be able to read the exisiting firmware, but you could wipe it and upload your own if you got access

digital olive
#

the access is the issue

#

what i heard was all encryption key

#

those keys are with lime and/or nondisclosure legalities

stuck coral
#

The encryption key is not the same as locking the chips memory

digital olive
#

so im not sure how he got in, maye created debugging software?

stuck coral
#

You still might be able to totally erase it, but thats a big if. And there is some made already by the company who made the chip

digital olive
#

on another note, how difficult would it be to adapt the 1602A LCD to the uno/shield to read those parameters i showed

stuck coral
#

Assuming you had enough pins, not very, which you probably do

digital olive
#

would be cool to make a boxed unit out of this to plug into other batteries to check voltages like the sketch ran

honest obsidian
#

With 2G going away, does anyone have any recommendations for hobbyists level call and text integration? Maybe LTE-M and NB-IoT?

neat dagger
#

@honest obsidian i just snagged a sim7600G which is working on tmobile with VoLTE

honest obsidian
#

Sweet! Gotta link you can share?

neat dagger
#

i was able to get it on amazon

#

but im not sure if the nbiot stuff is working on tmobile

#

as i know they have 'certified' devices and this isnt one of them

#

but i have working voice, sms, and data

#

so... ¯_(ツ)_/¯

#

trying to extend the class for the demo code they sent with that module

#

but im pretty new to arduino and c++ so its not going well

honest obsidian
#

Nice. Is the project on GitHub by chance?

neat dagger
#

the demo code? no, its on the wiki page though

#

i would love it if ada made a new fona module with the sim7600g

#

@broken depot just saw you asked about SIM7600 awhile back, and i just got one and am using tmobile

#

how would i create a class for this module that lets me pass the serial port to the constructor?

#

i know the basics of creating the class and constructor but am not sure what or how to pass a serial port

#

the demo code is hard coded to serial and i want to use serial1, or 2, etc

left grotto
obtuse spruce
#

@left grotto - if that drawing is how you wired it, then the chip in the middle of the breadboard is wired to +Vcc and +Vcc! One of those two connections should be to GND

#

But assuming that you've wired it correctly - in your code, it looks like it will pulse the motors just once for a very very short time for each button press.

#

You turn them on, but then immediatly loop runs again and will turn them off (because the command from the IR controller has already been read.... and even if you are holding down the button and the controller is sending the command again and again, as far as the processor is concerned there is an eternity between each of those transmissions - and loop will run many many times while it waits - each time falling through to calling directionControl0 turning the motors off.

left grotto
#

thanks! Am triying. How i said am really new to this and it ts difficult to me realizing simple things

#

my bigger problem is that i didn't know how to control the motor's velocity because i wanted them to be slow

#

so i started just trying things

midnight mulch
#

Can someone help me understand the function of the DTR pin on a USB-TTL device, and the significance of putting a 0.1uF capacitor between the reset pin and DTR, from the perspective of uploading code via optiboot?

vivid rock
north stream
#

@midnight mulch DTR ("data terminal ready") is a serial communications signal that Arduino boards co-opt to use as a "reset" signal. In order to make the signal into a pulse, it's coupled with a capacitor. It's a bit of a hack, but it has become the usual approach.

mellow flax
#

What's the best way to send data wirelessly to a computer?

#

I've seen a few resources on how to send POST requests but I wasn't sure if that was the best method.

lone ferry
#

@mellow flax Depends on whether the device that is sending the data is anywhere near the computer.

midnight mulch
#

@midnight mulch DTR ("data terminal ready") is a serial communications signal that Arduino boards co-opt to use as a "reset" signal. In order to make the signal into a pulse, it's coupled with a capacitor. It's a bit of a hack, but it has become the usual approach.
@north stream

A reset pulse involves taking the reset pin to ground and back doesn't it? Because the default is a 10k pull-up to VCC? What exactly does the capacitor do here? I'd imagine you charge it up with a positive signal, thus repelling the electrons on the other end of the capacitor (which is also pulled to 10k), and when you ground the capacitor on one end, you attract the electrons on the other end briefly until an equilibrium is reached?

#

Sorry I'm an electronics/physics/chemistry noob.

north stream
#

The 10k pull-up gives the reset pin a default state (not reset). When the DTR line goes from low to high, that low to high signal couples through the capacitor to make a positive going pulse that doesn't really do much, it discharges through the pull-up resistor and the chip's protection diode. When the DTR line goes from high to low, it makes a negative-going pulse that resets the chip, and then the capacitor discharges through the pull-up resistor.

#

The width of the pulse depends on the value of the capacitor and the value of the pull-up resistor.

midnight mulch
#

How exactly is the pulse generated? Is it similar to the mechanism I suggested?

north stream
#

Yes, the pulse is generated by setting the DTR line low (then high again a little while later)

mellow flax
#

sorry I phrased that wrong

#

I was wondering if that is the best way to send data over a network

lone ferry
#

Still depends on what you're trying to do 😉

north stream
#

That's one of those "it depends" questions. You can use UDP for fast stuff where dropped packets are okay, TCP for guaranteed delivery, etc.

deep tapir
#

can someone help me with connecting to roboclaw motor controllers to the arduino?

#

Im useing the softwareSerial object thing to connect the roboclaws, but I cant take encoder outputs from both at the same time

#

like if I take outputs on one, then the other doesn't work.

#

like heres the code, where only roboclaw2 gives encoder outputs

north stream
#

That may be a limitation of having multiple high speed software serial ports in operation at once

deep tapir
#

is there a way around that tho

north stream
#

It depends...

deep tapir
#

uhh like what do I need to do to get it to work...

north stream
#

What are you actually trying to accomplish?

deep tapir
#

like take the encoder outputs of 3 motors

north stream
#

Why do you want to take the encoder outputs? What are you going to do with them?

deep tapir
#

to make the motors run to an accurate position

north stream
#

I think the Roboclaw controller can do that for you

deep tapir
#

do I use that SpeedAccelDeccelPositionM1 function

#

cuz I never got it to work even with one roboclaw :/

#

but I still want to have the info for where the motors are at

north stream
#

That's going to be tricky, you may need to either have a second processor, or use one with more than one hardware serial port.

midnight mulch
#

Yes, the pulse is generated by setting the DTR line low (then high again a little while later)
@north stream

And I suppose the bigger the capacitor the bigger the pulse? How does the resistor relate to the pulse? Does a bigger resistance mean it takes electrons longer to go from the source to the reset pin?

vivid rock
north stream
#

Basically the bigger the capacitor and bigger the resistor, the wider the pulse, so you can use those to adjust the amount of time the pulse lasts.

midnight mulch
#

Aah sweet! Also, is it just me or does the optiboot bootloader not work when using 3.3v VCC on the USB to TTL device while uploading? Tried this on 6 different Atmega8A chips and an Atmega328, with a CP2102. Only the upload has issues. They power on just fine and run whatever has been burnt to them when using the 3.3v Vcc. I also noticed that a 10k pull-up on the reset pin was needed to upload code (without it the code wouldn't upload), but the chips themselves would run fine with just the internal pull-up.

deep tapir
#

@vivid rock is there any way to plug an encoder directly into a digital pin of an arduino or sth

#

cuz I only need to run 3 motors, so like I can use 2 with the roboclaw and 1 with the arduino

north stream
deep tapir
#

ok thanks!

mellow flax
#

I was wondering if that is the best way to send data over a network

#

Still depends on what you're trying to do 😉

#

just trying to send temp and soil moisture data every minute

#

I've already made a HTTP server in go for receiving POST requests

#

probably just going to go with that unless there is a big reason not to

north stream
#

That should be fine for that use case.

left grotto
jolly wagon
#

Hi I am a 100% noob and have never done anything with arduino but i would like to do this please help Im doing this
https://www.youtube.com/watch?v=TRnu2_TI9Vk on a HiLetgo 1PC ESP8266

I don't work with anyone. Beware of Scammers Please Contact Only through My Email mesh.drone@gmail.com

You can Donate to Cleric for his hard work now
(Donate Button On Bottom of page)
https://github.com/Cleric-K/vJoySerialFeeder

Arduino Nano V3
https://www.banggood.com/ATm...

▶ Play video
fallen canyon
#

@reef ravine when your around i tried the capacitors they made a difference but still not interference free so I bumped them to the 25uf ones and it was way better with noise still. Is the 100nf capacitors bigger than the 25uf ones?

cedar mountain
#

100nF is 0.1uF. Nano versus micro.

fallen canyon
#

Whats pf then?

stuck coral
fallen canyon
#

Ok so pf is less than uf

#

Might have to double the capacitors with the 25uf ones

#

@stuck coral thanks for that chart

deep tapir
#

how do I download this library ahh

stone dirge
vivid rock
#

@stuck coral funny how some of these prefixes are only used in very special situations. I've never seen hectometer outside of dictionary, but hectoliter is rather usual in wine industry...

fallen canyon
#

so daisy chaining the capacitors didnt work... im guessing that isnt possible

#

er well possible but wont work

#

so a 10uf capacitor which i mistook for a 25 takes out approx half the noise on the curcut

north stream
#

@deep tapir There are two ways to install the encoder library. One is to run the Teensyduino installer, which will install it for you (along with all the Teensy libraries and support). The other is to clone the git repository, and then install it with the Library manager as if it were a zip library.

#

I guess a third way is to just clone it into your arduino/libraries directory.

reef ravine
#

@fallen canyon Did you try 10 or 100nF?

fallen canyon
#

10 uf?

#

thats what i tried after the .1

reef ravine
#

no, nano farads

fallen canyon
#

havent tried nF

reef ravine
#

ok, .1uF didn't help?

fallen canyon
#

1 uf did a tiny bit

#

but it was way mor noticable with 10 uF\

#

cut the noise in half from what i could tell

reef ravine
#

is the shield of the CAT5 tied to ground?

fallen canyon
#

i dont believe its shielded

#

just a plastic coating no aluminium

reef ravine
#

is it cat5 or just 8 conductor wire?

stuck coral
#

Cat 5 needs a shield if I remember right, usually its that plastic with the metallic coating

fallen canyon
#

it says cat5e cable but could be just 8 wire since it was alot cheaper to buy 100 feet of this than a 25' cat5 cable premade

reef ravine
#

hmmm, CAT5 does include shielding

fallen canyon
#

you sayin i need to get out my aluminium foil? lol

#

i could grab some foil tape

reef ravine
#

as a test it may pay lol

#

going to 10uF or more means it isn't the solution

#

this is in the loom right?

fallen canyon
#

yup but i tried doing it with the other cat5 and was getting a bit of intertference still

#

the one thats not connected

#

but its much better tha the one in the loom

#

so when i use the foil should i be grounding that?

reef ravine
#

yes on the micro's end

#

maybe wrap some stripped copper wire around the foil to make the connection

fallen canyon
#

ok ill try that out tomorrow... if i gotta go full redneck with ducktape and aluminium foil ill do what i gotta do

reef ravine
#

some actual shielded cable would be better, just saying...

fallen canyon
#

lol thats a 45 minute trip to town to get something im not 100% sure is gonna work lol and then there is also the rewiring factor

reef ravine
#

true, but real CAT5 uses twisted pairs and shielding, it's gotta be better. The foil test may prove the point

north stream
#

I'm not convinced shielding is the issue here, but finding out would require some test equipment or A/B experiments.

reef ravine
#

so far if the wires are not in the loom with power and stepper drive signals the problem is much reduced

fallen canyon
#

also without powering the stepper drivers there is no interference

reef ravine
#

how many limit switches are you using?

fallen canyon
#

8

reef ravine
#

so each input, through the cable, to a reed switch, to ground and using INPUT_PULLUP?

fallen canyon
#

yup

#

4 are for direction out

#

and 4 are for direction in\

reef ravine
#

where is ground?

fallen canyon
#

ground is a 16 gauge wire in the same loom running back to the board

#

i could common ground the trailer but i was trying to keep this whole system seperated

#

so that i dont have any feedback issues from A/C somehow

reef ravine
#

if you pull just ground out of the loom does it get better?

fallen canyon
#

without any switches tripped would that make a difference?

reef ravine
#

it seems the stepper pulses are causing noise that is getting to the inputs (toggling them, when they should only be high or low) whether any or all switches are tripped

fallen canyon
#

yeah thats pretty accurate there

reef ravine
#

something else that could be tried is using just INPUT and adding lower value pullups externally, maybe 10K or 4.7K , the internal ones might be up to 50K

fallen canyon
#

cuz even unplugged from the limit switch line and plugged into the other line and thrown out the window it still trips them... the onloy thing i dont understand is it doesnt happen when the cat5e male end is not plugged in and i have the short run of cat5

#

thats almost the entire setup there and the cat5 has been moved away from the stepper driver on the left from where i had it before

#

i brought it down centered to try and give mor room from the stepper drivers

reef ravine
#

where were you putting the caps? in the terminal block?

fallen canyon
#

yup right in the screw down conntectors then running a female pin to male pin wire to a breadboard that ghas the wires to the cat5 on it

#

maybe my shielding needs to be for the board

#

from those closest drivers

reef ravine
#

hmm, the caps need to be as close as possible to the input pin

fallen canyon
#

thats the closest i can get

reef ravine
#

if you move the arduino does that help?

fallen canyon
#

havent tried that yet

reef ravine
#

its nested in a noise generator lol

fallen canyon
#

il try it tomorrow tho im on a shor lead from the way i have it wired

#

haha yup

#

if i have to rewire the entire thing im alright with it but i definatly want to test it to make sure thats gonna fix it first lol

stone dirge
#

Can anyone help with adafruit io? I have a momentary switch which when pressed sends "1" and when released sends "0". On the adafruit webpage on my pc, the switch works perfectly, but when using the same switch, on the same webpage, on my phone pressing it will send "1" and will not send "0" when released. Do you know why this would be?

reef ravine
#

so it works on the PC browser but not on the phone?

stone dirge
#

exactly

#

only half works on phone

reef ravine
#

refresh the page on the phone?

stone dirge
#

now when pressing it on my phone, it sporadically sends either 1 then 0, 0 then 1, and sometimes just 1

reef ravine
#

but flawless on the PC?

stone dirge
#

yes

reef ravine
stone dirge
#

so weird, i'm assuming has something to do with the phones digitizer

reef ravine
#

nice job on the nrf power switch btw

stone dirge
#

oh shoot sorry, didn't realize i was on arduino

#

my b

#

thanks anyway

reef ravine
#

@fallen canyon I thought you had a breadboard, you could try putting the caps in the terminal block directly, hanging them on wires isn't a great way to reduce noise

#

and the external pullup resistors could be mounted the same way

fallen canyon
#

so in my code

#

i need to make them read pins without a pullup?

reef ravine
#

yes just pinMode(x, INPUT)

#

a pullup is needed, the internal ones are "weak" pullups, a stronger pullup should reduce the noise

fallen canyon
#

so the issue i had with them only being inputs is they fluctuate from high to low

#

when in testing mode anyways

reef ravine
#

you do need a pullup or the input "floats" and can randomly toggle

fallen canyon
#

ok

#

i can try all of this tomorrow

#

when its not dark out lol

reef ravine
#

ok, let us know (grab an oscilloscope if you can 🙂 )

fallen canyon
#

lol i dont have acces to one right now

#

thought about turning an old iphone into one

#

once i make that into a deck and it slides in and out and stops where its supposed to i can do my electrical and have light so i can work... but by then testing will be done on this lol

reef ravine
#

yeah a few steps to reduce the noise, move the arduino might help. are the stepper drive outs routed away from the limit inputs?

fallen canyon
#

i have one of the outs next to one of the inputs. havents figured out which input it is but one has significantly less noise than the rest... the capacitors make it almost work perfectly

reef ravine
#

try the lower value external pullups with the .1uF caps, might be enough

#

and if you can route the whole cats 5 jack and wires straight out over the USB, away from as many other wires as possible

#

looks like they are tie wrapped in with drive signals

fallen canyon
#

o removed the ties and its routed different as of today

reef ravine
#

ok

fallen canyon
#

i deffinatly got work to do more testing though

#

ill try the resistors and capacitors first

#

then if that doesnt take care of it ill do sheilding

reef ravine
#

as short as possible on the leads for both

fallen canyon
#

and if that doesnt do it ill move the arduino or maybe set different pins for things and see if that helps

reef ravine
#

i doubt its a pin issue

fallen canyon
#

i stil need to figure out the whole having one almost .working perfctly and see what pins they are

reef ravine
#

electrically all the inputs are very similar

fallen canyon
#

see if i can figure out what the difference is there

#

ill be super happy if throwing a resistor in the run and the capacitor solves it

reef ravine
#

for test can you enable only one input? then you only need to make that input quiet, then do the same thing on the others

fallen canyon
#

i can do that for sure

#

i can actually do that anyways since nothing moves without them working right

reef ravine
#

not sure i follow that, while travelling all would be open (inputs HIGH)

fallen canyon
#

Well since the drivers are all disabled with the noise then i can just mess with one circuit till it works right. Then from there copy that design

#

The only thing now is how to make my input stay high with the external pullup

reef ravine
#

if the drivers aren't running the switches all work correctly no?

fallen canyon
#

That’s correct

reef ravine
#

just checking, getting late lol

fallen canyon
#

Lol are you on the east coast?

reef ravine
#

yes in the hills west of NYC

fallen canyon
#

Yeah its late for you then for sure

#

I noticed alot of people here are on the east coast

reef ravine
#

maybe b/c Adafruit is a NYC based company

fallen canyon
#

Could be that

#

Either way dont let me type your eyes off. I appreciate the help and all the different troubleshooting tips

reef ravine
#

no problem, its a cool project and it should be doable, noise is tricky to track down with "just a wet finger" 😉

#

in industrial systems sensors are usually on a current loop or RS485 system just for this reason

fallen canyon
#

Well if i need to get another piece for this puzzle i can

#

But the project is gonna be 30-40 grand as it is so i was trying to keep all costs lower to do more cool stuff elsewhere

reef ravine
#

hopefully lowering the input impedance from 50K to ~5K helps

fallen canyon
#

We will find out tomorrow 🙂

main jay
#

Hello ppl.. im trying to put a string into EEPROM using EEPROM.put(Address, String);
Im haivng issues trying to use strings longer than 8 bytes.. it just garbles the string in the EEPROM.

#

Thinking i should use EEPROM.write instead of Put.

pine bramble
#

@reef ravine On certain weather days I can see the tops of thunderheads over Poughkeepsie (from about 50 miles ENE of there).

elder hare
#

so im working in Visual Studio (PlatformIO) and i currently have my code with ESP32 (when you make a project you have to select the board your working wit) but i want to try my code on a ESP8266, how can i copy/duplicate the project in VS PlatformIO to work with ESP8266? anyone know? 🙂

north stream
#

@main jay Looks like you're right: put() is designed to write stuff like ints and floats.

main jay
#

I solved it @north stream Thanks! 🙂 its more secure to just do a EEPROM.write instead 🙂 that way i know i get the exact data where i want it.

midnight mulch
#

How do you Arduino C/C++ folks do multithreading?

#

Asking from the perspective of an ARM core with >= 20k RAM.

#

Don't think the puny 2k RAM of an Atmega8A has space for these sort of primitives.

cedar mountain
#

A typical Arduino pattern is to have one main loop using millis() with a state machine, plus various interrupts, rather than real multi-threading.

midnight mulch
#

Well... I'd like something that's got a message passing vibe. And mutexes.

cedar mountain
#

Outside of Arduino, FreeRTOS is common for ARM systems.

midnight mulch
#

Is there a FreeRTOS for the SAMD21 and the SAM3X8E? Got a Xiao and a Due to monkey with.

cedar mountain
#

Almost certainly for the D21. Don't know about the 3X, but likely. They have a list of all the architecture ports.

midnight mulch
#

But some C based super light scheduler would be nice to have for platforms like the STM8 and Atmega8A.

#

What's the typical IDE setup for FreeRTOS like? A VSCode plugin or something like that? Be nice if you could do ctrl+click to go to definitions, have global reference lookups, and quick refactors, in an opensource IDE.

cedar mountain
#

Whatever you like. FreeRTOS is just some extra C source files, so it'll work with any toolchain targeting your chip.

#

They have example projects for a number of them.

midnight mulch
#

Yeah but what's the convention like if you want the full IDE experience?

cedar mountain
#

I'm not sure there is a convention. It runs on dozens of chip architectures, so they try to be agnostic about that.

#

Maybe see what the SAM example projects use?

midnight mulch
#

I'm not sure there is a convention. It runs on dozens of chip architectures, so they try to be agnostic about that.
@cedar mountain
I meant from an IDE perspective.

#

It's nice to have a little digital grunt that does half the work for you.

cedar mountain
#

I'm just saying it's apples and oranges, like asking "Well if I buy a Ferrari, what house is conventional to park it in?" FreeRTOS is a library you bring into whatever development toolchain you like, it's not an all-in-one ecosystem like Arduino.

midnight mulch
#

Aah okay. So I guess I should be looking for a C toolchain then.

unkempt panther
#

Hey can someone help me with something, I want to make an Arduino shock alarm clock and I have a tutorial but I can't understand it

cedar mountain
#

There are a number of embedded ARM IDEs out there. Keil, various Eclipse-based ones, etc. I just use command-line myself, so can't really recommend one.

midnight mulch
#

Aah okay. I tried googling awesome-arm but ended up with a bunch of workout videos 😂

vivid rock
#

@midnight mulch once a friend of mine tried finding out how you insert images in LaTeX documents. Unfortunately google search for "image latex" returned somehting else

midnight mulch
#

Okay so common sense tells me I should stick to searching for extensions for popular actively developed opensource IDEs. IntelliJ's C/C++ stuff isn't opensource. That leaves NetBeans, Qt Creator, VS Code, and Eclipse. I'll Google around to see which of the four has the best FreeRTOS plugin.

#

Platform.IO and Eclipse CDT seem the most promising. I guess I'll monkey around with both and see!

#

I found platform.io extremely clunky a couple of months ago when I tried it. Maybe I'll start with Eclipse. Been years since I used it and I'm curious.

north stream
#

Eclipse is a bit clunky but useable, in my opinion.

kind onyx
#

This is less Arduino and more embedded, but is it possible to use a timer (or two) on SAMD5x to handle a rotary encoder? They have a PDEC peripheral but it shares pins with USB so not an option unfortunately.

fallen canyon
#

@reef ravine so i was trying the input theory on the pins on my arduino with an external pullup and it still floats when not activated. is there a way to declare it normally high in the code other than declaring it as a pullup?

vivid rock
#

@kind onyx I never used PDEC, but why do you need a timer? all you need for getting position from quadrature encoder is two interrupt-enabled pins

north stream
#

There are some nice optimized encoder libraries, don't know if one of them supports the SAMD5x.

reef ravine
#

@fallen canyon Still at work but if the external pullup is wired from Vcc to the input pin it isn't floating... Switch open should be Vcc (5v or very nearly so), reed switch closed 0V

fallen canyon
#

@reef ravine i got it . Had to read up on proper wiring for an external pullup. The capacitors killed the signal from the reed switches but i got it working good ended up taking a 10r pullup resistor and no capacitor and everything is working with no stutter and stops perfectly

reef ravine
#

10 ohms?

fallen canyon
#

Thank you for the troubleshooting the noisy thing has been a challenge and a half lol and yes 10 ohms

reef ravine
#

thats awful low...

#

it'll draw .5A when the switch closes

fallen canyon
#

Well it works for what i need. Is there any issues with that .5A?

reef ravine
#

times 4 (for full in or full out) is 2A! A 1K doesn't work as well?

#

the arduino regulator is only rated for .5A (500mA)

fallen canyon
#

Nope 1k skips

#

And by skips i mean the motor might turn once every ten seconds for half a second

reef ravine
#

what about a 1K pullup with a .1 or .01uF?

#

at a minimum you can't use the arduino to supply the +5 for the pullups at 10 ohms

fallen canyon
#

Can try a .01 the .1 doesnt let any signal happen

reef ravine
#

you mean it never goes low if a .1uF is between the pin and ground?

fallen canyon
#

Yup

reef ravine
#

something sounds wrong

fallen canyon
#

I dunno it just flat wouldnt sense any signal even if i go to the other end of the cap and then directly to ground

#

So for whatever reason the .1 wouldnt work. Hadnt tried the .01

reef ravine
#

the signal doesn't go through the cap, the cap goes from the pin to ground, "shorting" AC, but not a DC signal

#

maybe the cap doesn't help but it shouldn't be stopping the signal

fallen canyon
#

It wont go low tho

reef ravine
#

makes no sense, the reed switch is a direct short to ground

#

which is why I'm wondering, do you have the cap in series with the switch?

fallen canyon
#

So my wiring goes 5v to the resistor to a rail on the breadboard then to the pin. I took the cap and threw in on that rail with the other end on another rail and then on that rail i put the wire for the switch. Ill take a pic in a sec and send it

reef ravine
#

should be
+5 >> 1K >> pin, pin >> .1uF >> ground, then attach reed switch to pin

#

here R1 is the pullup, button is the reed switch

fallen canyon
#

Yeah thats how its wired like the schematic and the cap is between the button and the resistor connection

reef ravine
#

no, between pin and ground, if cap is in series with button it'll never go low

fallen canyon
#

Ok so my wiring is the reason for it not working so the cap would go from green wire to ground?

#

Right after coming off the pin?

reef ravine
#

if you ignore everything else, from the pin to ground (dunno what the green wire is lol)

#

oh the green in pic

fallen canyon
#

In your schematic

reef ravine
#

right from pin to ground, as close to pin as possible

fallen canyon
#

The cap is its own small energy storage unit right?

reef ravine
#

the idea being that AC noise will be shorted by cap but DC from switch is unaffected

fallen canyon
#

Ahh ok so that makes more sense

#

Ill have to go wire that up here in a few. Whats the lowest impedence resistor i could do with the arduino powering the system?

reef ravine
#

I'd go no lower than 1K, without being able to see exactly what noise is being induced it's hard to say what value is best

#

@1K the switch will draw 5mA

fallen canyon
#

Ok ill go back to the 1k ones then and try it out. With the cap in place correctly wired it may just work with that

reef ravine
#

i'm hoping that between a lower input impedance (1K vs 50K) and a small amount of filtering of AC noise (the .1uF) it should at least be a big improvement

fallen canyon
#

Well i will be able to tell ya in about ten minutes lol

reef ravine
#

lol

fallen canyon
#

@reef ravine your awesome. It works flawlessly with the 1k and t he cap wired correctly

reef ravine
#

cool, to save a few millis it may work at 4.7K or even 10K as well, but at least at 1K you won't burn your fingers 🙂

north stream
#

Or your reed switches

fallen canyon
#

Lol

#

Ive broken a few already

#

Had them set a tad low in the tube and slid it into them... busted three clean off

reef ravine
#

glass is like that

fallen canyon
#

And im not worried about the amount of time for shutoff lol i am almost sure its over the 1/8” magnet for 10seconds or more

reef ravine
#

the cap slows the signal only a very little, no problem. if you are curious google "low pass filter"

#

basically when the switch closes it "drains" the charge on the cap, but with a small value and very low resistance the cap discharges quickly

fallen canyon
#

Yeah I understand what your saying and it makes total sense i kinda followed before the explanation but that makes it 100# clear.

#

I took circutry about 15 years ago so I understand some things and the rest i forgot

#

But putting earplugs on my arduino is great and helps me relearn some things and methods

reef ravine
#

i'm glad it's working well now, and you saved a bunch of aluminum foil 🙂

fallen canyon
#

well if i had to use toilet paper i would have just bought shielded cat5e lol

north stream
#

Ironically, that might have even made things worse.

fallen canyon
#

haha

#

aside from the fire hazard

reef ravine
#

with the shielded maybe you can loose the separate #16 ground wire

fallen canyon
#

meh its already wired

#

the 16ga was part of the trailer wiring harness that i didnt use since they double wire one pin on the flat 4 for the brake and running lights

reef ravine
#

and since it's working with reasonable values - "if it ain't broke don't fix it"

fallen canyon
#

yup

#

i follow that polocy alot in my life

dry mango
#

Are there any kinda bluetooth hid "just connect switches (and power ofc)" platform or modules anyone know of?

feral pivot
#

I planning a arduino lab bench power supply it must be variable around 0-35v anyone can help me?

north stream
#

Which part? The bulk supply? The voltage regulator? Arduino control?

feral pivot
#

arduino controlled 0-35v digital power supply

north stream
#

I can probably help, and there are several existing projects out there with good information (I think Elektor Magazine had a nice design a couple of years back)

formal python
#

can anyone help me on video game controllers pls ?

feral pivot
#

What you need

pine bramble
#

(don't say about grammar pls :D)

#

(i am not good at english)

elder hare
#

quick super question here! Tomorrow a friend of me and my GF is having a birthday party @ our place! she's a l.e.s.b.i.a.n and wanted a pride themed birthday party! and i have this 16x16 matrix up and running and i can run the rainbow pattern easy! but i thought it would be cool to show a heart with the rainbow colors (scrolling rainbow) inside the heart! is this possible and how?

lone ferry
#

You want only the pixels in the heart to be drawn? Everything outside the heart is black (or some other color)?

elder hare
#

@lone ferry exactly 🙂

#

only the heart pixels and everything else black/off 🙂

lone ferry
#

And you already have the rainbow pattern running by itself, or do you still have to do that?

elder hare
#

i have a rainbow pattern running

    void Rainbow() {
      for (byte row = 0; row < NUM_ROWS; row++) {
        for (byte col = 0; col < NUM_COLS; col++) {
          int delta = abs(NUM_ROWS - row * 2) + abs(NUM_COLS - col * 2);
          leds[row * NUM_COLS + col] = CHSV(delta * 4 + counter, 255, 255);
        }
      }
      counter++;
    }
lone ferry
#

OK great. Now what you need to do is define an array heart that is 16x16 values where a 0 means background and a 1 means heart.

#

Then in the line leds[row * NUM_COLS + col] = CHSV(delta * 4 + counter, 255, 255); you change this to leds[row * NUM_COLS + col] = CHSV(delta * 4 + counter, 255, 255) * heart[row * NUM_COLS + col];

#

In other words, the heart array is a "mask" for the image.

#

Where heart is 1 it lets the color through; where it is 0, it uses black.

elder hare
lone ferry
#

@elder hare It worked with just the rainbow pattern, yes?

#

Also, you pasted the same link twice.

elder hare
#

yes it worked tested befor i switched

#

wops... i'll fix

#

there

lone ferry
#

OK, so the issue isn't with drawing the heart shape but that you now are running on the ESP8266 and nothing draws anymore?

elder hare
#

yes!

#

erh... i found it!

#

it's working now

lone ferry
#

Good because I nothing about the ESP8266 😄

elder hare
#

xD

lone ferry
#

What was it?

elder hare
#

i work in VS (PlatformIO) and i have yet to find a way to easy convert 1 project from one board to another so i need to make a new project and then copy the code over! i forgot 1 very important lines in setup

  FastLED.addLeds<LED_TYPE, DATA_PIN, COLOR_ORDER>(leds, NUM_LEDS);
lone ferry
#

Ah OK!

elder hare
#

now back to your solution above 🙂 gonna make that array now

lone ferry
#

Just make it bytes: byte heart[16*16] = { 0, 0, 1, 1, ... };

elder hare
#

now to draw a heart with my skills in 1's xD

lone ferry
#

Wanna know how I would do this? I would do it in a text editor: put ................ on 16 lines. Then draw the heart with Xs. Then use Find&Replace to replace . with 0, and X with 1, . 😄

elder hare
#

haha nice ;P i'll try that

marsh rock
#

oh man, i wanted to be clever and boost a small solar cell's voltage by using a boost converter circuit but instead of a mosfet or transistor, i flip my attiny's pin to output/input at a high rate to charge/discharge the inductor but i think theres capacitance or something when i switch from input to output

elder hare
#

@lone ferry uploading now 😄 hope it works ^^

#

it's beautiful ❤️ 😄

#

thank you so much!

lone ferry
#

Upload a pic 🙂

elder hare
#

2 sec

#

my phone s.uck

lone ferry
#

Nice! If you're really ambitious you could also make the heart itself animate 😉

elder hare
#

like a heartbeat 😮

lone ferry
#

Yes, for example.

#

To do this you would make multiple heart arrays and switch between them every couple of seconds.

elder hare
#

that should not be difficult

lone ferry
#

No, you already have all the pieces for it.

marsh rock
#

next step is to ditch the array 😛

lone ferry
#

Hehe. Problem is you need to rasterize that, which can get complicated.

elder hare
#

yea the party is tomorrow! this works for now 🙂

#

only one thing i wanna change tho

#
    void Rainbow() {
      for (byte row = 0; row < NUM_ROWS; row++) {
        for (byte col = 0; col < NUM_COLS; col++) {
          int delta = abs(NUM_ROWS - row * 2) + abs(NUM_COLS - col * 2);
          leds[row * NUM_COLS + col] = CHSV(delta * 4 + counter, 255, 255) * heart[row * NUM_COLS + col];
        }
      }
      counter++;
    }

the rainbow color comes from the outside and fades into center! i want it to go from left to right

lone ferry
#

Looks like you need to change delta for that. Maybe int delta = col;

elder hare
#

this

int delta = abs(NUM_ROWS - row * 2) + abs(NUM_COLS - col * 2);

To

int delta = col;
lone ferry
#

Yes, maybe 🙂

elder hare
#

hmmm it's a ZigZag Matrix so each second line is flipped

marsh rock
#

int delta = (abs(NUM_ROWS2) + abs(NUM_COLS 2))-(abs(NUM_ROWS - row * 2) + abs(NUM_COLS - col * 2));

#

might be a convoluted way to do it, but may work

#

NUM_ROWS2 should be NUM_ROWS2 and NUM_COLS 2 should be NUM_COLS2

#

not sure why it messed up when i copypasted lol

elder hare
#

but why the 2 behind?