#help-with-arduino
1 messages · Page 12 of 1
ohhh I think I get it now the ACK for the 0x02 is the last bit in the green bar, but the ACK for the command is the low with the orange square.
No, the 0x02 byte is 0000 0010, but only the top 7 bits are the register address: 0000 001, which is register 0x01.
That 8th bit in the first byte is the top bit of the value to write into the 9-bit register.
👀 kk lemme try and see if that makes sense for what I expect
yeah doesn't seem to make sense where is the ACK for bits 15 to 8
Ope no I get it now thank you so so much
So this is register 2? and is sending 0001 1000 0000 which is
// [9:11] is set to: 000 (extra bits)
//ROUT1EN [8] is set to: 1 (enable headphone out)
//LOUT1EN [7] is set to: 1 (enable headphone out)
//SLEEP [6] is set to: 0 (no sleep)
//BOOSTENR [5] is set to: 0 ()
//BOOSTENL [4] is set to: 0 ()
//INPPGAENR [3] is set to: 0 ()
//INPPGAENL [2] is set to: 0 ()
//ADCENR[1] is set to: 0 ()
//ADCENL[0] is set to: 0 ()
Is that what this function is doing automatically? adding the first bit from val to the end of reg?
Yep, you have it nailed now, I think. 💯
Nice will have to pull out all the corrected values from my capture and I should be good.
It worked thank you!
is anyone aware of a touchio library for arduino?
It looks like I made the mistake of wiring up a custom rp2040 board like I would for circuitpython, gpio with 1M pulldown to an exposed pad. But I'm not finding anything so far that would do the same like touchio
The touch code in CircuitPython is quite simple and generic, and could be adapted to Arduino: https://github.com/adafruit/circuitpython/blob/main/shared-module/touchio/TouchIn.c. You'd convert the common_hal_digitalio_... calls to Arduino calls, and change the timing routines to Arduino.
The code there is not microcontroller-specific
your custom board could quite possibly run CircuitPython using the Pi Pico build (or a custom build). The Pi Pico build exposes all the pins so you would just use the pins you have exposed.
thanks danh - I've run CP on a bunch of custom boards with great success. this specific one relies on some fastled code that I wouldn't have the time to move over. I'll look at that code
I feel like I'm missing something obvious about why my arduino isn't seeing this write? using esp32 if that matters, wires are correct.
I am looking for some help with troubleshooting an intermitent Neopixel LED issue with the RP2040 and FastLED. Please see here for some more details and a video of the issue.: #help-with-circuitpython message
Looks like a data wrapping issue or a hardware problem
I don't have the issue when using CircuitPython code that addresses all LEDs fine
So, not a hardware problem.
just guessing, but are you sure that you can Serial write inside that onReceive? (If it's inside an interrupt, stuff like that might not work)
interesting is there another way I can know if the function was called?
I am unable to use the same code with this compiler https://github.com/earlephilhower/arduino-pico due to these known issues.
https://github.com/FastLED/FastLED/issues/1481
https://github.com/earlephilhower/arduino-pico/discussions/1649
I'll often pulse an I/O lead to indicate a function was called. You can watch it with an LED, oscilloscope, etc.
Here is my code I'm running: https://pastebin.com/P56cDuVy
- turn a led on or off (if you know the functions get called slowly enough so you actually see the led).
- global
volatile int receiveCount = 0;(volatile just in case that's in an interrupt)
void onWireReceiveEvent(int count){receiveCount++;}
and in your void loop just serial print the count
Maybe you can pulse a pin like madbodger says and just feed that into the logic analyzer as well
It looks like you're pointing all of the initializers to the same spot in the same LED array
Apparently FastLED deals with that for you
yeah still no ack in sight 😦
You mean this? 6 * NUM_LEDS_PER_STRIP
Sometimes the data pin drops down to 0 volts
This is measuring the data on the faulty strip
Here is how it looks with the correct CircuitPython code
And here it is with the FastLED library
What are your horizontal and vertical scales there?
500 mV/div and 300 us/div
I have level shifters
3.3v to 5 volts
Unless they aren't working?
And what sample rate is it using?
Can't read the text in those images. Super low resolution.
You can read them if you click on them and pick Open in Browser
That will open the uncompressed image
On mobile the option is in the menu on the top right when you tap on an image
I think I may have just realized how I've wasted a lot of time. If the i2c logic is 1.8v I need a level shifter eh?
huh, might be. Check the RP2040 datasheet what voltage it considers high
using esp32
That's me 😆
come on clump, just port everything to RP2040! 😝
I mean I was using that but I think it might be the same issue haha
I am using this level shifter chip between the RP2040 and the LEDs https://www.adafruit.com/product/395
lol that's what I'm soldering up right now ahah
Warning - really usure about this: I think there are some level shifters that aren't fast enough for Neopixels🤔
But, on second thought they might cause issues. https://joshua0.dreamwidth.org/74833.html
Adafruit specifically recommends that level shifter for use with neopixels
ah lol perfect
But, I'm starting to worry that they are the issue
I wonder if one of these logic level shifterw would work better
But, it's still strange that the board works fine when using CircuitPython
Something with how FastLED works on the RP2040 seems to be the issue.
any idea why my level shifter is more like a level inverter 😬
It happens sometimes. I recall a long while ago that Ladyada talked about if you level shifted you needed to invert the data. I’m not sure how true that is anymore
fixed it by pulling OE up to VA with a 10k and I can now see everything on the logic analyzer but my code still fails to ack
hi anybody alive
I would like to know how to smoothen out the brightness of LED from Arduino code
Currently this is the code that I am using. Very simple.
For now it reacts really fast
It would be nice if I can have smoother blinking instead of instant blinking like that.
a slower rise in brightness when you press the button?
no, rather, I want fast rise and slow decay of brightness actually.
and it's audio signal's CV Voltage coming out from another microcontroller
getting into A0 on Arduino Uno, reading the signal in real time
I am trying this one
I don't know if it smoothened it a bit or no.
But this is def not what I am looking for.
I am looking for longer decay
if anybody knows how to achieve it, lmk!
The basic technique is to implement a peak detector, so you'd have a stored brightness value. If the input voltage is higher, reset it to the input voltage. Otherwise, reduce it by a given fraction each time period to implement the decay over time.
ok I will try!!
can you help lol
I understood what you mean but it's hard for me to code
Basically, you'd want to write the peak value instead of the brightness value. I whomped up some code that does a proportional dropoff (the percent of drop is set by the DROPOFF amount). I kept your update rate of 80ms, but hoisted that value into a #define. I'm not sure whether peak needs to be a float to do the dropoff, but I made it one just in case: ```arduino
#define DROPOFF 1
#define INTERVAL 80
static float peak;
unsigned long nextupdate;
void loop() {
int DACValue = analogRead(DAC_PIN);
int brightness = DACValue/2;
unsigned long now = millis();
if (brightness > peak) {
// update peak because incoming signal is greater
peak = brightness;
} elif (now > nextupdate) {
// update peak because it's time for a decay increment
// subtract a percentage of the current value
peak *= (100 - DROPOFF) / 100.0;
} else {
// no updates this time, skip timer reset and output
return;
}
analogWrite(LED_PIN, (int) peak);
nextupdate = now + INTERVAL;
}
thank you my savior! I'll try later and tell u how it goes!
Okay here
Guys i need help with connecting my feather nRF 5284 to the phone through adafruit connect app
Hey sorry to bother y'all again but this i2c is a beast I can't wrangle, I finally got my pico to reply to the request, but it seems to be holding the line low after the read request. any idea on how I rease this?
I got it to release the line by adding the on request function, but it takes 133ms and it says it's writing the TxByte but over 3 seconds?
is there any reason the adafruit mositure sensor would only return FF for the eeprom?
I just tried this
It just blinks longer, once.
And I also don't understand that else if's condition. How could now become bigger than nextUpdate?
whats up theydies and gentlethem
im in a quest for knowledge
i have a Adafruit Metro ESP32-S2 and after going over all the documentation i cannot find out whats the max output current wise i can get out of the Logic pins
i am trying to switch 4 transistors or even relays
but im unsure as to how much juice i can get out of them
thanks in advance for any info
Does anyone use the seesaw moisture sensor?
As time passes, now increases until it's greater than nextUpdate, at which point, the code should reduce the brightness by an increment
I still don't understand.
now = millis();
this means, now is going to increase forever within the loop() function.
nextUpdate = now + INTERVAL;
this means nextUpdate will also gradually increase along the now value.
nextUpdate will be always greater than now. no?
And also, the LED doesn't change gradually. instead, it just shuts the light immediately.
nextUpdate should only be reassigned if the peak is updated (either by the incoming signal being greater, or the time reached for it to decrement): that's what the final else clause is for, to return out of loop() if neither of these conditions apply.
That's a great question. Max current output is about 40mA for GPIO (logic) pins, and they can sink 28mA. I try to avoid running things are their maximum rating, so I'd keep it a little under that if possible. It's buried somewhere in the ESP32-S2 datasheet from Espressif.
Oh I was supposed to look at the esp32-s2 datasheet itself
That makes more sense
I appreciate it big time @stark kindle
I'm going to be using some 2n222s to switch some relays and I have to make sure it ain't gonna hurt nothing
Thank you very much
Now I can go size the resistor
It's oaky, just letting you know the one place I know that lists it 🙂 Good luck!
AHHHHH
@north stream Ok but why does this doesn't work

this is what it currently does with that code!
I don't know, I wrote it in a hurry and haven't tested it.
You should be fine, 2N2222s have plenty of gain, so you should only need to send a couple of milliamps into the base to have them conduct enough current to activate the relay coils.
yeah i dont know the relay coil specs simply because im buying them off a surplus store
but they are more than beefy enough for what i need
it should work very well with the motors i got
im gonna solder em onto a PC board and throw the transistor and resistor on there too
I wanted to extend my thanks for this recommendation, it has been brilliant! What a great controller. I'm throwing memory caution to the wind and making all sorts of instances of my effects 😅
Also I know I won't max out its LED-driving capacity any time soon as my projects currently have at most 50 LEDs, and even the biggest future project I'm considering might drive 500 of the 5050 LEDs.
Thanks again, Scorpio is awesome! 👍🎉
Hi. I cant get custom partitions for my esp32 working. I made a new .csv file and copied over the default_16MB configuration (just to test). I added it to the boards.txt file to the appropriate esp32 board (ESP32-WROOM-DA Module) but after restarting the arduino IDE no new partition option shows up. I also tried changing an existing one app3M_fat9M_16MB but it still shows up as before.
I also read that you had to put the .csv file in the same folder as the sketch but that didn't work ether
anyone having problems driving the waveshare 1.54 200x200 rbw V2 bare screen with the Adafruit e-ink friend and adafruit_epd library? I'm on 4.5.2 (latest) of the adafruit library and initializing using the example tri-color app. It's partially working but never setting the background to white. I've checked the same screen with the waveshare dev board and their sample code, and it displays properly. They have code branches, however, for v1 and v2 boards, so something has changed.
no idea about the libary, but what does "not setting background white" mean?
- random colors (aka noise)
- background with another color
- something else i didnt think of
im not too sure why, but my sensor is updating very slow
Adafruit 9-DOF Orientation IMU Fusion Breakout - BNO085
millis, sensorValue.un.rotationVector.real
6076 0.33
6179 0.33
6303 0.38
6405 0.38
6529 0.14
6631 0.14
6753 0.07
6856 0.07
6978 0.07
7081 0.07
7203 0.07
so, ~ 200 ms between unique values
200 +
what are some things I can check?
Can you share your code?
Has anyone here messed with SquareLine to develope a UI on an arduino or esp32 platform?
I'm doing some model railroad automation and been using some of the L298N motoer controllers but get some high coil wine at low speeds, would it be better to change the motor controller I'm using or the code? <-- Played around and found upping frequency helped, 20khz got it silent
during the refresh process, any pixel not explicitly set as a color should be set to write before the refresh process ends. That's not happening in this case. I can faintly see the set pixels, but the epd is nearly black as opposed to all "background" pixels being white
I'm working on an LED project that uses the Adafruit Feather Scorpio to drive two sets of LEDs; one set of 2020-sized RGB NeoPixels and another set of 5050-sized RGBW NeoPixels.
I'm currently using the Adafruit_NeoPixel.h library and I'm trying to use an IR remote to change "scenes" which worked when my project was just 8 LEDs and some simple animations but now is malfunctioning as my project has grown to 39 LEDs and a number of more complex animations.
I believe the issue is that the Adafruit_NeoPixel.h library is pausing interrupts, causing IRRemote.h to fail to properly see the button-presses accurately. Is there a work-around for this?
Could I siwtch to the NeoPXL8 library? Does that support the use of multiple types of LED simultaneously like I currently have?
Any idea why this uplands fine to an UNO but doesn’t play nice with an ESP32?
It’s just I2C based
What does "doesn't play nice" mean? Does it not build, does it crash, does it just not work?
Doesn’t build
And the errors are...
I can get it in text , but I’m laptop isn’t signing into here
I’m currently on my phone
Normally I hate photos of screens but yours is abnormally legible 😉
thanks for posting that, it makes it much easier to help
You'd need to have them be defined for Seeed_Arduino_GroveAI.cpp as well
Yeah, ESP32's Arduino Core doesn't use those constants (as you see). It's odd that they did this and then suggest using this with an ESP32-C3, which also would not build it :/
Yep just out of troubleshooting I did try a C3!!!
suggested alternative FUN_IE_S ... oh Arduino IDE... 😂
@quartz furnace is it possible you have an old version of the library? I'm looking at it on Github and I'm not seeing PIN_WIRE_SCL or SDA though they're clearly in the code you're building...
the library doesn't have version numbers 😦
Mine matches the wiki page they have
yeah there's only one commit to Seeed_Arduino_GroveAI.h too, so there isn't an older version from what's on github...
Hmmm so am I stuck ?
I had the wrong repo 🙂 the code in the correct one does match what you're using, I'm taking a look at it now
I think they just wrote it and never tested it with an ESP32. The easiest fix would be to locate Seeed_Arduino_GroveAI.h and edit it and add the #defines for the two constants at the top, that should fix the error (hopefully that's slightly different from what you did already). You should be able to find it in the path in the error message - Documents/Arduino/libraries/Seeed_Arduino_GroveAI-master
@quartz furnace Another option if this is a long term thing you want to share with other people would be to fork the Github repo, make a change to your fork, and then have your program use your fork instead of theirs. But if you just want to get this built and use it and then not worry about it, editing the .h file locally is the easiest thing.
Close - no "=" - #define does a text substitution, it's not a variable. So #define PIN_WIRE_SDA 19 and then anywhere after that that the pre-processor (which gets run before the compiler) sees PIN_WIRE_SDA it will replace it with 19
Awesome!
Yeah I can't promise it'll work but at least now it has a chance to. Good luck, I hope it does 🙂
You were very close to fixing this on your own
Many thank YOUs 😄
Well it doesn’t work —- getting a “Algo begin failed” in the serial console
Darn
I bet I’m going to have to modify the GROVE_AI_ADDRESS
Ahhh I’m using the qwiic port , it’s SCL1/SDA1 Do I have to use the pins on the actual side of the board SDA/SCL (0) @stark kindle ?
So to be clear I had the numbers correct on the qwiic port 19 & 22 — but they are the “2nd” set of WIRE pins
And then update with the define 4 & 33 ?
With this board having a camera as well as a processor, it might be an over sized power consumption for the qwiic port ? 🤷🏻♂️
@quartz furnace the address of I2C devices is embedded in the device (all devices of a particular kind have the same address,), so you shouldn't need to change the GROVE_AI_ADDRESS
But you will need to give the right SCL and SDA pin numbers for however you have it connected. I don't know the specifics of the board you're using but it sounds like you're on the right track
If you get stuck on that and aren't sure if you've got I2C configured correctly or whether there's a problem with the Grove camera software you can build an i2c_scanner sketch and load that on the ESP32 - if I2C is set up correctly it will see the camera and report 0x62. If it doesn't then it won't report any I2C devices (if the Grove camera is the only thing connected). You may have to modify the i2c_scanner sketch to use the correct SCL and SDA pin numbers.
Ahhh good point .. I have done the scan for I2c before !!!! I’ll start there!!
It's dinner time here so I'm going to disappear for a couple of hours but I'll check back in after. Good luck!
Thanks again!! Enjoy the break!
I got it to work — I had a random thought that the C3 QtPy board has the default I2c pins for the qwiic connection not the 2nd set .. updated with C3 pins and it works 🙂
Awesome, congrats!
Has anyone used the nrf feather? I heard it has internal power for buttons. I have 6 buttons I wanna use for my project so I wanna know if I have to power them with or I can just wire it right to the pin.
Cant you do something like rect(0, 0, width, height) before your actual drawing, to make sure the framebuffer is how you want it to be?
hey ,
im using an esp32 and a gc9a01 tft ,
i want it to have a function which will get a text as an input and will print it on the screen (let say up to 100 words for now) .
but i want the function to handle all the manual work .
like the screen width , height , new lines , and in case theres no space left on the screen to clean the screen and start from the top again.
can someone provide an example?
Sorry just resending hoping for some help here:
I'm working on an LED project that uses the Adafruit Feather Scorpio to drive two sets of LEDs; one set of 2020-sized RGB NeoPixels and another set of 5050-sized RGBW NeoPixels.
I'm currently using the Adafruit_NeoPixel.h library and I'm trying to use an IR remote to change "scenes" which worked when my project was just 8 LEDs and some simple animations but now is malfunctioning as my project has grown to 39 LEDs and a number of more complex animations.
I believe the issue is that the Adafruit_NeoPixel.h library is pausing interrupts, causing IRRemote.h to fail to properly see the button-presses accurately. Is there a work-around for this?
Could I siwtch to the NeoPXL8 library? Does that support the use of multiple types of LED simultaneously like I currently have?
(I don't know, just some thoughts:) Can you just try it out? There are also a few other neopixel/WS2812 libraries, maybe try those. Could you run the LED code on one core and the IRRemote on the other?
I made an attempt to switch over and adjust the code as best I understood how to work with the neoPXL8 library. My updates compiled, but it kept crashing the Scorpio. Before I make myself insane, trying to fix it, I just want to know if it’s even possible to use the multiple LED types simultaneously. 😅😂😜
It should be possible in Arduino with multiple cores. Could you share your code?
https://github.com/Arduino-IRremote/Arduino-IRremote#problems-with-neopixels-fastled-etc suggests some workaround for exactly this combination of libraries.
nevermind, I built a work-around where the project pauses all LED updating for 2 seconds when it first detects any IR input at all, then it's able to respond to a subsequent button press properly during those 2 seconds! (interrupts work correctly if the LEDs aren't actively updating)
Not perfect, but completely functional and easy
Is the old matrix portal no longer supported in Arduino 2.2 I dont see it in adafruit boards drop-down in Arduino 2.2+ TIA
I see it - at the end of the list. Make sure you've installed "Adafruit SAMD Boards" in the board manager.
You need to select "Adafruit SAMD Boards" in the board manager when you look for the board. It's two below what you did select. See my screencap.
When you post things like this it'd help if you sent screencaps rather than photos of your screen. Photos can be blurry and hard to read in ways that screencaps will not.
Where do I post the url to install?
Here post link?additional boards manager?
Check the “Adafruit SAMD” boards two options down from “Adafruit Boards.”
Not in the board manager, in the board selection drop-down
Some updates today then restarted Arduino now the boards there, was ended at hallowing last night, odd! But seems good 👍 now thx.
How do i get the adafruit SAMD to show up in the board manager
all i have
found it
@fallen gate You should install the Adafruit Arduino SAMD core too https://learn.adafruit.com/adafruit-feather-m4-express-atsamd51/using-with-arduino-ide#install-adafruit-samd-2854160
I’m using a ss1306 oled feather wing. I have a sketch working when connected via USB but when I try to run on battery the screen doesn’t work. The feather and other connected devices are working.
check code in setup() and look for a line like while (!Serial);
@leaden walrus I removed all serial code from my sketch
@leaden walrus https://forums.adafruit.com/viewtopic.php?t=204977
thanks. replied there.
Thank you that did it!
Good afternoon everyone, I was wondering if I could get assistance with using the Feather M0 (with RFM95 LoRa Radio for referece) with MicroSD card breakout board+? I've checked the pins a few time and ensure I'm calling the right GPIO pin assigned to the CS pin.
However, it saying "Initializing SD card...Card failed, or not present" from the if (!SD.begin(chipSelect)). When I wire the SD breakout board with my Arduino Nano, it works all good and saves on the SD card.
Could it be something within the script I would need to change (using Datalogger example with chipSelect = 10;)
Are you sure those pins are right for SPI? For what board is that example code you have? The feather M0 might have a completely different processor with different capabilities regarding what pin can do what. You also might have to tell it something like "SPI mosi is on pin x, miso pin y, etc" before begin of the sd card. I would doublecheck that feathers documentation and pinout.
(I don't know about the feather M0 specifically. But what I'm describing is a common "issue" on RP2040 because that MCU is different than classic standard arduinos.)
I'm pretty sure those are the right pins for SPI, confirmed it by using a Nano. The example code was meant for an Arduino Nano (https://learn.adafruit.com/adafruit-micro-sd-breakout-board-card-tutorial/arduino-library), which I assumed would work as I used the BNO055 example's scripts with no problems. That's a great suggestion, I know for CircuitPython those would need to be declared but I don't think so based on the example script.
Most definitely, it might be the case but with it working with the BNO055 (I2C) I assume all should be fine with using it with Arduino scripts as instructed in their guide (https://learn.adafruit.com/adafruit-feather-32u4-radio-with-lora-radio-module/using-with-arduino-ide)
To be completely honest, I really don't know if those are the right pins or not. Just, this
I'm pretty sure those are the right pins for SPI, confirmed it by using a Nano
Is wrong. Feather M0 uses a Samd21 MCU while the Arduino Nano uses an ATmega328. They're completely different. Which pins can do what is completely different.
And I also don't understand the pinout diagram. Too early after waking up to understand that wall of text in the top left corner and what even sercom is
Hey I'm working on a program to make a lock using fingerprint sensor and i used the enroll program/code from your website but it keeps showing an error message
Can someone please help??
And yes I am using an audrino uno
Question:
I am currently using an arduino mini pro + a sd card breakout board to play some audio tracks.
I want to create a custom pcb with a much smaller footprint.
Is there some IC that I can use that is:
- easily accessible
- "ease" to use
- has enough integrated storage so I can avoid the sd card?
something like https://www.adafruit.com/product/5643 or https://www.adafruit.com/product/4899 maybe? (haven't used them, so idk how easy they are. But you could try the adafruit modules with their libraries and then maybe integrate the chip onto your board.)
Sometimes you need a little extra storage for your microcontroller projects: for files, images, fonts, audio clips, etc. If you need lots of space, like in the gigabytes, we always ...
That’s an error during the upload that usually occurs as a result of the pc not being able to reset the arduino to its programming mode. While I don’t know the exact cause in your case, sometimes disconnecting certain devices before uploading can fix the issue?
Sounds like you want something similar to https://www.adafruit.com/product/2220 but on your own custom board. Adafruit does offer schematics and layouts for reference, if you want to build something similar.
Hmm - is it possible to program it too? I need the sound to play only in specific cases
https://learn.adafruit.com/adafruit-audio-fx-sound-board/serial-audio-control you can send that thing commands over serial
Or use a microcontroller to trigger the button inputs
Another question - I have some old arduino pro micro boards laying around.
For some reason it can't find the COM port - but I need to read the serial monitor
I am able to upload a sketch by shorting the GND and RST pins quickly
Hey guys, I am asking a bit of a control theory question. Does anybody know how to tune a pie controller for analog dimming of a led driver?
I am familiar with a PID controller, but an analog dimming of an LED usually has a fast enough response to not need it. What are you trying to do?
I am trying to accomplish a certain set point for current while controlling voltage represented as a dac value. The reason why I am using a pid loop to account of the leds warming up and maintain a current
Is this something that has to be done with a DAC? Would some type of constant current source work?
Yep it will be done on dac. It is a constant current system. However, tuning it pid to achieve various set points is tedious (unsurprisingly)
It can be very tedious, indeed. That’s why the simplest constant current sources are usually built from transistors or specialized ICs instead. Hence why I wanted to see if you were locked into the DAC option, as it’s definitely not the easiest way to do it.
For a DAC based control loop, you also need a current measurement device, which usually involves another specialized IC or a differential ADC across a shunt resistor.
If you are already locked into this hardware, you can calculate some theoretical values based on the desired response of the device, or guess and test values based on a simple P or PI controller.
But off the top of my head I forget the formulas. Are you sure this is the method you need?
It’s also worth noting that most precision DACs aren’t designed to output significant amounts of current, you may need an amplifier depending on your load.
Yeah unfortunately, existing project specifically controls dac.(so redesign to pwm (being a popular for leds) would require a lot of works)
Yeah if you have specific formulas to give some guidance could help. Am looking for some ideas. Perhaps those formulas can help me find the range of KP and KI that can work
From what I can experiment, fyi, PI is the most effective and you can get away with just P.
https://ctms.engin.umich.edu/CTMS/index.php?example=Introduction§ion=ControlPID provides a lot of detail regarding what a PID controller is and how you can approach PID design. If the math goes over your head, you can skip down to the “General Tips for Designing a PID Controller” for the more practical hands-on tuning method.
Great thanks! I will take a look at this
What type of DAC? If it's an MDAC, there may actually be a pin to an internal resistor that lets you close the feedback loop and set current.
Just a dac no op amp to multiply by.
I am trying to run the factory demo code on a ESP32-S3 Reverse TFT Feather (https://learn.adafruit.com/esp32-s3-reverse-tft-feather/factory-shipped-demo-2), but when i do I only get the update screen. I tried reflashing the board and making sure nothing is connected when I write to it, but nothing seems to be working. Does anyone know what could be causing this?
the serial monitor gets stuck on the following:
9697949593919289908887868584838281807978
void loop() {
if (j % 5 == 0) {
Serial.println("**********************");
TB.printI2CBusScan();
canvas.fillScreen(ST77XX_BLACK);
canvas.setCursor(0, 25);
canvas.setTextColor(ST77XX_RED);
Message (Enter to send message to 'LOLIN C3 Mini' on 'COM4')
New Line
9600 baud
00:47:55.025 -> ESP-ROM:esp32s3-20210327
00:47:55.025 -> Build:Mar 27 2021
00:47:55.025 -> rst:0x15 (USB_UART_CHIP_RESET),boot:0x0 (DOWNLOAD(USB/UART0))
00:47:55.025 -> Saved PC:0x40041a79
00:47:55.025 -> waiting for download
That indicates it’s in bootloader mode. Try pressing the reset button. Don’t hold down the boot button.
the reset button does not appear to do anything. It restarts the display and goes straight back to the same screen
Is it possible something is shorting the boot pin to ground?
@fast jacinth Yeah looks like the BOOT pin is being held low (button pressed) on power up if you’re seeing the Espressif bootloader in the serial monitor
Hmm, i know D0 is the boot button, but is there a boot pin as well i need to check? I am not sure why that might be shorting, this is a new board
I am getting different behavior when i press the boot button vs when i dont, so i dont think the button has been shorted or anything. (ie pressing reset with D0 held vs without)
The BOOT button is on the underside and is different than the D0 button on the front
I thought for the reverse tft esp32-s3 there was only the D0 which also does double duty as BOOT?
https://learn.adafruit.com/esp32-s3-reverse-tft-feather/pinouts
I was looking at the schematic and it’s very confusingly labeled. Yes you are correct that D0 is IO0 and thus the BOOT button
are you seeing the FTHS3BOOT folder showing up when the TFT shows the boot screen?
I had a fresh ESP32-S3 Reverse TFT Feather and pulled off the stock firmware off of it by copying its CURRENT.UF2 when in UF2 bootloader mode. You can copy this file when your board is in UF2 bootloader mode and you should get back the stock functionality, if that's what you were originally after.
@fast jacinth you may also want to upgrade the UF2 bootloader on your board. You're running 0.12.3, current version if 0.16.0. If you go here https://github.com/adafruit/tinyuf2/releases/tag/0.16.0, download the file "update-tinyuf2-adafruit_feather_esp32s3_reverse_tft-0.16.0.uf2" and copy that onto your board in UF2 mode, you'll update the bootloader firmware. You should see the version change after the board finishes flashing and resets.
This firmware ended up fixing it. Thank you!
Heya, I was just wondering: I'm working on a board carrying a SAME51 chip, which is almost identical as the SAMD51 on the Grand Central M4 Express. I haven't been able to find a library which uses the SDHC peripheral for Arduino, although it exists for CircuitPython. Have I just not been looking hard enough or does such a library really not exist?
Just to clarify: This is to interface with SD cards without using SPI. My SD card is wired to the SDHC1 pins, SPI is not an option.
Hi 😊
So I have an at mega pro mini (without usb) and I want to code over an arduino uno.
I installed the arduino isp to the uno and connected all pins, but when I want to upload, I get this error? I tested all processors I could select, but all time the same
There appears to be several things called "mega pro mini", could you provide a link to the board you're talking about? The ones I'm seeing though have an ATmega2560 and that error message says you're trying to program an ATmega168. Sounds like you have the wrong board specified. Which Arduino boards package are you using for your board?
This board I want to programming
And this are all processors I can choose
Was it set for ATmega168 before? The error you posted is what I woudl expect if it was
It also looks like you're using a custom boards package? Where did you get it? If your board is a ATmega328 5V/16MHz, then you should be able to use the standard Arduino AVR board package and choose "Arduino Uno"
Yes i tested all 4 Processors, but all time the Same Error
Sounds like whatever boards package you're using is bad. I would try Arduino Uno or other ATmega328-based board
Fun fact: If you cancel out the terms in "mega pro mini", you get just get "kilo pro".
(I'll see myself out, thanks)
Hey yall im very new to all this but i used to troubleshoot basic electronics for the USMC and learned MM soldering there as well so i aint hopeless, im trying to use an Isty 5v to run a A4988 and a small 5v 10Ohm stepper, i think i have everything coded correctly as the pin13 lights up when its telling the stepper to rotate, but i have no spin.
Ive got the drivers, libraries, and i think everything i need, Running it off a 9v battery, then 2 9v in case amp draw? I haventy tried it with the 3Cr123s i plan on running it with but I am not sure thats the issue either.
#include <AccelStepper.h>
// Define the motor pins
#define STEP_PIN 12
#define DIR_PIN 13
#define MS1_PIN 5
#define MS2_PIN 7
#define MS3_PIN 9
// Define the driver control pins
#define ENABLE_PIN 3
#define SLEEP_PIN 11
#define RESET_PIN 10
// Create an AccelStepper object
AccelStepper stepper(AccelStepper::DRIVER, STEP_PIN, DIR_PIN);
// Set microstepping mode to 1/16 step
const int microsteps = 16; // Change this if you want a different microstepping mode
void setup() {
// Set up motor pins
pinMode(MS1_PIN, OUTPUT);
pinMode(MS2_PIN, OUTPUT);
pinMode(MS3_PIN, OUTPUT);
// Set up driver control pins
pinMode(ENABLE_PIN, OUTPUT);
pinMode(SLEEP_PIN, OUTPUT);
pinMode(RESET_PIN, OUTPUT);
// Set microstepping mode
digitalWrite(MS1_PIN, (microsteps & 0x01) ? HIGH : LOW);
digitalWrite(MS2_PIN, (microsteps & 0x02) ? HIGH : LOW);
digitalWrite(MS3_PIN, (microsteps & 0x04) ? HIGH : LOW);
// Enable the driver
digitalWrite(ENABLE_PIN, LOW); // Enable the driver
// Set up the AccelStepper library
stepper.setMaxSpeed(1000);
stepper.setAcceleration(500);
}
void loop() {
// Calculate the number of steps for a full 360-degree rotation
const long stepsForFullRotation = 360 * microsteps;
// Rotate the stepper motor 360 degrees clockwise
stepper.setSpeed(200); // Set your desired speed (adjust as needed)
stepper.moveTo(stepsForFullRotation);
stepper.runToPosition();
delay(1000); // Delay for a moment
// Rotate the stepper motor 360 degrees counterclockwise
stepper.setSpeed(200); // Set your desired speed (adjust as needed)
stepper.moveTo(0);
stepper.runToPosition();
delay(1000); // Delay for a moment
}
am I missing anything obvious?
I think 9V batteries can’t produce enough to current for most motors
What about 3x 3r123? i had 2 of the 9v tied together and that didnt help
I don’t know those batteries but you want something with several thousand mAh of capacity. What is the stepper driving? To start I’d recommend having it disconnected from any mechanism so you can check if you can spin it unloaded.
Do you have separate power for the electronics and the motors? How are you generating the 5V for the motor?
I dont have it loaded rn, its got a 1/50 gb built in and it will be driving a 3/5 gear, nothing heavy. I tried both those 9v in multiple config except tying both negative leads and separating pos. the A4988 has a Vmot pin that says 8-35V
sry bad paint
As a general rule, I say lose the 9V battery. Get a LiPo, preferably one with onboard protection circuitry.
Would a 2 cell be enough? that drops my voltage down to 7.4
I would have to be a 11.1 right?
Yeah a 2S might be on the low end (although fully charged it wouldn't be an issue).
I am trying to control a dc motor with l293d motor shield driver for Arduino uno R4 wifi am using adafruit motor shield library v1 but I am constantly getting the error "DC MOTOR PWM RATE" not defined in this scope. I tried googling and reading docs but my code seems to be the exact same as others. The error continues even when I try to run the examples.
I had 3 650mHa lipo cells sitting around so I wired them up in series and made sure all 3 cells were charged and it still wont turn the stepper
Well how big is your stepper?
tiny lil guy, 15mm wide, bi polar, 10ohm coils rated at .25a running at 5v
250mA is quite a bit to pull from the Arduino supply.
but it should be pulling that from the vmot pin on the a4988 thats connected to the batt
How to assign accelerometer motion/direction movement to a keyboard keystroke?
Hey, All…
So, I made some progress this morning. I was able to successfully get an ADXL345 accelerometer working with an Arduino Pro Micro. I attached the video…
My question is, I simply want to have the 4 main values x+/x- and y+/y- assigned to a keyboard keystroke. In this case, the arrow keys.
So, x- would be left, x+ would be right, y- would be down, and y+ would be up.
That way I can assign those keystrokes to an action in my pinball game - for nudging.
Is this pretty straightforward to do?
i am using adafruit motor shield library v1 and i am constantly getting this error
DC_MOTOR_PWM_RATE is in capslock (and used as a default value for a parameter). It could be that the library expects you to #define it
I freshly downloaded the library and tried running the example and I am still getting the error so it's from the library
Plus I think this is the only library that works with this l293d motor driver shield
must be using something other than AVR or PIC? the preproc logic is only setup for those archs. that is an ancient library.
is there a way to find out the calibration data for the raw touch data to the screen coordinates on a 3.5" TFT 320x480.
as i keep getting a Y drift for my touchscreen
Yes, sending keystrokes is very straightforward, and the accelerometer motion appears to be working very well for you already. The only other step besides adding HID keyboard functionality would be to actually define what accelerometer events you want to define as your keystroke input.
Thank you! I’ll do some more reading and going through the code to figure out what value reached#ranges I need to harness for the different directions, and how to assign them. Thanks again.
Hi @heady sparrow! I have questions about your eyelid images "upper.bmp" and "lower.bmp" from https://learn.adafruit.com/adafruit-monster-m4sk-eyes/customizing#eyelids-3037111 I'm trying to recreate some eyelid stuff in CircuitPython and I just cannot get how these two images are supposed to be moving on top of the pupil image. Are they doing more than sliding up & down?
Do FTDI programmers power the atmega chip while programming, right?
Also has anyone tried using one of those 8Mhz "internal oscillator" bootloaders for the atmega328? It removes the need for an external crystal, right? Are they reliable?
Haven't used it with Arduino before, but I've written my own "Arduino-less" code before using the internal OSC. Haven't noticed any issues, but you're definitely missing out on speed.
And yeah, no need for an XTAL
Question:
I got this board now:
https://learn.adafruit.com/adafruit-rp2040-prop-maker-feather/arduino-ide-setup
But when I try to upload a sketch it can't find any board
ah nevermind it was somehow stuck on the wrong port
Hello!
Not sure where to ask this, so i try here:
i have a ESP32-S2 from adafruit, but there are two revisions; B & C sold. How can i tell which one i have?
(i want to turn off I2C during deep sleep and you do the opposite depending on revisions.)
Also: does the "turning off" actually work in deep sleep if i just set it to the inverse before going to sleep. My LED on the I2C device is very dimly on during DS.
bit of a weird question.
my print statements that are in functions or if statements etc. are not showing up in the serial monitor for some reason
Why is there such a long delay?
The store page mentions a revision in 2021 or 2022 that made that change. Could that be revision B?
super weird. what else does your program do? Does it use the other core? Can you reproduce this with as little code and as few libraries as possible?
I'll try - it basically just has an LED ring that plays a sequence. Not much else.
On my arduino uno it works just fine which with the delays
I have a feeling it can't do the delays
actually maybe can't handle multiple print statements?
And another question - how can I store/play sound on it?
Is there an example somewhere for that?
my RP2040 audio player project is kinda on pause right now due to too much other stuff going on. You could use https://github.com/pschatzmann/arduino-audio-tools
It might still have a few bugs. Please @mention me if it works or if you encounter any bugs. Over all I don't like the library that much tbh. But wav-from SD-card and wav-from-progmem (both 16 bit per sample and to I2S output) worked for me a few months ago.
I didn't test https://github.com/earlephilhower/ESP8266Audio but it claims it works and I think it can also do audio output via pwm. And it looks way simpler than arduino-audio-tools.
Theoretically RP2040 has enough power to even decode MP3 but I haven't tried that yet.
There were some bugs in the I2S itself but they should all be fixed now.
I went up to I think 3 lines of 80 characters per millisecond 🤔 or was it the other way around every 2-3 milliseconds one line of 80 characters. Anyway, it was enough to make a certain serial monitor program lag
Thanks I'll try
What I don't yet understand is how to get the mp3 onto the board
#include "AudioFileSourceSPIFFS.h"
#include "AudioGeneratorMP3.h"
#include "AudioOutputI2SNoDAC.h"
AudioGeneratorMP3 *mp3;
AudioFileSourceSPIFFS *file;
AudioOutputI2SNoDAC *out;
void setup()
{
Serial.begin(115200);
delay(1000);
SPIFFS.begin();
file = new AudioFileSourceSPIFFS("/jamonit.mp3");
out = new AudioOutputI2SNoDAC();
mp3 = new AudioGeneratorMP3();
mp3->begin(file, out);
}
void loop()
{
if (mp3->isRunning()) {
if (!mp3->loop()) mp3->stop();
} else {
Serial.printf("MP3 done\n");
delay(1000);
}
}```
For example here
it does not show as a drive for me
Is that arduino-audio-tools?
not sure if SPIFFS works there. Littlefs is the thing where you have a file system on the flash that also contains your program. There should be a tool in the tools menu of the Arduino IDE to upload files to the Littlefs.
And I think you should be able to just use a file source in Arduino-Audio-Tools and give it a file that's on LittleFS 🤔
no the other one.
The arduino-audio-tools would be like this:
#include "StarWars30.h"
uint8_t channels = 2;
uint16_t sample_rate = 22050;
MemoryStream music(StarWars30_raw, StarWars30_raw_len);
I2SStream i2s; // Output to I2S
StreamCopy copier(i2s, music); // copies sound into i2s
void setup(){
Serial.begin(115200);
auto config = i2s.defaultConfig(TX_MODE);
config.sample_rate = sample_rate;
config.channels = channels;
config.bits_per_sample = 16;
i2s.begin(config);
}
void loop(){
copier.copy();
}
I see
ESP8266audio has a midi from littlefs example. https://github.com/earlephilhower/ESP8266Audio/blob/master/examples/PlayMIDIFromLittleFS/PlayMIDIFromLittleFS.ino
Maybe you only have to replace the "SPIFFS" from the SPIFFS-Example with Littlefs 🤔
Arduino library to play MOD, WAV, FLAC, MIDI, RTTTL, MP3, and AAC files on I2S DACs or with a software emulated delta-sigma DAC on the ESP8266 and ESP32 - earlephilhower/ESP8266Audio
you need to select how large of a littlefs you want
same menu where you select the board and port I think
ah the flash size?
yes
ok cool seems to have worked now
Overall flash size has to be the correct for your board of course. But the difference is how much flash for your code and how much for littlefs
👍
and how do I delete it again?
just upload something else again. And set the flash size back to no littlefs to delete it completely
There's also some nuke.uf2 but idk where that just completely deletes everything from the RP2040 flash
hmm.
Uploaded this:
#include "StarWars30.h"
uint8_t channels = 2;
uint16_t sample_rate = 22050;
MemoryStream music(StarWars30_raw, StarWars30_raw_len);
I2SStream i2s; // Output to I2S
StreamCopy copier(i2s, music); // copies sound into i2s
void setup(){
Serial.begin(115200);
auto config = i2s.defaultConfig(TX_MODE);
config.sample_rate = sample_rate;
config.channels = channels;
config.bits_per_sample = 16;
i2s.begin(config);
}
void loop(){
copier.copy();
}
speaker connected to +- as marked on the board
but I got no sound
ok - I tried this example now:
https://learn.adafruit.com/adafruit-rp2040-prop-maker-feather/prop-maker-example-2
Here I get sound (but it's very quiet)
enable debug log of arduino-audio-tools to chekc what's going on
yes
from that example:
pinMode(PIN_EXTERNAL_POWER, OUTPUT);
digitalWrite(PIN_EXTERNAL_POWER, HIGH);
do you have to turn the I2S amp on with some specific pin?
I did but still nothing for some reason
I modified the other code now.
//
// SPDX-License-Identifier: MIT
uint8_t x = 0;
void setup() {
// core1 setup
Serial.begin(115200);
pinMode(PIN_EXTERNAL_POWER, OUTPUT);
digitalWrite(PIN_EXTERNAL_POWER, HIGH);
}
void loop() {
}
// audio runs on core 2!
#include <I2S.h>
#include "boot.h"
#include "hithere.h"
#include "StarWars30.h"
struct {
const uint8_t *data;
uint32_t len;
uint32_t rate;
} sound[] = {
hithereAudioData, sizeof(hithereAudioData), hithereSampleRate,
bootAudioData , sizeof(bootAudioData) , bootSampleRate,
StarWars30AudioData , sizeof(StarWars30AudioData) , StarWars30SampleRate,
};
#define N_SOUNDS (sizeof(sound) / sizeof(sound[0]))
I2S i2s(OUTPUT);
uint8_t sndIdx = 0;
void setup1(void) {
i2s.setBCLK(PIN_I2S_BIT_CLOCK);
i2s.setDATA(PIN_I2S_DATA);
i2s.setBitsPerSample(16);
}
void loop1() {
Serial.printf("Core #2 Playing audio clip #%d\n", sndIdx);
play_i2s(sound[sndIdx].data, sound[sndIdx].len, sound[sndIdx].rate);
delay(5000);
if(++sndIdx >= N_SOUNDS) sndIdx = 0;
}
void play_i2s(const uint8_t *data, uint32_t len, uint32_t rate) {
// start I2S at the sample rate with 16-bits per sample
if (!i2s.begin(rate)) {
Serial.println("Failed to initialize I2S!");
delay(500);
i2s.end();
return;
}
for(uint32_t i=0; i<len; i++) {
uint16_t sample = (uint16_t)data[i] * 32;
// write the same sample twice, once for left and once for the right channel
i2s.write(sample);
i2s.write(sample);
}
i2s.end();
}```
it starts playing the starwars sound now - but has a very loud noise to it
the "hithere" sound is super quiet
When I was playing it previously on my arduino uno + one of these dfplayer sd card boards it was very loud
quietness could be a speaker thing. But i don't know what the dfplayer can handle. That MAX9... can do 3W on 4 Ohm but at 8Ohm it's only like 1,8W or something
I was using the same speaker. On the dfplayer it was like 10x louder than on this new board
Right now it's like someone is whispering
Also tried another speaker - same thing there
I have also tried with this breakout board https://www.adafruit.com/product/2130
the volume is 10x higher when I set it to max
SPeaker says 8ohm 1W
see, i dont know how to tell? well, i guess i can write code to figure out if there aer no visual clues. but what about the deep sleep question, willl it reallly stay off? possibly depending on revision?
@muted gyro actually I tried now the circuitpython approach. Here the volume seems better.
Not sure what I'm doing wrong when using arduino
But now I have to rewrite my whole code 😵
it's really a shame that audio stuff on arduino is not "that great" currently 😭
If we're having technical problems with a specific Adafruit tutorial how do we get help with it? I'm having problems with the https://learn.adafruit.com/adafruit-qualia-esp32-s3-for-rgb666-displays/arduino-rainbow-demo in compiling the Arduino Rainbow Demo. The Adafruit_FT6206.h installed by the Arduino Library manager doesn't seem to have a function to match ctp.begin(0, &Wire, I2C_TOUCH_ADDR).
The adafruit support forums: https://forums.adafruit.com/
Press and hold the BOOT button, press and release the RESET button, then release the BOOT button. That's the sequence that will force any ESP32 into bootloader mode. It can't be overridden in software so if that doesn't cause the device to appear, something is going on with the USB cable or computer OS (or the ESP32 could always be fried but really it's usually the USB cable).
If it appears as CIRCUITPYTHON then it's currently running CircuitPython and the serial terminal would be 115200 not 460800. Are you trying to interact with the CircuitPython REPL or are you trying to flash an Arduino program to it or something else?
So you're trying to talk to the CircuitPython REPL? What are you trying to do?
I would try using a terminal program under Windows outside of the Ubuntu environment in order to test whether the issue is the Ubuntu environment.
Windows using Ubuntu??? Does that mean you are working from WSL (or a W10 VM on Ubuntu)? Bad wording and tried both OSes?
If former (unless you using something usbipd), you may not have access to the device at all
Not what i meant, at all
Answer the question
I usually use PuTTy for this kind of stuff
Unless you need to access it from WSL, that is
I might make a proton pack Neutrona Wand Arduino powered board with the sound board (if it's still being made)
how can I do a delay of the power down so it can play the power down of the Ghostbusters Proton Pack fvrom the sound board?
though the sound board is stand alone - I'm still gonna use an arduino to do the lights and trigger the sounds still
Using the Adafruit Feather 32u4 RFM95 LoRa Radio- 868 or 915 MHz With the Adafruit Ultimate GPS featherwing.
The GPS code for the test from the web page works and the test for the radios works the parsing of the GPS does not work and I cannot combine any part of the GPS code into the message being transmitted.
@fallen gate you'll probably need to post or link to your code, there's no reason the two things shouldn't be able to get combined
Thanks, I'll post my best try
Basically have the power down request not really switch off but just notify the CPU that power down has been requested. Then the CPU can play the sound and actually switch the power off.
I know the adafruit FX board can do it too if it was to be told to play a sound while being powered down
heyo, I'm having this exact issue, did you ever get it to work? or does anyone here have any idea what could be causing this
ah oops sorry I didn't scroll down far enough
Somewhat specific question about SPI. I'm going to try and control a display that uses the SSD1306 chip, and in the datasheet it says that it samples the data/control line every 8 bits to determine how to handle the incoming byte.
When using hardware SPI, does a microcontroller typically generate a clock signal continuously, even when not actually sending any data?
No, the clock should only run while sending data.
Cool. I was worried that I might somehow have to actually keep track of that. I know Arduino has commands for controlling the SPI bus directly, it just didn't seem to have anything for that.
Gonna start with a trinket, but the ultimate goal is to drive this thing with an ATTiny. So I need to skip the library.
Note that SPI is inherently bidirectional, so the CPU does generate a clock to receive data (technically it sends filler data like zeros)
The SSD1306 library that is.
Fortunately to start with, receiving data won't be a problem. The SSD1306 chip can't send data over SPI.
It will be something to worry about once I add an IO expander to this. I should have just enough pins, but it's going to be creative.
Ah, just clock and data, that does simplify things
But first things first, build my own functions to draw directly to the screen using raw SPI commands.
I may be doing the same thing with some anonymous VFDs I picked up cheap on AliExpress.
Curious if anyone has ever used the Adafruit Ultimate GPS module?
https://learn.adafruit.com/adafruit-ultimate-gps
I'm following the guide and it says it'll work with 3.0 -5.5VDC.
I plugged the module into the 3.3V output from my Arduino Uno and it fails to turn on. Works fine and I get GPS signal with the 5V output. This is concerning me because I have a 3.7V battery spec'd for my power supply for this project.
Perhaps I need to configure the board somehow to accept 3V instead of 5?
If you’re powering it with 3.3V but your Arduino is running at 5V (which Unos do) then it’s likely the 3.3V logic levels being sent by the GPS cannot be read by the Uno. Make sure your different devices all agree on the same voltage levels. I’m not sure Unos can run at 3.3V but you could try running both at 3.7V
oh interesting idea. So power the arduino from my battery with the Vin pin on the Uno and then plug in the USB and everything should run at 3.7V?
Wait, this actually doesn't check out. Because the light on the GPS module doesn't come on. So it's not even running
The module itself only turns on when I give it 5V
Im using the Adafruit V3 GPS or the feather they both work for me on 3.7v but I don't know how to send the parsing with the 32u4 LO-RA board
When you say “5V” do you mean the 5v pin from the Arduino or a direct 5v supply? (A wiring diagram would be helpful here). If you’re powering the Arduino entirely from 3.7V into VIN (no USB), there is no 5V on the “5V” pin as that pin is just VIN.
If you're driving the Arduino from 3.7v, and trying to power the GPS from the 3.3v output, I'm going to guess that you're not getting 3.3 off that. Looking up the Uno, it looks like the use the AMS1117 linear regulator for the 3.3 output which has a rated dropout voltage of 1V, and guaranteed not more than 1.3V. So to get even 3V out of it, you need to be providing a minimum of 4, or as much as 4.3.
I'd say stick a multimeter on it and see what you're really getting.
I can't get the parsing to transmit it works without the radio code combined but then all i get is zeros with but then all I get is zeros with the code the Lora code mixed in
Hey all! I originally posted this in #help-with-projects but am asking here per @crystal yacht 's advice
I'm trying to make these firewalker shoes but I'm having so much trouble actually getting the code onto the Gemma (I'm specifically using the v2, not the m0). This is the error I keep getting:
avrdude: Error: Could not find USBtiny device (0x1781/0xc9f)
Failed programming: uploading error: exit status 1
Does anyone know how to fix this? I've never used a Gemma board before so any help is super appreciated!
Check what USB port you're plugging into. According to the product page certain USB3 ports don't work. So I'd start by trying different ports. Does your computer give any indication that it's seen a new device when you plug it in?
If it is a port problem, and you have a particularly new computer, you might not have any USB2 ports. Though I think most manufacturers still put one or two on for low level compatibility.
When I plug my Gemma in, it shows up under "other devices", not on a specific port. I've been following this guide so I've been trying to upload the code with the USBtinyISP programmer: https://learn.adafruit.com/introducing-gemma/setting-up-with-arduino-ide
So far, my computer can always tell when one is plugged in but actually uploading the code has been weirdly hard 😅
And the red LED is pulsing when you try?
Yeah so I'm not sure why it isn't uploading
Sounds to me like you need the USB driver computer Windows 10 or newer
I just bought these chainable NeoPixels which are addressable. I've written Arduino code to control an LED light strip before, but it isn't clear to me how to program each individual pixel in this setup. Is it something I am just overthinking? The general NeoPixel tutorial I believe was more helpful for strips. I don't get the LEDs until Tuesday so I am trying to plan what I can:
Better grab some sunglasses, sunscreen, and a bucket hat because these NeoPixels feature a 4W RGBW Cool White LED and are so bright it's like taking a vacation ON THE SUN.Alright, ...
1 strip with 100 LEDs == 100 "strips" with a single led each. (As long as the signal is wired in series)
I hope it is haha. I think it is as that's the point of this model, I think, but I have a ton to learn.
How do I modify the arduino compiler call string? I want to enable LTO on the feather M4 CAN (gcc 9)
https://learn.adafruit.com/adafruit-neopixel-uberguide/arduino-library-use
see setPixelColor()
Has anybody been able to get the 32U4 to transmit the latitude and longitude from GPS feather because only the tests from the web page work none of the libraries for the Arduino GPS will work no parsing the only parsing I got to work was from somebody else's tiny GPS off YouTube had nothing to do with the Adafruit there's no examples of how the radio reads from the GPS serial instead of it reading from its own Sereal it appears to me that the feather shares pin one with the radio they say they use separate serial codes and it doesn't matter but I've never got them to work in combination
The USB implementation on the V2 isn't hardware USB, but a software emulation of USB that isn't fully compliant. It worked more or less with older computers with looser specifications, but modern computers generally don't work. It has been suggested to try a USB2 hub which might help. My approach is to use an old computer I keep around for talking to older hardware.
I haven't tried it, but you might need to figure out which pins the serial data from the GPS are on, and what serial device on the 32U4 that matches. If it doesn't match, you could either use SoftwareSerial or some wiring to rearrange the pins.
That makes sense. I've tried a USB 2 hub but it still hasn't worked. I'll have to see if I can find an older computer to use
For LED strips, I frequently have to use a separate power source. The set I just bought uses 4 watt LEDs and I have 8 of them, which apparently requires 4 amps of power. That is obviously too much for an Arduino Uno. Are there are any boards, Arduino or not, that can output that much power without needing a separate power source? It would make my setup cleaner.
Not really: microcontrollers are not power supplies. The usual approach is just use a hefty power supply and use it to power the LEDs and the microcontroller.
Power needs to come from somewhere. Your PC's USB ports are only required to output 500mA at 5V. Some can just do 5V 2A. (For example my monitor has a single "charging" USB port that can do 5V 2A)
... and in some cases the current listed is shared across multiple ports.
WLED is an open source LED controller based based on ESP32. I've seen some dedicated hardware for it. If those are just "shields" for ESP32 modules, then I'm sure you could use them with Arduino (ESP32 Arduino core) as well. Might make wiring simpler. (But you still need a proper PSU for it of course)
I did order two of the Adafruit Feather M0 with RFM95 LoRa Radio - 900MHz - Radios so hopefully the code will work with those
Trying to run a BLE sketch with an esp32-s2 tft feather and it says Bluetooth is not enabled. Anyone point me at anything to help get it up and running.
The ESP32-S2 doesn't have actually have Bluetooth - it's the only ESP32 available so far that doesn't
It was pretty reasonable to assume it did have Bluetooth. Sorry to have been the bearer of bad news.
I was thinking it might be because the S2 is single core and added native USB support, but Espressif sells slower single core ESP32s with even less RAM that still support WiFi, USB and Bluetooth so I don't think that's the reason.
hi all! I'm testing Arduino on my ESP32-S2 Feather, and I can't get the WifiClient test from https://learn.adafruit.com/adafruit-esp32-feather-v2/wifi-test to work. I was able to get a network trace from my router, and I can see the Feather is making it out to the internet, but the Adafruit server doesn't respond. I feel like I'm going crazy. I've even tried modifying the code slighty to match what I've seen curl doing.
client.print("GET "); client.print(path); client.println(" HTTP/1.1"); client.print("Host: "); client.println(server); client.println("Accept: */*"); client.println("User-Agent: curl/8.0.1"); client.println(); }
Any ideas?
If you have a network trace, what does it look like in WireShark? Can you upload it here so I can take a look at it. Being able to see "what's on the wire" is a fundamental of debugging network issues. WireShark has been an essential part of my toolbox for years now, I can't get by without it.
Also just for giggles and grins, try adding the following:
client.println("Content-Length: 0");
just after the "User-Agent" line. Not specifying a Content-Length, even when it's zero, can make it a bit harder for the server to know when to respond.
Hey all! I'm still having trouble with avrdude. I tried using a USB 2 hub and am working on an old laptop but I'm still getting this error:
avrdude: Error: Could not find USBtiny device (0x1781/0xc9f)
Does anyone have other ideas I could try?
You can use ISP programming to flash the code. It's less convenient, using a separate programmer (which can be a second Arduino) to talk to the chip directly.
If you have a network trace, what does
Hey I'm trying to get my esp32 dev kit to advertise as a midi device over usb/lightning to my ipad. Is such a thing possible? I have this code flashed to it, but nothing is coming up when I connect it to the iPad: https://github.com/chegewara/EspTinyUSB/blob/master/examples/host/msc/msc.ino
I'm attempting to monitor with midimittr and midi wrench. I know very little about midi so I'm worried apple does some shenanigans that make it more complex/impossible.
I mean, midi devices do work with iPads over usb, so it should be possible, right?
Unless they have to be whitelisted or a certain chip has to be whitelisted or something?
Or do I have to advertise it in a certain way? I really know very little about how midi works.
How do I setup software serial for rx and TX on a qt py 2040? Im looking at an example for a non adafruit Lib that uses it and they use just numbers for the pins but the 2040 guide says TX is available as PIN_SERIAL2_TX
Can I just use 20 and 5 since those are the numbers for TX and RX per the diagram?
Also I'm trying to use the vl53l1x with the stemma qt cable but am running into issues with Wire, I think. How can I make it use the proper pins?
Yes, using esp32 PIN numbers should work
Thabks
What are you expecting to see from it? It's executing the application - those messages are from the application's startup code.
I was hoping to get the serial output. This sketch was just making sure I can connect to wifi with it. It has serial print statements saying what its doing
Someone might be able to help if you share the code. But the output you shared indicates the second stage bootloader was successfully loaded from flash and that it successfully loaded the application and jumped to it.
I'll post the code once I'm back at my computer!
I usually use the Adafruit_TinyUSB_Arduino library as it isn't chip-dependent. Here's a USB MIDI example that I just tested on an ESP32S2 Feather: https://github.com/adafruit/Adafruit_TinyUSB_Arduino/blob/master/examples/MIDI/midi_test/midi_test.ino
Question:
What do they mean by Effective Rotational Angle(typ.) 333.3° here?
https://www.murata.com/en-eu/products/productdetail?partno=SV01A103AEA01B00
Murata Official product details information. Here are the latest datasheet, appearance & shape, specifications, features, applications, product data of Rotary Position Sensors SV01A103AEA01B00.Specifications:Operating Temperature Range=-40℃ to 85℃,Shape=SMD,Total Resistance Value=10kΩ,Total Resistance Value Tolerance=±30%,Linearity=±2%,Effective...
What happens if I rotate to for example 350°?
It’s got stops like any other pot, I think
If it doesn't have a stop, that means that if you turn it past the end of the resistive element, the wiper goes open circuit until it reaches the other end
Thanks a bunch. Do you expect this will be recognized by an iPad?
Yep it will be recognized by an iPad. It’s a USB class device.
Thanks a million
Or could I even use the LIS3DH Triple-Axis Accelerometer on my RP2040 propmaker to detect rotation?
Rotation on Z axis (laying flat on the table)
There are multi-turn potentiometers available. But if you want continuous rotation, a potentiometer based solution may not be your best bet.
Continuous would be preferred
Or maybe I have to use a gyro instead?
I don't think I can use one of those magnet angle sensors because I have a speaker nearby
You could use a rotary encoder to get a full turn
The magnetic ones are pretty robust, it may not be a problem. You can always put magnetic shielding (like an iron or steel sheet) between them.
Is the new MAX battery chip more reliable than the LC709203F? I'm getting Couldnt find Adafruit LC709203F? a few times now using Aruino on my ESP32-S2 Feather with BME280. I do have to reset the device a lot more which I assume is why it's happening more frequently than it did with CircuitPython.
Does the SAMD51 microcontroller not support servo motors? I can't get the servo library to compile for the SAMD51.
I'm trying to use the ServoFirmata library on a pybadge board.
It can always be that specific libraries don't work on specific architectures. Especially when they use low-level platform-specific features/hardware. But maybe you can find a different library providing the same (or similar) features that does work
For example, on AVR I think servos are handled by the timer hardware. On RP2040 servos are handled by PIO. Both are very different low-level platform-specific features. So you can't just take such a low-level configuration from one platform and use it on another. In this case, the library has to specifically support the hardware
@open hemlock I think it may be a little quirkier, not sure specifically why it wouldn't behave on ESP32-S2
Please note this chip uses I2C clock stretching, on Raspberry Pi Zero/1/2/3 you will need to slow down the I2C port.
https://www.adafruit.com/product/4712 (ESP32-S3 has an issue with I2C https://github.com/adafruit/circuitpython/issues/6311)
Oh, that's unfortunate. It looked like it would be a lot of work to update firmata to work with the SAMD51 then.
Thanks, under CircuitPython I saw only very rare I2C problems. I suppose I almost never had to reset the board with CircuitPython. But twice today it was happening, and the last time it was "stuck" saying "not found" even if I left it unplugged for 30 minutes. But I added Wire.setClock(100000) to my code based on a post with someone with an RP2040, and then it worked right away.
But that appears to have slowed down my humidity/temp data collection by 500ms!
Like this AS5600?
My speaker but be placed directly below it
It could work with a speaker if its magnetic field is aligned to the encoder’s rotational axis. The alternative would be an optical encoder, which would be completely void of any magnetic fields, but have its own added complexity.
For using a VL6180 time of light sensor, I am having issues detecting the sensor when it is connected to an external 5V power supply, as opposed to the 5V output on an Arduino Uno Rev 3. When connected to the internal Arduino 5V power supply, the sensor works just fine. When connected to an external 5V supply, the sensor is not able to be found. The voltage of the external supply has been measured between 4.98-5.07V. Any help would be much appreciated.
Can you say more about how it's connected? Are you saying that the sensor and the Arduino are connected to separate power supplies? If they are, is ground connected between them both?
Of course thank you.
We were powering the Arduino using the serial cable. And trying to run the sensor using the external supply. I thought the lack of a shared ground could be an issue, so I connected the ground of the power supply to the ground pin of the Arduino. The sensor was we still unable to be found. Is that the proper way to connect the grounds?
Grounds definitely have to be connected. They provide a reference point for the voltage. Any ground lead on the power supply can be connected to any ground lead on the Arduino.
When you say you're powering the Uno using the serial cable do you mean USB?
Why are you choosing to power the VL6180 separately? It's a low power chip, drawing only 350µA at 2.8V. It shouldn't need an independent power supply.
Is there any way to know ahead of time how big variables are in memory? I think I just got tripped up when porting a project from an M0 based board to an ATTiny. At first I thought I was just running out of memory entirely, but now it looks like I may just be overflowing some specific variables.
It seems that the functions I'm having problems with are using 65536 stored to an int. On the M0 they all ran fine, but crash on the Tiny. Digging into it I do find one page from Arduino that says that on SAMD chips ints are 4 bytes, but only 2 on AT chips.
Is there any good source for this information? They don't seem to mention anything about other types.
Oh, and I can't use sizeof() since I have no text output from this project.
sizeof() isn't limited to strings
Oh wait you mean you can't get the output from sizeof?
Yeah. No display, no serial monitor.
got it
Maybe I should rework the hardware test to do it. Yay diagnostic LEDs.
Rather than int and long we often use specific types like int32_t or uint64_t to ensure that code will work correctly when run on CPUs with differently sized fundamental types. Then we'll use a header file that uses typedef to map int32_t to the correct type for the CPU you're building for. Then you don't have to worry about whether 65536 will fit in an int.
I think all Arduino platforms should provide this but it's possible that it's just a convenience that I've taken for granted in the ones I work with.
I keep getting this error when trying to compile neopxl8 code for my esp32-s3 board. Any ideas as to how to fix it?
Useful information for future projects I guess. For the moment I think I'm just going to convert what I need to longs or uint16 and reduce the number by 1. It's not a big project, and losing 1 from the color range is insignificant.
You might try turning up warning levels on the compiler. It should at least complain if you try to assign a constant to a variable that it won't fit in.
Yep. Looks like it does.
Unfortunately fixing this requires retyping a whole load of variables.
Eh. Not too big of a deal I guess.
Yes I meant the usb.
I am trying to power the sensor externally because eventually everything will have to be connected to an external power source, including the Arduino.
I’ll do some further tests with the common ground. Appreciate the tips!
I would try powering both the Arduino and the sensor off the external power source and see if it works... good luck.
I found a few more old computers lying around and tried uploading the code from those with no luck. I've never used ISP programming before. Do you have a good tutorial I can follow?
Here's one that may help, it targets the ATtiny85 (the CPU powering the Gemma): https://fotografeer.nl/index.php?/tags/attiny85/
Do these kiind of "flat" speaker exist in bigger sizes?
Without the bump in the back
~70-80 mm diameter
~5mm height
On Mouser in their speaker section and clicking on the filters, for 5-6mm depths, the largest diameter is 45mm: https://www.mouser.com/c/electromechanical/audio-devices/speakers-transducers/?depth=5 mm~~6 mm&diameter=45 mm&product=Speakers~~Transducers&rp=electromechanical%2Faudio-devices%2Fspeakers-transducers|~Product|~Depth
Typically, a larger diaphragm requires a larger coil to drive it, so getting a speaker in that size will generally require some space underneath for the larger coil.
You might be able to find a piezo speaker with thinner proportions, but be prepared to pay a premium for them. https://store.miscospeakers.com/4-inch-wide-range-speaker-piezoelectric-93124
The MP-1103 is now available for customers looking for individual packaging. This all-weather, ultra-lightweight speaker is ideal for voice or alarm applications. Designed for the military, it is so lightweight it can be worn. The phenolic cone and plastic housing helps prevent moisture absorption, especially useful in highly humid locations. I...
There are speakers aimed at laptop manufacturers and model railroad builders that are in a variety of shapes and sizes. The laptop ones sometimes show up at attractive prices on the surplus market.
that's the one I have currently 😄
I've been sitting here for an hour trying to drive this display manually.
No wonder I haven't gotten anywhere. There's a heck of a lot more setup than I though.
At least I've managed to dig into the library and find how Adafruit configures it.
I had to do that with one chip that had an undocumented configuration block that could only be created by a DOS-only program I couldn't run. I just cribbed the config block from the AdaFruit driver and decided not to do business with that chip vendor in the future.
I blame the fact that the datasheet makes it sound simple.
It's like, 4 steps and two of them are about applying power.
Apply power to chip, wait for power to be stable.
After power is stable, reset chip.
After reset, apply power to display.
After display power is stable, send on command.
Well. That may look like a load of garbage to the untrained eye, but it is in fact a near complete success.
Arduino ide appears to be showing warnings as errors (multiple of the same warning for a library, says some warnings treated as errors), but I appear to have the most permissive compiler warnings setup. How can I fix this?
Ide 2.2.1
the BSP sets those, so would need to change files there
What's the BSP? And is that possible?
Board Support Package
so you'd be editing files generally not meant to be user modified
what board is this for?
Hmm OK. Rp2040
Here's the errors
Sorry for photos wifi down
If I wanted to edit the library, could I have the methods return something rather than nothing?
I'm using the earl philhower core
yep. that'd be an easy way to fix that.
and the generally better approach - i.e. fix the library, not mess with the BSP
arduino-pico has problems with a few libraries because its compiler is too new 😆 Some NFC library relies on a compiler bug that is now fixed so it doesn't compile any more
What should I have the functions return at those lines? It's been suggested elsewhere to return -1,but what if the function has some special return type?
can you link to repo with the roboclaw library code?
could just return 0, but worth looking at code to see if there are reasons to be fancier
looks like it's trying to protect against softwareserial
and sort of saying only AVR supports it
you're using hardware serial with the pico?
Serial1 = 0 and 1, Serial2 = 8 and 9
Oh I'm connected to rx and TX on the board
np. one sec. ignore above about pico pins.
looks like those end up being Serial2
and would be hardware serial
OK so if I don't have software serial in my code, will it skip this issue?
it won't
OK so
int RoboClaw::peek()
{
if(hserial)
return hserial->peek();
#ifdef __AVR__
else
return sserial->peek();
#endif
return 0;
}
ah ok I was about to post htat
ok thank you
worth it to pull req the repo?
and if I just edit the code on my machine, will it compile directly?
i'd open an issue first. the code above is a hack.
ok
this did not work
something may be cached?
Hm om
try adding an intentional syntax error and see if it gets flagged
What does that mean in this context?
need to verify the updated library is being compiled, and arduino is not using a previously compiled file
I would git clone the library into the /lib (I think) directory inside the project and remove the dependency from the platformio.ini
(though you could also put the library inside a random folder on your PC and add something to the platformio.ini to tell it to use the version from that folder but I forgot the command for that)
Ah OK. I'll Google that
Thank you all
I I'm not using platform IO does that matter
ah sorry then I don't know
lol you've literally written "Arduino ide appears to be..." 🤦♂️ me
No stress, thanks
But similar idea maybe... Isn't there a way to put a library inside the sketch folder? At least with the new arduino IDE 2🤔
How do i Use HW serial in this instance?
would it be
Serial2 serial;
RoboClaw roboclaw = RoboClaw(&serial, 10000);
?
RoboClaw roboclaw = RoboClaw(&Serial2, 10000);
nice thanks
remove this line:
Serial2 serial;
Here's my current code and what I'm working on
#include <SoftwareSerial.h>
#include <RoboClaw.h>
#include <Adafruit_VL53L1X.h>
#pragma
Adafruit_VL53L1X vl53 = Adafruit_VL53L1X();
float Kp = 17.37; // prop gain
float Ki = 0.0; //integral gain
float Kd = 182.4; //deriv gain
int qpss = 7775; //quadrature pulses per second
int address = 128; //address of roboclaw
int16_t distance = 710; //Number of encoder pulses to turn.
int16_t up_speed = 200; //Number of encoder pulses per second on upswing
int16_t up_accel = 500; //Time rate of change of up_speed
int16_t down_speed_fast = 100;//speed down when moving out of view
int16_t down_speed_homing = 35;
int16_t down_accel_fast = 200;
int16_t down_accel_homing = 1000;
bool zero = false;
RoboClaw roboclaw = RoboClaw(&Serial2, 10000);
void setup() {
Serial2.begin(115200);
roboclaw.begin(115200);
roboclaw.SetM1PositionPID(address,Kp,Ki,Kd,qpss,0,0,0);
vl53.setTimingBudget(15);
vl53.startRanging();
Serial.println("before serial delay");
while (!Serial2) delay(10);
Serial.println("After serial delay");
Wire1.begin();
while (!zero){
Serial.println("Starting zeroing");
if (vl53.dataReady() && vl53.distance() > 50){
roboclaw.SpeedM1(address,50);
Serial.println("Zeroing");
}else{
zero = true;
roboclaw.SpeedM1(address,0);
roboclaw.SetEncM1(address,0);
Serial.println("Zeroed");
}
}
}
void loop() {
}
atm I'm not reaching
Serial.println("before serial delay");
so I'm trying to figure out why
Serial2 is defined in the BSP, can just be used directly
#include <SoftwareSerial.h>
remove since you are not using software serial
#pragma
this is doing nothing, can also remove
Serial2.begin(115200);
remove this line, the library does this
while (!Serial2) delay(10);
remove this line. in general, sketch code should not use Serial2 directly
why can I not deploy to my qt py twice in a row? Do I always have to reset it before each load?
Wire1.begin();
remove this line. the VL53L1X library will do this
you aren't calling Serial.begin()
Here's what I have now
#include <RoboClaw.h>
#include <Adafruit_VL53L1X.h>
Adafruit_VL53L1X vl53 = Adafruit_VL53L1X();
float Kp = 17.37; // prop gain
float Ki = 0.0; //integral gain
float Kd = 182.4; //deriv gain
int qpss = 7775; //quadrature pulses per second
int address = 128; //address of roboclaw
int16_t distance = 710; //Number of encoder pulses to turn.
int16_t up_speed = 200; //Number of encoder pulses per second on upswing
int16_t up_accel = 500; //Time rate of change of up_speed
int16_t down_speed_fast = 100;//speed down when moving out of view
int16_t down_speed_homing = 35;
int16_t down_accel_fast = 200;
int16_t down_accel_homing = 1000;
bool zero = false;
Serial2.setRX(5);
Serial2.setTX(20);
Serial2.begin(115200);
RoboClaw roboclaw = RoboClaw(&Serial2, 10000);
void setup() {
Serial.begin(9600);
roboclaw.begin(115200);
roboclaw.SetM1PositionPID(address,Kp,Ki,Kd,qpss,0,0,0);
vl53.setTimingBudget(15);
vl53.startRanging();
Serial.println("before serial delay");
Serial.println("After serial delay");
while (!zero){
Serial.println("Starting zeroing");
if (vl53.dataReady() && vl53.distance() > 50){
roboclaw.SpeedM1(address,50);
Serial.println("Zeroing");
}else{
zero = true;
roboclaw.SpeedM1(address,0);
roboclaw.SetEncM1(address,0);
Serial.println("Zeroed");
}
}
}
void loop() {
}
that gives me
24 | Serial2.setTX(20);
Compilation error: 'Serial2' does not name a type; did you mean 'SerialUSB'?
Serial2.setRX(5);
Serial2.setTX(20);
Serial2.begin(115200);
remove these lines
I don't need to set RX and TX?
no
what about resetting the board every time?
see if you can duplicate that behavior uploading a basic blink example, to rule out it being something with the sketch interfering with soft reset
OK. why might I not be seeing print messages?
#include <RoboClaw.h>
#include <Adafruit_VL53L1X.h>
Adafruit_VL53L1X vl53 = Adafruit_VL53L1X();
RoboClaw roboclaw = RoboClaw(&Serial2, 10000); // HW serial on Qt PY RP2040 is Serial2
void setup() {
Serial.begin(9600);
while (!Serial);
Serial.println("RoboClaw Test.");
if (!vl53.begin()) {
Serial.println("Could not start VL53L1X.");
while(1);
}
Serial.println("VL53L1X started.");
roboclaw.begin(115200);
Serial.println("RoboClaw started.");
}
void loop() {
}
try that as a basic example
guessing VL53L1X init will fail, if its connected via STEMMA QT
Made it to roboclaw test
no serial output after that?
nope
weird. the vl53 being must be hanging?
how is the VL53L1X connected to the QT PY?
Its still doing the "need to reach boot or I can't reach you" thing too
Will try above
oK got to roboclaw started
Does this make sense?
while (!zero){
Serial.println("Starting zeroing");
if (vl53.dataReady() && vl53.distance() > 50){
roboclaw.SpeedM1(address,50);
Serial.println("Zeroing");
}else{
zero = true;
roboclaw.SpeedM1(address,0);
roboclaw.SetEncM1(address,0);
Serial.println("Zeroed");
yeah I have that above
zeroing loops seems OK as a first pass. can try it and see how it plays with actual hardware.
It doesn't seem to do anything. I don't get into the first print stateent
put a serial print before and after the while (!zero) loop
Serial.println("Zeroing...");
while (!zero) {
// stuff
}
Serial.println("Done.");
I had a call to the roboclaw before begin
I trying again
I sure miss drag and drop heheh
I'm repeatedly timing out while flashing
what could cause that?
not sure
OK what about failing to secure a serial connection?
which one?
could be switching COM ports because its left open?
try closing serial monitor before uploading
ok
Yeah still timing out
Here's my code
#include <RoboClaw.h>
#include <Adafruit_VL53L1X.h>
Adafruit_VL53L1X vl53 = Adafruit_VL53L1X();
RoboClaw roboclaw = RoboClaw(&Serial2, 10000); // HW serial on Qt PY RP2040 is Serial2
float Kp = 17.37; // prop gain
float Ki = 0.0; //integral gain
float Kd = 182.4; //deriv gain
int qpss = 7775; //quadrature pulses per second
int address = 128; //address of roboclaw
int16_t distance = 710; //Number of encoder pulses to turn.
int16_t up_speed = 200; //Number of encoder pulses per second on upswing
int16_t up_accel = 500; //Time rate of change of up_speed
int16_t down_speed_fast = 100;//speed down when moving out of view
int16_t down_speed_homing = 35;
int16_t down_accel_fast = 200;
int16_t down_accel_homing = 1000;
bool zero = false;
void setup() {
Serial.begin(9600);
while (!Serial);
Serial.println("RoboClaw Test.");
vl53.setTimingBudget(15);
vl53.startRanging();
roboclaw.begin(38400);
roboclaw.SetM1PositionPID(address,Kp,Ki,Kd,qpss,0,0,0);
Serial.println("RoboClaw started.");
while (!zero){
Serial.println("Starting zeroing");
if (vl53.dataReady() && vl53.distance() > 50){
roboclaw.SpeedM1(address,50);
Serial.println("Zeroing");
}else{
zero = true;
roboclaw.SpeedM1(address,0);
roboclaw.SetEncM1(address,0);
Serial.println("Zeroed");
}
}
}
void loop() {
}
vl53 init missing
no, sry.
OK! Made progress. Here's what I've got so far, my motor is not moving
#include <RoboClaw.h>
#include <Adafruit_VL53L1X.h>
Adafruit_VL53L1X vl53 = Adafruit_VL53L1X();
RoboClaw roboclaw = RoboClaw(&Serial2, 10000); // HW serial on Qt PY RP2040 is Serial2
float Kp = 17.37; // prop gain
float Ki = 0.0; //integral gain
float Kd = 182.4; //deriv gain
int qpss = 7775; //quadrature pulses per second
int address = 128; //address of roboclaw
int16_t distance = 710; //Number of encoder pulses to turn.
int16_t up_speed = 200; //Number of encoder pulses per second on upswing
int16_t up_accel = 500; //Time rate of change of up_speed
int16_t down_speed_fast = 100;//speed down when moving out of view
int16_t down_speed_homing = 35;
int16_t down_accel_fast = 200;
int16_t down_accel_homing = 1000;
bool zero = false;
void setup() {
Serial.begin(9600);
while (!Serial);
Serial.println("RoboClaw Test.");
vl53.begin(VL53L1X_I2C_ADDR, &Wire1);
vl53.setTimingBudget(15);
vl53.startRanging();
roboclaw.begin(38400);
roboclaw.SetM1PositionPID(address,Kp,Ki,Kd,qpss,0,0,0);
Serial.println("RoboClaw started.");
roboclaw.SpeedM1(address,50);
I'm going to try to read something from the roboclaw to verify that I am talking to it
OK I can read the encoder
Let me see if the speed was just too small
Hello Ppl!
Can i use Arduino UNO R4 WiFi and The Adafruit IO lib? How can one tell that i can use the (any) board with for example AdafruitIO_WiFi.h? et al...
My best guess is that you can use it, but you might have to manually set a flag.
Ultimately there's no harm in including the library, adding a few commands, and then trying to compile it for the target board, even if you don't have it or your code wouldn't do anything useful. That alone should generate errors if the library's incompatible.
My logic for "you should be able to use it" is based on the fact that the Uno R4 Wifi uses the RA4M1 microcontroller. A Cortex M4 based chip. The Adafruit Metro M4 uses a chip based on the same Cortex M4 core, though more powerful. (120MHz vs 48)
My general advice with the uno r4 is to see https://github.com/arduino/uno-r4-library-compatibility
Contribute to arduino/uno-r4-library-compatibility development by creating an account on GitHub.
It doesn’t include everything, but should cover most typical use cases.
Anything higher level than this probably has one or more library dependencies in this list. If they all pass here, I don’t expect any issues with compatibility.
well, nothing with Wifi? if i read it correctly?
WiFiEspAT looks like a good candidate.
IIRC the Wi-Fi module on the R4 Wi-Fi is an esp32.
yep, ESP32-S3
I'm sure this might be a dummy question but why does this run every second instead of much faster?
My first thought goes to what clock frequency are you compiling for, and do you actually have to set the frequency in the chip manually?
this is on the pico, I think I'm stepping on the serial line and it's causing the delay
Ah, yeah, anything about clocks would be irrelevant there. Well, not irrelevant, but the issue I'm thinking of wouldn't be a thing.
Probably
seems like my if message just takes 1 second 😬
Since you're initializing the USB serial, I'd suggest tossing a debug message out there and see what the serial monitor shows. See if your loop really is running every 10ms or not.
If it is, then you've probably got a transmission problem. If it isn't, then you actually do have a clock problem, though I'm not sure how.
hmm readStrting() vs read()
Interesting. I suppose I don't know enough about read vs readString to say.
Ohh... This might do it.
Serial.readString() reads characters from the serial buffer into a String. The function terminates if it times out (see setTimeout()).
And yep, checking into setTimeout, "It defaults to 1000 milliseconds"
🫡 🤦♂️
Take note though, serial.read gets you only a single byte with each use.
how do I override thge set timeout?
thank you!
Hey, when I'm at the point in my project where I want to go from my esp32 devkit to printing a pcb, is there a good and convenient way to do that? Specifically I'm wondering if there are like pcb templates that sort of duplicate the functionality of the devkit that I can work from instead of rebuilding that part myself.
Or is there an intermediate step I should do in between, like upgrade to a more professional dev kit? Or do they provide a schematic, then I duplicate what I need off of it?
My main concern is just not making it harder on myself than is necessary
Adafruit designs are open source and they have a few ESP32 boards
@viral prawndepending on what the device will do you might get away with just using one of the feather form factor boards. Unless you want to run a special sensor on the board or do a mass production run you don't really need to design your own board.
But making a board based off an adafruit design is a good idea because their designs are very good.
I'm considering switching to PlatformIO for MCU development, however I'm a litle puzzled about something. I did a pio boards and went searching through the output for the RPi Pico W I'm using for one project. Nothing for the Pico W, only the regular Pico, Is the W supported in PlatformIO? That's a bit of a drop-dead show-stopper if it isn't.
that's a loooong story with a lot of drama...
First, there are two "competing" arduino cores for RP2040. The official arduino-mbed one and the unofficial (but good) arduino-pico by earlephilhower. The official arduino-mbed one only has board definitions for Pi pico (without w) and the Arduino nano rp2040 connect. On the Pico w not even the blink builtin led example works. On the other side, Arduino-Pico has board definitions for everything. And full Pi pico w support. Afaik it's the one that adafruit recommends and writes their arduino libraries for. I bet you were already using this arduino-pico core in the Arduino IDE.
The "raspberrypi" platform in the platformio registry only supports the official arduino-mbed core. I would not expect any updates to that platform by anyone (except updates to the latest arduino-mbed core.)
There is a pull request that's been stalled for over 2 years now due to company politics. That pull request adds support for arduino-pico, and debugging.
You can still use arduino-pico with platformio, just not from the registry. Here's the guide: https://arduino-pico.readthedocs.io/en/latest/platformio.html
over all the Platformio integration of arduino-pico works really well
hey, I was uploading a sketch and then it wouldn't reboot. I did the ESPTool web flasher and then the board booted back up happily. But I uploaded my sketch, everything compiled and uploaded... But I got what appeared to be a different sketch output. I tried uploading an LED blink sketch and now it won't boot normally again, so I assume I need to re-flash the firmware again ...
Does that mean my local Arduino install is corrupt? Or is my board dying?
Yeah it's for work and there we are planning on tens of thousands of boards being produced so we would just like to design our own board around the esp32 chip. I already have written prototype code and prototyped around the esp32 dev kit from expressif. We have an electrical engineer in house who will inevitably handle this, I just wanna see how much I can do myself before then and print up some pcbs to build my own hopefully.
Curious what folks think of this issue. I think it's my code but I'm not sure: The issue is under the creation of buffer1 and buffer2, where I have the while while (buffer1 != 128) logic. I never leave that while loop despite printing 128 repeatedly.
void loop() {
int now = millis();
int up_time = 3000;
int down_time = random(2500,6000);
uint8_t buffer1;
uint8_t buffer2;
roboclaw.SpeedAccelDeccelPositionM1(address, up_accel, up_speed,up_decel , distance, 1);
roboclaw.ReadBuffers( address, buffer1, buffer2);
while (buffer1 != 128){
roboclaw.ReadBuffers(address, buffer1, buffer2);
Serial.println(buffer1);
}
while(now - millis() <= up_time){
continue;
}
roboclaw.SpeedAccelDeccelPositionM1(address, down_accel_fast, down_speed_fast,down_accel_homing , 75 , 1);
while (buffer1 != 128){
roboclaw.ReadBuffers(address, buffer1, buffer2);
}
while(now - millis() <= down_time){
continue;
}
}
buffer1 is supposed to be equal to 128 when the task is finished.
Here's my serial monitor
Hello, I am working with the Itsy Bitsy nRF52840 Express - Bluetooth LE. The guide Im looking at says to put the white DI cable into the 5V+ through hole. Someone on the forum said that wasn't correct but theyve stopped responding. Can anyone tell me where its supposed to go?
I will also note I am trying to make it not a closed loop. Id like for the circuitry to be on one end of the neopixel
Nope. The DI (Din) pin on the led strip connects to data pin 5 on the itsy-bitsy, not the 5v. supply. It's a little confusing because both have the number '5' in them. Give me a sec and I'll dig up the pinout of the board to tell you exactly where it should go.
Thank you!
Hang on a sec. The pin that's labelled 5**!** on the board is the Vhi output that you use for the power supply. I don't see a general output pin number 5. I'd suggest switching this over to #help-with-circuitpython since the provided code is written in CircuitPython. If I were doing this, I'd just look into changing the pin number at this point in the CP code:
from adafruit_bluefruit_connect.color_packet import ColorPacket
from adafruit_bluefruit_connect.button_packet import ButtonPacket
# NeoPixel control pin
pixel_pin = board.D5 # <<<<< Chasnge this to some other pin
# Number of pixels in the collar (arranged in two rows)
pixel_num = 24
but you'd want to talk with the folks over in the CircuitPython channel to get a correct relationship between the pin number in the code and the physical pin on the board.
Will do. Thank you
The way loop() is written there's nothing to indicate that you've left either while loop. After it gets through both of them it'll just start the first one again since it's in loop(), you'll just keep seeing the messages.
I'd add more debugging messages to make it more clear what's happening in the control flow. For instance:
void loop() {
int now = millis();
int up_time = 3000;
int down_time = random(2500,6000);
uint8_t buffer1;
uint8_t buffer2;
roboclaw.SpeedAccelDeccelPositionM1(address, up_accel, up_speed,up_decel , distance, 1);
roboclaw.ReadBuffers( address, buffer1, buffer2);
Serial.println("starting first while loop");
while (buffer1 != 128){
roboclaw.ReadBuffers(address, buffer1, buffer2);
Serial.println(buffer1);
}
Serial.println("completed first while loop");
while(now - millis() <= up_time){
continue;
}
roboclaw.SpeedAccelDeccelPositionM1(address, down_accel_fast, down_speed_fast,down_accel_homing , 75 , 1);
while (buffer1 != 128){
roboclaw.ReadBuffers(address, buffer1, buffer2);
}
Serial.println("completed second while loop");
while(now - millis() <= down_time){
continue;
}
}
Quick PlatformIO question. I'm making the transition from Arduino IDE to PlatformIO, and have run into one minor issue.
I get the general case that libraries are not supposed to be global, and I understand their motivation to have libraries work on a per project basis. For all the stuff f I D/L from the web that makes perfect sense.
However, there is one library I have that does want to be in the Global Library store. It's a small collection of utility functions that I have written myself over the years that gets included in every project I write. Installing that on a per project basis will turn maintenance of that specific library into a nightmare, because if I fix a bug, or make an improvement, I'll need to do it ten or fifteen times, since I have that many projects on the go at once.
So, how do I set about putting a single .cpp and the corresponding .h file in the global library store in PlatformIO?
There may be a proper answer to your specific question, but the way I’d do it is to publish that library on GitHub and add its url to lib_deps like any other library. Then pio pkg update when I wanted to update it. Basically I wouldn’t try to make it special and would manage updates to it the way I would any other library.
Can you suggest a good way to deal with this? I'm unsure exactly what the issue is
I replied with code that includes more debugging info. WIth what's in there you can't be sure what the issue is. There's not enough output in the code you showed to be sure that it's not exiting the while loop.
So my suggestion is to add more debugging output to be clear about what's actually going on.
It's okay, caffeine is vital 🙂 🙂
Hey when I run this code and plug it in to an apple device (iPad or MacBook via micro USB cable to a USB hub for the macbook or a lightning camera adapter for the iPad) TinyUSBDevice.mounted never returns true and it is never seen by the iOS device. I'm just looking for it in midi monitor on the MacBook but nothing ever changes in there. Am I doing something wrong?
Y'all ever know that there's a better way to do something but just have no idea how?
char myBuf[4];
if(Serial2.available() > 0)
{
byte in = Serial2.read();
if(myBuf[1] == byte(0x04) && myBuf[2] == byte(0x00) && myBuf[3] == byte(0x10) && myBuf[4] == byte(0x80) && myBuf[5] == byte(0xFF)&& in == byte(0x5C)){
Serial1.write(byte(0xB7));
Serial.println(in);
}
else {
Serial1.write(in);
Serial.println(in);
}
myBuf[0] = myBuf[1];
myBuf[1] = myBuf[2];
myBuf[2] = myBuf[3];
myBuf[3] = myBuf[4];
myBuf[4] = myBuf[5];
myBuf[5] = in;
🫡
for the latter bit of code where you're shifting myBuf down you could implement that as a ring buffer - you'd keep track of the current starting point and change that index instead of moving the bytes. Downside is it's harder to do the compare
sorry what woudl the memcpy be replacing here?
Exactly which “ESP32 dev kit” are you trying this with and which USB port on it are you using (if there are multiple)?
ah are you recommending memcpy because I'm not comparing myBuf[0] through to myBuf[5] ?
https://www.digikey.com/en/products/detail/espressif-systems/ESP32-S2-DEVKITC-1-N8R2/16688755?utm_adgroup=General&utm_source=google&utm_medium=cpc&utm_campaign=Dynamic Search_EN_RLSA&utm_term=&utm_content=General&gclid=CjwKCAjw3oqoBhAjEiwA_UaLtlzS15jL_pq28A2wxp0p6-BjUChcO_Q55udsxXCFuWm1xTP8dKcMehoCu8IQAvD_BwE I've been using this one. I've tried both USB ports quite a bit with different cables.
char myBuf[5];
if(Serial2.available() > 0)
{
byte in = Serial2.read();
if(memcmp ( myBuf, "\x10\x04\x00\x00\x00\x00\xEB", sizeof(myBuf)) == 0 && in == byte(0x5C)){
Serial1.write(byte(0xB7));
Serial.println(in);
}
else {
Serial1.write(in);
Serial.println(in);
}
myBuf[0] = myBuf[1];
myBuf[1] = myBuf[2];
myBuf[2] = myBuf[3];
myBuf[3] = myBuf[4];
myBuf[4] = myBuf[5];
myBuf[5] = in;
}
I was recommending memcpy() because it's an efficient and clean way to copy the last five bytes of myBuf into the first 5 bytes. memcpy(myBuf, myBuf+1, 5); - although, it's possible the behavior in this case is undefined. I don't think there's any guarantee that the first bytes are copied first.
Gotcha, is it okay to just compare the full buffer as I have above?
Yeah that should be fine
I am more than happy to buy another dev kit or several, I just don't really know what mine would be missing. This seems sort of like a niche use case.
Never ever EVER use memcpy() to do an overlapping move, i.e. one where the source and destinations overlap. That results in undefined behavior, which is a place you just don't want to go. It's nasty. There be dragons and all that.
For an overlapping move memmove() exists which guarantees to get it right, and is otherwise a dropin replacement for memcpy().
I just watched a silly sorting algo comparison, I feel using overlapping memcpy()s would be a a hilarious addition
I once intentionally misused qsort() by handing it a random comparison function, hoping for a quick way to shuffle an array. It turns out that the misuse, combined with the poor quality PRNG I was using, gave some odd structure to the result. I ended up plotting it and got an appealing herringbone pattern.
Is it normal for a board to lose it's boot loader every few uploads of code? I've been testing deep sleep in Arduino with my ESP32-S2, which I realize makes my life a little harder, but on my Windows and Mac I've found I've had to reset the bootloader after just reloading the board a couple times.
Sounds like you're new to the "quirks" of ESP32-S2/ESP32-S3 Arduino development. It can be kind of a pain. Some tips:
- I would recommend only using the USB port marked "USB" and not the one marked "UART". The "USB" port is what can be different types of USB devices like CDC/HID/MIDI/MSC, etc
- In the Arduino IDE "Tools" section, make sure you have the Upload Mode and USB Mode are set to "USB-OTG", like in the attached screenshot. (this selects that you'll be using the "USB" port for uploads).
- Before uploading, hold the BOOT button and tap RESET, then release BOOT. This puts the board in USB bootloader mode
- When you upload, it may get confused which upload port to use. Sometimes it figures it out. Sometimes you have to go back to Tools/Port and select it again
- After uploading, you have to physically tap RESET for your sketch to start
- If using the Serial Monitor, you will need to change your Tools/Port to the port TinyUSB creates as part of your sketch
You are absolutely right and I certainly appreciate the tips. Thanks a lot!
So, my Arduino IDE does not have a "USB Mode" option. It does have "Upload Mode" but the only options are "UART0" and "Internal USB". Maybe this is because of the version or because I am on Ubuntu?
I am using the port labeled "USB" and not "UART".
When holding "BOOT" then pressing "RESET" /dev/ttyACM0 becomes available and is labeled with my dev kit model.
I have successful uploaded it using both upload modes available to me.
When it is done uploading I unplug the USB micro cable from my computer and move it to the USB hub attached to my iPad.
I then open midi wrench and midimittr and I don't see any new devices.
I then hit the reset button on the Dev kit and reopenen either app and still see no device.
Please excuse the terrible picture
I also tried on a MacBook and saw nothing in the media monitor. Another thing is that I don't know what I'm looking for. Are midi wrench or midi monitor good apps to test this? If not, could you suggest one?
I should also mention that I am using this dev kit successfully on another project.
I don't know the current consumption of the ESP32 dev kit so the iPad may not be able to power it. I would ensure you're seeing it show up as a USB MIDI device on your computer first, to eliminate any iPad weirdness. As for your iPad power issues, you could try putting a powered USB hub (or maybe even power it via the "UART" USB port, though I'm unclear what kind of power switching the devkit board does if both USB ports are plugged in)
I have it wired up to be powered by the five volt rail anyway so I'll try that real quick
Hmmm no change on the iPad feeding it through five volts or through a powered USB hub. Unfortunately I won't be able to test on a MacBook until Tuesday.
I've never been able to get it to show on the MacBook at all. To be clear, you should just see it pop up in that little app that shows midi devices with cute icons laid out on a board, right?
Not sure what app you mean. I use USB Prober and MIDI Monitor on MacOS
I just got the rainbow demonstration working on the qualia rgb666 and the 320x820px display... may I have some suggestions on what to look at next to figure out how to draw an image or text to it?
I believe it’s using the Adafruit_GFX so this learn guide should apply https://learn.adafruit.com/adafruit-gfx-graphics-library
I’ve always had so much help from this channel/ community…. Appreciate it 🙂
Today looking for help with this library
It appears possible to use a different camera than in the code … I have a “timer camera-x” by M5Stack
Normally you just go to a tab and modify “camera pins” to your board
Apparently they implemented things differently, not sure what it’s looking for// in code modification
Really hoping to use Timer-Camera-X board by M5 , because it doesn’t require a FTDI programmer like AI-tinker does
Any help would be appreciated
Update: example 3 “get your first picture “ has a little more detail— showing 5 total ESP32 Cam variations
So there are possible changes… just need to know the file to edit and add “M5 Timer Camera “ to the possibilities.
@inland gorge Thank you! I now have something that almost looks like an egt gauge, albeit a simplistic one!
Hi all, I just got an ESP32-S3 feather from Adafruit, and I'm trying to load the normal blinky sketch but the IDE can't open the port, despite being able to detect the Feather board. I've installed all the drivers per instructions, anyone have any tips?
Good luck on Windows! I tried using my Windows 11 PC and it took 4 minutes to upload a sketch, even with all AV disabled. If the ESP32-S3 is like my ESP32-S2, sometimes you have to press boot, hold, then push and hold reset. That will "reboot" it it into a backup bootloader and it will show up under a different USB port. But then it will take the sketch 🙂
Then you have hit 'reset' yourself... Pick the other com port.... And then yer good 🙂 It's kind of a PITA... CircuitPython is dreamy in comparison. But it is quite fast and that's why I am trying to have fun with it 🙂
There's a nice carrier board for the ESP32-CAM called ESP32-CAM-MB, you can find it on Amazon, AliExpress and other places. It's fairly cheap and adds a USB port that you can use for serial and flashing and powering the board.
There are two things you need to be concerned about here.
First is the how the camera is connected to the CPUs IO pins. These cameras use a lot of pins. You'll have to work from the documentation on the M5 Timer Camera and try to reconfigure the code you want to run to use those pins. Unfortunately the naming on all the pins isn't always consistent, so you may have to guess what the wiring on the M5 Timer Camera corresponds to in the code.
I did get a ESP32-CAM MB off of eBay — and used them with some Microcenter ESP32 CAM boards —— so that could be an option. Just prefer the integration and compact size of the M5 versions
There's a chart showing the pins used by the M5 at https://docs.m5stack.com/en/unit/timercam_x - Pinmap
The reference docs for M5Stack products. Quick start, get the detailed information or instructions such as IDE,UIFLOW,Arduino. The tutorials for M5Burner, Firmware, Burning, programming. ESP32,M5StickC,StickV, StickT,M5ATOM.
Second you'll need to make sure the code you want to run supports the camera that the M5 uses. There are quite a few variations of cameras that these devices use and they all work slightly differently. The M5 uses a OV3660 camera sensor, so you'll need to make sure the code you want to run supports that. You may need to reconfigure it to use that sensor... depends on the code.
Hi didn’t see in the example where it assigns camera pins though
I’ve reached out to them on GitHub to ask if they’d add the M5 versions
I might just get an ESP32-CAM-EYE board, it’s supported and like the M5 is compact and doesn’t require a programmer
I appreciate you looking at this with me —- wish they would have just done a “camera_pins.h”
Yeah they could really have made this easier
also just a little bit of documentation would have helped
Brilliant!!!!!!
took a while to find it, it's not just you having trouble with it 🙂 They actually did a nice job organizing it all in C++, there's just a lot to look through. Good luck!
What got me is wouldn’t it need to “include” setModePins.h ?
How are they linking it without doing the include ?
they have several levels of includes 😉
In https://github.com/eloquentarduino/EloquentEsp32cam/blob/main/src/esp32cam/Cam.h they include the "traits", which includes setModePins.h
Ahhhhhhhhhhhhhh!!!
Didn’t know you could do it in that manner. Thanks 🙏🏻
Thought they somehow did some hidden voodoo lol 😂
They kinda did 😉
I’d have to agree !!!!!’ Gosh!!
So after finding the pins configuration .h file , it appears to be a very close match to the “m5” settings ——- easy fix.! I was hesitant to just try that option without knowing exactly the camera version
Cool thanks again 🙂
Awesome, glad that helped 🙂
Hi, I'm completely new here and looking for some advice on my new project (feather rp2040, Music Maker FeatherWing, 2xNeokey 1x4, I2C Stemma QT Rotary Encoder). I refer to the simple example "feather_player". Playing a few .mp3 files works perfectly. But now I have problems integrating the Neokeys. My guess is that no further action is possible while the .mp3 is playing. Is there a simple way to run several tasks side by side while the .mp3 is playing?
Thank you very much
Rp2040 is dual core. So maybe the easiest way is to just run each task on a separate core. (I don't know the feather_player example, how it works or if it truly can't run anything else on the same core while playing)
The Readthedocs page on the Pico says there's a Multicore.ino example, so I updated to the latest version of the RP2040 board package, but I had to do a little looking to find it. It turns out it's a few menus deep in File -> Examples -> Examples for Raspberry Pi Pico -> rp2040 -> Multicore
hi, i have one of these: https://www.adafruit.com/product/5395?
when I try to flash the async ota example, it crashes and gives me:
18 | #include "esp_int_wdt.h"
| ^~~~~~~~~~~~~~~
compilation terminated.
appreciate any thoughts
Are there any SPI tutorials out there that actually make sense? The one on circuit digest is downright terrible.
@river yacht what processor board are you using, and what SPI device are you wanting to connect to?
tons of tutorials here https://learn.adafruit.com/
@safe shell can m4 to qualia esp32-s3 rgb666
I've got the board mostly working...
just not the spi
I want to use spi to send results from the can m4 to the qualia so it can display voltage, egt, and eventually some data from the j1939 network
it might be easier to use UART between two processors
definitely a fan of Uart between boards, you can also put your computer as one of the boards for debugging (read what it's sending, manually respond if two way required).
Cool looking project
i have it all wired up for spi though i suppose i could rewire it… i have zero experence with uart beyond sending a usb message back to the computer
@river yacht you may be able to use the spi pins for uart, without re-wiring anything
i’ll give it a try! thank you!
hm, not sure
SERCOMs can used as UART (TX on SERCOM pad 0, RX on any pad) [M4]
but looks like default SPI pins don't include a pad 0 https://learn.adafruit.com/adafruit-feather-m4-can-express/pinouts
(but in any case, you wouldn't necessarily have to remove the SPI wiring)
more flexibility on the ESP side
in theory the display doesn’t ever need to send any data back, just respond to and display results for the can m4
I am trying to use a wemos D1 mini and an arduino pro micro to emaulate an HID device (https://github.com/jensweimann/esphome_ducky) I am able to send duckyscript payloads from Home Assitant now when the Arduino Pro Micro is plugged into my pc directly, however when I plug it into the keyboard port on my Tesmart KVM I can see it come online and send a script but the KVM doesn't pass that script to my PC. I want to use the hotkey feature of my KVM over wifi throgh home assistant.
@river yacht my read is that D1 (TX on the silk), D5, or D12 could be a UART TX
I'm trying to connect a Adafruit TCA9548A 1-to-8 I2C Multiplexer Breakout, but my sketch stalls at setup. I also posted in the adafruit forum with my code https://forums.adafruit.com/viewtopic.php?t=205768
looks like bill is helping you in forums
the SDX and SCX pins arent pulled up, so for a 5V device do i need to add anything?
probably best to troubleshoot in one place
Is there a way to turn off the splash screen on the oled feather without modifying the library?
Do a display.clearDisplay() before your first call to display.display()
oooo thank you!
I'm trying to setup my qualia rgb666 in vscode but even after adding both urls and reinstalling esp32 I still am unable to find the qualia board listed in the board manager. Am I missing a step?
well now I have vscode finally seeing all the libraries but it doesn't seem to be able to upload to the qualia
guess it needed a reset before the upload, never mind! Thanks for putting up with me!
Good evening folks, I'm working with the Feather M0 Adalogger with a set-up of an IMU, pressure sensor, RTC, and temperature sensor to save data to a SD card.
I have both a breadboard and protoboard version that works fine and saves data when plugged via a USB.
However, when I use an external battery instead of the USB. No data is saved? Is it because there's too much going on for the battery to support the system?
What kind of external battery?
well the spi is trying... I think... but I must be missing part of the puzzle
I'm thinking about learning to use wifi on an arduino, as such I'm going to order an UNO R4 WiFi, on top of that I was wandering if anyone had suggestions for a board that has a wireless module built in but has a smaller form factor. for example I don't require an LED matrix, the UNO will be for learning the other board for implementing.
Some Feathres and QT Py have wifi. Keep in mind, that different boards have different WiFi modules
If you don't mind stacking boards, there's an AirLift board that adds WiFi to Feather boards, or if you want to go even smaller, there's even an AirLift board that adds WiFi to ItsyBitsy boards.
I took a video of where I'm at with this. Does anything jump out at you that I'm obviously doing wrong?
Following on from what @muted gyro said, if you're just starting, one of the ESP32 Feathers would be a really good starting point just to get your feet wet. There are sample sketches on the Adafruit learn pages that will walk you through, step by step, the process of connecting to your WiFi, and from there connecting to the Internet.
https://learn.adafruit.com/adafruit-esp32-feather-v2/wifi-test
Nothing looks obvious wrong. Can you take some close-up pictures (front & back) of the board you're using?
Yep that's what I was expecting. Hmmm...
Hello. Im trying to get the 64x128 monochrome OLED to work with my ESP32 Feather v2. I have it connected over STEMMA QT and it says its getting power but I cant seem to get anything on the display. Im just trying to run the example code provided by the Adafruit_SSD1306 library
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
#define OLED_RESET -1
#define SCREEN_ADDRESS 0x3D
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
void setup() {
Serial.begin(9600);
if(!display.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS)) {
Serial.println(F("SSD1306 allocation failed"));
for(;;); // Don't proceed, loop forever
}
display.clearDisplay();
}
void loop() {
display.clearDisplay();
display.setTextSize(1);
display.setTextColor(SSD1306_WHITE);
display.setCursor(0, 0);
display.println("Hello World");
display.display();
delay(1000);
}
Hi, I'm programming my esp32-s3 with arduino, but it keeps going back to circuitpython mode, how do I make it stop doing this?
What exactly do you mean by "circuitpython mode"? It sounds like you're not actually uploading to the board, because Arduino uploads erase CircuitPython
I keep getting sent back here all the time. It was just working and then all of a sudden we start going here lol
I worked on my code several times no problem and then this always
I sometimes can fix it for awhile by reloading the test program for this board, but when I work on my code we go here
I just tried this Arduino sketch (https://gist.github.com/todbot/512f9911df02289ee630d92122bcab2b ), a modified version of the "midi_test.ino" from Adafruit_TinyUSB_Arduino that fixes a few small issues (midi loopback, midi send storm on boot) and tried it on a ESP32-S2 dev board and an ESP32-S3 QTpy. On both I observe the expected behavior:
- on plugging in, the device shows up as a USB MIDI device with custom name that's not "USB JTAG/Serial debug unit"
- shows up in a MIDI device list (like in say MIDI Monitor's expanded "midi sources" https://www.snoize.com/midimonitor/)
- prints to Serial Monitor when USB MIDI is received
- constantly sends USB MIDI notes that play a tune
If this or the normal "midi_test.ino" doesn't even show up as a MIDI device to your computer or persists in showing up as "USB JTAG/Serial debug unit", then I would suspect the Arduino install or some configuration setting under Tools. Perhaps try installing the Arduino IDE on another computer, using the Board & Library Manager to install needed libraries, etc.
That's not CircuitPython mode, that's the UF2 bootloader. It's what happens when there's no valid program to run or if you press the BOOT button after reset
@light stream the board enters bootloader mode if the reset button gets double-pressed or if reset then BOOT are pressed
I guess I'm calling it the wrong thing
Im going to bring this back down to the bottom if anyone knows how to help
Ok I can also try on a feather esp 32. I'll try these things on Tuesday and let you know. Thanks.
I'll try your suggestions, thank you for your help!
Apologies about the delay, I'm using the following below:
Adafruit Lithium Ion Polymer Battery
https://www.adafruit.com/product/258
Awesome. Please also be very explicit about which type of ESP32 you mean. The chips ESP32, ESP32-S2, and ESP32-S3 are entirely different, with very different abilities (e.g. the regular ESP32 cannot even do USB)
Cool I will, I just need to look when I get back there
Just wanted to say thank you! Got it working now! nice little egt gauge. bunch more coding on it... then one day, figure out how to make a custom pcb that can handle everything!
https://youtu.be/AggzQU8-3Bo?si=lTSdpFghYOoCJYc1
After much pulling of the hair, I have successfully transmitted sensor data from the Adafruit feather can m4 to the Adafruit Qualia ESP32-S3 RGB666.
Very very cool! Much more work to go, but I had to share this success!
what does it show on serial monitor?
Do you get the message "SSD1306 allocation failed"?
I do not
two obvious culprits:
- do you have pullups on SDA and SCL lines?
- is the I2C address correct? iirc, some displays use I2C address 0x3C
can you run I2C scan?
I'm trying to make a tabletop stat counter, and want to have a few user selectable names for counters. Since these names will never actually change, I want to put them into program space to save on RAM given that eventually this will target the ATTiny with only 512 bytes. The idea is that each counter can just point to an array to reference a long and short name.
const String names[3][2] PROGMEM = {
{"HEALTH","HP"},
{"EXPERIENCE", "XP"},
{"GOLD", "GP"}
};```
This works with warnings on the M0, but fails completely on the Tiny.
What is a good way to do this? I'm hoping that I can just reference each name with two ints.
Basically, I'd like to make a function that is just printName(1,0); to have it print out "EXPERIENCE"
This is probably going to be the best I can do, unless someone else has a better suggestion. I'll just make my own pseudo strings I guess.
const byte names[3][11] PROGMEM = {
{6,'H','E','A','L','T','H'},
{10,'E','X','P','E','R','I','E','N','C','E'},
{4,'G','O','L','D'}
};
const byte shortNames[3][5] PROGMEM = {
{2,'H','P'},
{3,'E','X','P'},
{4,'G','O','L','D'}
};```
don't forget the zero termination
That's what the number is on the front. Kinda. It's a count of how many characters are in that string so I can use it to calculate how to center it when printing.
The function will take that number, offset the starting location based on it, and then it knows to only try and print that many characters afterwards.
I think at least some c string functions rely on zero-termination 🤔. But if you're only using your own function then I suppose it's fine
Yeah, no proper strings here. At least not for this section.
But why not just zero-terminate it? I mean you're not saving a single byte by doing your own "storing the length" thing
Because I need the character count ahead of time for centering. So it's either put the count at the beginning, or count the characters each time.
Same number of bytes stored, but more work for information that should already be known.
I see
That said, the more I think about it, the more I think I probably don't need to be this stingy with my RAM. I mean, at worst when this is fully fleshed out I'm going to have 8 independent counters, each one in the range -999 to 9999. I'm not that pressed for RAM.
Even sticking the strings into RAM I'm probably going to be sitting under 100 bytes used.
I just noticed. Uppercase "String" = fancy C++ String object. Sure you want that?
It's all I know for strings.
String = fancy String object with dynamic memory allocation. https://www.arduino.cc/reference/en/language/variables/data-types/stringobject/
string/char* = c style char array https://www.arduino.cc/reference/en/language/variables/data-types/string/
Sounds to me like the c string is enough for you. And if you have very little RAM avoiding any kind of dynamic allocation (which String might do) is good
Oh, so it kinda just ends up doing what I'm doing in the second version anyway. Though I called them bytes, not chars.
const char* const names[3][2] PROGMEM = {
{"HEALTH","HP"},
{"EXPERIENCE", "XP"},
{"GOLD", "GP"}
};
this compiles without warnings but I haven't tested if it actually works
"declare names as array of array of const pointer to const char"
One way to find out. Stick some serial prints in and let it fly. Gonna start by seeing if it'll tolerate treating them as normal strings.
12:58:52.104 -> GOLD
12:58:53.083 -> HEALTH```
Well would you look at that. Fancy.
that's with this #help-with-arduino message ?
Yep
🥳
So I guess I'll just be counting characters. I kinda wanted to avoid that, but honestly it's a lot easier than what I was going to have to do anyway.
Unless... Gotta check something...
doesn't sizeof(names[0][0]) work in this case 🤔 (or subtract 1 from that because of the null termination to get the amount of displayable letters)
I mean the array sizes are defined at compile time so it might work
Unfortunately it does not. It's returning 4 every time for some reason.
Which is weird... Where is 4 coming from?
Oh... Wait... Is it getting the size of the pointer?
that might be it
I wonder how much this gets optimized away. Just completely to 7, right?
How about this, how can I copy the data that it's pointing at to a fresh variable? Remove the use of pointers for this.
I know strikingly little about pointers.
You can use memcpy() to copy things. However, in low-RAM environments, it may be worth learning how to code effectively with pointers. The AVR architecture is optimized for pointer operations.
I looked into memcpy(). Unfortunately for that you need to know how many bytes to copy, which is what I'm trying to find in the first place. So far I can get the strings, but other than operating on them as a whole I can't seem to do anything more specific.
If you're dealing with the strings directly in flash, there's another layer you have to deal with. You might consider returning to your length+data model. You can store it like "\04DATA"
I might have to.
Note to self, specify that these are characters.
13:43:11.750 -> Name 1 is 10 characters long. It is: 69888069827369786769
13:43:12.728 -> Name 2 is 4 characters long. It is: 71797668
It's probably not the best way of doing this, but it's functional. And to me that's the more important part.
Yar, that works
I got into pointers early on, so my Arduino code tends to have structures of pointers to other structures, functions that take a bunch of pointers as arguments, etc.: ```arduino
// display object structure (symbol, current segment, current position, size, rotation)
struct object {
struct symbol * symbolp;
struct segment * segmentp;
struct segment * segmente;
struct param curparam;
struct param dparam;
};
// forward declarations
static void initshapes();
static void initobjects();
static void setupline();
static void updateobjects();
static void getnextobjectsegment();
static void setupobject(struct symbol * symbolp);
static void buildfromvertices(const struct figure * figurep, const struct symbol * symbolp);
static float frandom(float range);
You'll notice I declare a bunch of stuff as const and static too (which saves memory in some circumstances)
They're definitely something I need to get more into. I've poked them a little bit, but nothing particularly fancy.
I think the issue here is I'm trying to pile too many layers onto one thing. If I weren't trying to do strings in flash with pointers where I need to be able to access individual characters, it might be more reasonable.
I am at least doing bitmask operations. Not at all related, but it's better than constantly trying to work around some of the things with the IO expander, and is something in the past I'd never have needed to bother with.
So I am learning and expanding.
I'm unsure how effective pointers are in flash-based strings. I think under the hood, the code ends up calling a routine to fetch the bytes from flash one at a time in a loop, but I haven't looked into that recently so my memory is vague.
Having an issue where my arduino doesn't seem to be overwriting old code, except sometimes it does? If I load an empty sketch, it behaves as normal, but if I overwrite my sketch I'm working on, it seems to keep some old variable values and not run some code. What could cause that? Here's some pseudocode
val1 = 1;
val2 = 2;
val3 = 3;
// seem to keep values from old versions of sketch, e.g. encoder position to go to is always the same even though I have changed it
void setup()
{
some_code_that_does_not_run;
some_other_skipped_code;
code_that_runs;
}
void loop()
{
//runs normally
}
Ah, there's some info on PROGMEM on the Arduino site https://www.arduino.cc/reference/en/language/variables/utilities/progmem/ that references handy functions like strcpy_P() to copy stuff out of flash.
Hm. Definitely something to explore.
That's weird with the old values. Normally there's zero-initialized global data and static initialized data (like your global variables val1 and friends). Those are normally initialized at startup (from a data segment packaged with your program known as the bss segment). However, since they're not declared as static, it could be the loader is considering them as something an external module might modify?
so write them as static?
it's very strange because I've "nuked" it with an empty loop and the old values no longer exist so?
sorry I didn't use type, they are all int16_ts
used to python
The serial monitor also isn't printing some stuf
ah that's because I didn't wait for Serial
pretty sure you can't use sizeof() for strings in a struct since you're just measuring the size of the pointer to the string (which could be stored elsewhere). You can use strlen(s) to get the length of a char *s.
👍 thanks, that explains it. But then it's counted at runtime, right?
this looks like it does the string-length counting during compilation. But I don't know if the constexpr interferes with other use of the names and PROGMEM 🤔 (Tbh I don't understand how constexpr really works)
constexpr const char* const names[3][2] PROGMEM = {
{"HEALTH","HP"},
{"EXPERIENCE", "XP"},
{"GOLD", "GP"}
};
void setup() {
Serial.begin(9600);
constexpr int i = strlen(names[0][0]);
}
Try it with other indices. You may be getting lucky with [0][0].
the tooltip looks correct for all
That's great! I was under the impression that doing multi-dimensional arrays of variable-length strings was not allowed in C++
me too 😆
I wonder how that actually looks in memory
nothing fancy actually. Just the char-arrays(strings) after each other and then pointers to them
.LC0:
.string "HEALTH"
.LC1:
.string "HP"
.LC2:
.string "EXPERIENCE"
.LC3:
.string "XP"
.LC4:
.string "GOLD"
.LC5:
.string "GP"
.type names, @object
.size names, 12
names:
.word .LC0
.word .LC1
.word .LC2
.word .LC3
.word .LC4
.word .LC5
Also is that a newer Arduino IDE, or something else entirely? I've been lazy and ignoring updates. So I'm still back on 1.8.19
that's IDE 2.something, so the new one. But afaik the compiler is the same no matter which IDE you're using
interesting. constexpr doesn't actually matter (in my shortened test case) according to https://godbolt.org/
I guess I should upgrade, and hope that nothing breaks. I guess if the compiler is the same it should be fine.
#include <string.h>
constexpr const char* const names[3][2] = {
{"HEALTH","HP"},
{"EXPERIENCE", "XP"},
{"GOLD", "GP"}
};
int main()
{
constexpr int l0 = strlen(names[0][0]);
constexpr int l1 = strlen(names[1][0]);
constexpr int l2 = strlen(names[2][0]);
}
=> causes 6 load immediate instructions. (To initialize an int with a value that is known at compile time, you need two load immediate instructions because the int is 16 bit, but the load immediate instructions and registers are 8 bit.)
So the compiler figures out the values that l0, l1, l2 should have and just saves 6, 10, and 4 in the program.
- removing all constexpr => doesn't change anything
- removing all constexpr and the second const from the names declaration =>
strlen()actually gets called during program execution.
I think the compiler figures out that everything is const in this case so it can optimize strlen() away
that's pretty cool and magical 🙂
which compiler are you using? arm-none-eabi-g++? (if you're on an ARM board probably yes)
#include <string.h>
const char* const names[3][2] = {
{"HEALTH","HP"},
{"EXPERIENCE", "XP"},
{"GOLD", "GP"}
};
int main()
{
int l0 = strlen(names[0][0]);
int l1 = strlen(names[1][0]);
int l2 = strlen(names[2][0]);
}
=> in this case, AVR gcc 9.2.0 and newer optimize strlen away. AVR gcc 5.4.0 still calls strlen. And gcc 9.2.0 is also the first one that knows about constexpr
For this, just https://godbolt.org/ set to AVR gcc because that's the only one where I at least know like 5 assembly instructions 😄
hehe
awesome. looks like the arm-none-eabi-g++ that ships in Adafruit's Arduino board packages is "9-2019q4" with a version of 9.2.1, so cool I can try this
btw: important to add -O0 to the compiler options for my 3 tests! Otherwise it completely optimizes everything away because int l0, etc aren't actually used.
But even with -O0 it optimizes strlen() away.
Earlephilhowers Arduino-Pico for RP2040 is also quite nice, because it uses GCC 12.3 so you can use some actually very new C++ features. I think the default is C++17 but you can change it to C++20 in platformio.ini
(It annoys me that most arduino cores use ancient compilers)
i am having an issue in using global variable public_ip_addr
I updated to Arduino 2.2.1, and now it's telling me a programmer is required when I try to upload to my ATTiny85. Ok, fair enough, but I have a programmer. I specifically picked Arduino as an ISP which worked just fine in 1.8.19
Oh, nevermind. Arduino 2.x requires that you explicitly specify upload with programmer. 1.8.19 did it automatically. That's kinda lame.
This doesn’t look like Arduino but something else. platformio?
Also I don’t see where you’re actually declaring that variable just the extern reference to it.
You need to allocate your variables somewhere. The extern declarations just say the variable exists, but it's "somewhere else". One module needs to have those variables.
I am trying to understand everything about building custom UF2 bootloaders for SAMD boards. The main source, of course, is adafruit's repository https://github.com/adafruit/uf2-samd21
I kinda understand how it works, but can someone tell me if the options for SAMD51 boards - like the ones below - are documented anywhere?
#define BOOT_USART_MODULE SERCOM0
#define BOOT_USART_MASK APBAMASK
#define BOOT_USART_BUS_CLOCK_INDEX MCLK_APBAMASK_SERCOM0
#define BOOT_USART_PAD_SETTINGS UART_RX_PAD3_TX_PAD0
#define BOOT_USART_PAD3 PINMUX_PA07D_SERCOM0_PAD3
#define BOOT_USART_PAD2 PINMUX_UNUSED
#define BOOT_USART_PAD1 PINMUX_UNUSED
#define BOOT_USART_PAD0 PINMUX_PA04D_SERCOM0_PAD0
#define BOOT_GCLK_ID_CORE SERCOM0_GCLK_ID_CORE
#define BOOT_GCLK_ID_SLOW SERCOM0_GCLK_ID_SLOW
@stable forge ?
wrong repo: https://github.com/adafruit/uf2-samdx1
indeed, sorry
no documentation other than the repo, which is a fork of microsoft/uf2-samdx1
I ran the I2C command and it returned this (See image below). The ESP32 feather v2 documentation said this:
There is a power pin that must be pulled high for the STEMMA QT connector to work. This is done automatically by CircuitPython and Arduino. The pin is available in CircuitPython and in Arduino as NEOPIXEL_I2C_POWER.
I modified my code to the following but still no output on the 128x64 OLED
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
#define SCREEN_ADDRESS 0x3D
#define OLED_RESET -1
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
void setup() {
Serial.begin(9600);
// Documentation says to pull this pin high
pinMode(NEOPIXEL_I2C_POWER, OUTPUT);
digitalWrite(NEOPIXEL_I2C_POWER, HIGH);
if (!display.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS)) {
Serial.println(F("SSD1306 allocation failed"));
for (;;); // Don't proceed, loop forever
}
}
void loop() {
display.clearDisplay();
display.setTextSize(1);
display.setTextColor(WHITE);
display.setCursor(0, 0);
display.println("Hello World!");
display.display();
delay(1000);
}
There is nothing on the Serial Monitor indicating any errors
Maybe it wants a reset pin?
The product description says the reset pin is optional.
https://www.adafruit.com/product/938
checking the data sheet for the display it says the reset pin 14 "is reset signal input. When the pin is low, initialization of the chip is executed. Keep this pin pull high during normal operation. "
https://cdn-learn.adafruit.com/assets/assets/000/100/779/original/2011241005_UG-Univision-Semicon-UG-2864KSWLG01_C113322.pdf?1616084674
I solved the issue
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
Adafruit_SSD1306 display(128, 64, &Wire, -1);
void initDisplay(){
delay(1000); // KEEP THIS!
// The OLED driver circuit needs a small amount of time to be ready after initial power.
// https://learn.adafruit.com/monochrome-oled-breakouts/troubleshooting-2
if (!display.begin(SSD1306_SWITCHCAPVCC, 0x3D)) {
Serial.println(F("SSD1306 allocation failed"));
for (;;); // Don't proceed, loop forever
}
}
void setup() {
Serial.begin(9600);
initDisplay();
}
void loop() {
display.clearDisplay();
display.setTextSize(1);
display.setTextColor(WHITE);
display.setCursor(0, 0);
display.println("Hello World!");
display.display();
delay(1000);
}
https://www.adafruit.com/product/938
https://www.adafruit.com/product/5400
Here is the final code for anyone using the Monochrome 1.3" 128x64 OLED graphic display with the Adafruit ESP32 Feather V2 over STEMMA QT and having issues with getting it to display
Ah, a little time delay. That makes sense.