#help-with-arduino
1 messages · Page 18 of 1
so i have the device pluged into the computer. Arduino IDE sees the device after going throught the steps to add it for devices. When i upload the code i change my parameters for my display, which by my understanding is changing two numbers, but then i get an error with 'arduino_GFX_library.h' is missing. I dont know how to resolve this since it is my very first use with circuit.py and displays. the only code i have been able to write was a modification of blink.
Like it says in the guide, the GFX library is not compatible with the latest board package from espressif
So you need to use an older version (previous to 3)
and then you need to install the other library by hand, ESP32_JPEG
okay would u walk me through that pls
https://github.com/esp-arduino-libs/ESP32_JPEG go here, go to code
green "Code" button on the main page, and do download zip
alright
https://github.com/adafruit/Adafruit_Learning_System_Guides/tree/main/Qualia/Qualia_S3_OrnamentVideoPlayer from here you get the sketch code, and the .h file needs to be in the same folder as your .ino
okay
I didn't actually work with the Qualia displays, so I'm not sure, but I think you only need to change the display resolution to your own ... i'll look into it a bit more
alright
meanwhile, did you create your video file like the guide says, and placed it in a /videos folder on the sd card ?
yes
where can i see the file location for my .ino file to add the .h file to the same location
You can download both files from github somewhere, and then open that .ino in the ide
Or create a new sketch, copy paste the code, and do "save as"
Location of the project doesn't matter, so you can make a folder on desktop if you want
alright now the .h file is in the same location as the .ino file
nvm i have changed that to my display resolution
and when i verify i am still geting this error.
library, needs to be installed
I think it wants the Arduino GFX Library (known frustratingly as GFX Library for Arduino in the Library Manager)
ran into another error but add the according library for it and now it is verifying
You need to change the code more
Where it does new Arduino_RGB_Display in the code, you need to change the parameters there to
720 /* width */, 720 /* height */, rgbpanel, 0 /* rotation */, true /* auto_flush */,
expander, GFX_NOT_DEFINED /* RST */, hd40015c40_init_operations, sizeof(hd40015c40_init_operations));
and for new Arduino_ESP32RGBPanel( you need to change some parameters to
1 /* hync_polarity */, 46 /* hsync_front_porch */, 2 /* hsync_pulse_width */, 44 /* hsync_back_porch */,
1 /* vsync_polarity */, 50 /* vsync_front_porch */, 16 /* vsync_pulse_width */, 16 /* vsync_back_porch */
see https://learn.adafruit.com/adafruit-qualia-esp32-s3-for-rgb666-displays/arduino-rainbow-demo and look for 4.0" 720x720 round display
okay
This should get it to work, if the GFX is sorted 🙂
alright it completed verification but i will make those changes now
changes complete and it didnt break now i just need to wait for it to reset and try it
Alright, fingers crossed!
how long does it take for it to reset via usb
it's an esp32 s3, the chips have some issues with resetting ... you need to manually press reset after you upload your code
yes! 🎉 awesome! 🙂
back with more metro questions... my project gets a lot simpler if I can run the metro 328 off of 12v power. The Adafruit website says 7-9v power, so I guess not. But then the fact sheet lists 12v as the max power for its power jack. Any chance I can power this off 12v without lighting it on fire?
I think the pinout pdf has a mistake, that's the only place 12V appears, and they mention 7-9V multiple times (unfortunately this board is pretty old, so it doesn't have its own proper guide to be sure)
I would not risk it, it probably won't light on fire, but the circuits on the board will be fried anyway.
How would the project get simpler to power from 12V tho ?
o7
using it for PWM LED color control with some MOSFETs, if it could take 12v I could power everything off one circuit
I'll just use the second battery like in my original layout
you wouldn't have output access to that 12V from the arduino board
and the logic output from the pwm pin would still be the same
so separate power supply / battery is needed anyway
hmm. Yeah I'm still trying to wrap my head around this whole thing before I plug any power supplies in lol
trying not to fry my board
the MOSFETs connect the gate pin to a microcontroller input, but then... does that connection need a grounding wire to run current? Will it work with just the normal 3.7v microcontroller power and ground?
https://learn.adafruit.com/rgb-led-strips/usage there is some example wiring for 12V led control with fets here, if it helps
yep, scrutinizing that diagram in a tab already lol
The problem is that it's running off 9v power through the microcontroller, but the Metro can't handle the 9-12v my lights need to work
So instead of running that top power line from my microcontroller to the LED power input, I'm running power directly from a 12v battery to the LED
except that means there's no loop from the MOSFET gate pins to the microcontroller to a ground
do MOSFET gate pins output a full 12v?
AI assistant says they're outputting less, but that guy hallucinates all the time so I usually want a second opinion
wait this is something I can just measure with my multimeter, maybe
Hmm, not getting anything...
the gate pin is an input, not an output. i think that guide uses an N-channel MOSFET as a low-side switch, so as long as its gate threshold is low enough and its Vds is high enough, it should work
well, its input status is definitely good to know lol. That would've been a fun one to troubleshoot, thanks
gate is referred to source, which is connected to logic ground. LEDs are connected to drain, with their anodes at
the external 12V. as long as the 12V shares a ground with the Metro, you’re probably fine
Hmm, see that's the problem - it doesn't share a ground with the Metro. It's running off a different circuit because 12v power would burn out the Metro
the only thing that 12v battery is powering right now is the lights. It's not running power to anything else
would the gate input to the MOSFET work without it? Or do I need to find a way to run a 12v ground through my Metro?
don’t connect the positive of the 12V to the Metro, then.
just connect its negative to the ground of the Metro
I think I might understand - it needs to be grounded, but if I run a ground from the Metro to the 12v battery, with only the MOSFET gate channel connecting it to the positive of that 12v circuit, it can run the gate without taking 12v of current?
you can hook multiple power supplies to this sort of circuit as long as they share a ground (caveat for supplies that are grounded in unusual ways, but most DV supplies you’re likely to use are either floating or grounded to earth)
the gate is insulated. it forms a capacitor with the source terminal. as long as you don’t exceed the Vgs, you won’t damage the MOSFET that way. you still need to have source connected to the shared ground
the gate isn’t at 12V. the positive terminal of the LEDs is at 12V, but even the drain of the MOSFET will be lower than that due to the forward voltages of the LEDs
you should have a pulldown resistor between the gate and source to keep voltage from building up on the gate due to leakage when the Metro is off, but it’s often omitted in prototypes
not sure I understand this part. I don't have any connection between the gate and the source, apart from the MOSFET itself. Should I have a connection between them?
ideally you have large-ish resistor (i forget what typical values are) between gate and source, partly to protect the gate oxide from random high voltages
...huh
sec
if it’s always connected to a GPIO, maybe the pin protection diodes will take care of that well enough
where would the resistor go here
the only connection between those circuits is... the microcontroller ground? And the MOSFET itself
uC is the microcontroller in the bottom left, don't know if that's legible
can you label the terminals? i have no idea what the pinout of your FET is
also your battery terminals: which one is positive? and what MOSFET are you using?
The positive one is the one running from the battery to the LED. The MOSFET I'm using is.. one sec
i think you have drain and source hooked up bakcwards in that diagram
ah, you're right
there we go, thank you
where would the resistor go, then? The one between gate and source
yes, between gate and source. it’s more important when the gate terminal can get physically disconnected from the microcontroller pin (like being on a separate board, or a breadboard)
no that’s gate-drain
oh right I forgot I swapped them
i think some sources recommend 1M?
like so?
gotcha
thanks for the tip
and now I know I can ground my metro off the gate pin without lighting any electric fires
Using the trinket MO can the c++ from the IDE "talk" to a python program that's saved in the Python space?
Does anyone know if this project would run on an arduino nano?
https://www.arrl.org/files/file/QST/This Month in QST/September2016/Lewis PROMO.pdf
I know the code isn't there... looking for it now
This looks like more detailed build instructions.
(looking at this more, there's got to be a better, more compact project.)
Usually it's either/or: the M0 can run C++ or it can run Python, but not both at once. But if you're asking if a program on the M0 can talk to a Python program running on the host, yes, that is completely doable.
I'm guessing it would run fine on a Nano. You can always put the code in the Arduino IDE, set the board to "Nano" (even if you don't have one), and try compiling it (check mark icon).
Cool. That should then tell me if it’ll work. I’d forgotten that was part of the Arduino workflow
Thank you!
Hi, I got an ESP32 NodeMCU board with an ESP32-WROOM-32 from a workshop but didn't manage to get to the sessions. I couldn't find a bin file for this specific board to setup circuit python. I am trying to install circuit python so that I can use my adafruit SCD40 sensor. I haven't done microcontroller projects in ages. Can anyone lead me to the correct bin file and any examples or guide to do this? I guess I will need to use arduino instead of circuit python for this board.. but how can i connect to my adafruit scd-40?
Thank you!
You already got answered in circuitpython channel, please don't cross post.
Why I ask, Python gets this gigantic playground of EEPROM to live in. Looks like a shared diskdrive on my desktop here. c++? We get nothin! I feel like the red headed step child. If I could comunicate with a Python program on the chip, I may be able to get it to store some paramieters for me.
Is the trinket running python or c++ code?
I'm running c++ code.
So where exactly is this python program you want to communicate with ?
It doesn't exist yet. It may not be possible to do this. Why I'm asking.
Just looking for out of the box solution to saving parameters in c++.
And how in the world does one "build" a cat?
It's not possible.
And I'm assuming what you mean is that CircuitPython running on a Trinket M0 creates a USB mass storage device and uses a flash file system.
That is not available in Arduino, but there are various libraries that do flash storage, look into that.
If you are not using Arduino, but bare metal C++, you need to look in your SDK manual.
There is no flash storage one can use on a trinket MO
There is no flash storage available by default in Arduino, that's why you need a library, like this one https://www.arduino.cc/reference/en/libraries/flashstorage_samd/
If it doesn't work, try getting a SD card breakout board.
Good evening all! I received my ESP32-S3 feather today...assembled it, and now I am trying to figure out how to get the blink sketch working on it. These things have so many upload parameters so I am a bit confused.
Can anyone help me out with what the settings should be in the arduino app to get this going? Thanks
You just need to install the correct board manager package so it recognizes your feather
I have done that,
I am trying to do the original blink sketch, and well...having issues
What issues ?
I upload it, and the MCU keeps rebooting
oh, the S3 issue
A lot of ppl have it, I think it's a bug in the last board package
Change it to a previous version
Try changing to 2.0.17
So this is a known issue? I am not an idiot? 🙂
I've seen it before a few times since they updated to 3 x x
Yeah, went to the mailbox today "oooh, new shiny feather"...and tripped face first loading blink. Thought I was doing something wrong
Hey, worst case scenario, shiny new feather works great with CircuitPython 😆
I dunno, running an interpreted language on an MCU just...strikes me as odd 🙂
I havent looked deeply, but the interpeter itself has to have some level of overhead no?
Doesn't have the performance of baremetal C for sure, but it's loads of fun
Hooray! I can blink an led again!
Awesome!
I dunno what espressif did in the latest arduino core, but a lot of people have this issue lately
I have a huzzah32, and I am loving the debug port on this S3 feather...Was a great addition
My FTDI friend (with the mini usb port :P) works great for it
Ok, so I guess we wait for a new version of the board core and see if it works better 😛 Thank you for your assistance, I was getting pretty frustrated with myself that I couldnt get a "hello world" working properly.
For sure! I know the feeling 😅
One more question. Why does it keep changing its COM port?
It's not doing it, your OS is every time it enumerates
Thanks winblows...is there a way to pin it?
There is, in Linux (udev)
nods Why is linux better at everything, but we need to run windows for games? 🙂
Not for long, MICROS~1 is quietly replacing the underpinnings of windoze with Linux, so soon "windoze" games can run natively on Linux.
I look forward to the day
because every big computer companies adapted windows for retail, and thats also what people have been using
but also i think m$ and the oem got a cut so
MICROS~1 also went to a lot of effort to make their system advertiser-friendly, ensuring wide adoption
they've been doing that since 1995
so eh
not to mention
many programs uses mfc which theres currently no linux adaptation for it
which means
these will have to be completely rewritten
"Advertiser-friendly"
You pay monthly subscription, we force your ads on people.
And yes, Windows hotplugging has always been broken.
hey all - working on some simple(ish) projects using ESP8266 and steppers. When the A4988 driver worked but resulted in LOUD movement, I ugpraded to TMC2208 drivers. And they're silent, all right - but 1/4th the speed??
from my read of the data sheet, leaving all the mode pins unattached (floating) should leave it at the default of full steps. I'm not trying to quarterstep or anything. And I've tried both driving it directly from a sketch with a loop, and using hte AccelStepper library. Either way, the A4988 drives the motors a lot faster, all else equal.
is there some kind of happy medium between a sound that travels through the house (conduction from being in direct contact with a wall) and operation so slow I may as well be using a wind-up key?
OK upon checking another reference, looks like default is 1/8 step and we can get to 1/2 step by setting MS1 high. So that's a start, but still... do you have to use I2C to get it to full step mode?
It might be easier to modify the control circuitry to send steps faster.
well there appears to be a limit on how fast the ESP8266 can send steps...
In software, yes. If it has a hardware timer that should be able to handle it though.
OK, so how do I go about setting up a hardware timer without using software? I may be misunderstanding you of course. But a simple While loop compiles down pretty well, as I understand it, and my While loop only checks to see if a button (digitalRead) is still being pressed
I have one of those like $20 "oscilloscopes" I should maybe try and hook up to see what really happens as I crank the delayMicroSeconds value down but at a certain point the motors go all wiggy...
digitalRead/digitalWrite both have quite a lot of overhead and don't really even make much sense to use in the first place because they only ever access one pin at a time. That being said, you'd have to check documentation to figure out how to interface with the hardware timers. Most likely they just have some config registers.
When using "Arduino", you can switch back and forth between the underlying SDK and using the Arduino "shell" right? So if you were doing pin manipulation, you could use like the ESP-IDF or Pico SDK's methods inside an arduino sketch. Am I understanding that correctly?
Aside from how confusing that might get, of course.
Usually. You just have to be careful the the hardware you configure doesn't get changed by calling some random arduino API function.
A simple example would be where you reconfigure the timer used for millis(), and then calling millis() later on in your code.
Right, I get it. Once I manipulate something "below" the Arduino API, I could no longer use Arduino APIs to touch that item.
Basically, yeah.
That must get awkward when using Arduino libraries though...some rando library using millis() after you have changed something would be a pain to track down.
It is, and yes.
<-- has done this before
I've had to reimplement adafruit libraries before because they were either blocking my critical path or utilizing hardware that I needed for other purposes.
I am just trying to work out in my head how to slowly take off the "training wheels" that Arduino API provides, without diving head first into a particular SDK.
Personally, I've found that full SDKs tend to be painful. I'd rather just have convenient register definitions and then implement my own abstractions to manage everything.
Like, I've seen videos explaining how and why Arduino pin manipulation adds a bunch of overhead, and I understand the how and the why of it, but I also get how having arduino and the SDK fight would be terrible to keep track of.
Yep. Thankfully, GPIOs usually just have a small handfull of configuration registers, so those aren't hard to manage. Things get messy once you involve more complex peripherals such as serial ports, timers, and/or DMA channels.
Well I finally got AccelStepper working, at least close enough for now - and it runs the servo more than fast enough, once you do some testing to determine what your max speed should be given the application.
It's clearly intended for slightly different use cases, given how the methods are laid out, but it does what I need it to for the current stage of the project.
Is this the way to use the two hardware SPI busses on the esp32s3?
#include <SPI.h>
SPIClass vspi = SPIClass(VSPI);
SPIClass hspi = SPIClass(HSPI);
// ... define MOSI, MISO, SCK pins for each bus
// ... define CS pins for each SPI device
void setup() {
// Initialize SPI buses with specific pin configurations
vspi.begin(vspi_sclk, vspi_miso, vspi_mosi, vspi_cs);
hspi.begin(hspi_sclk, hspi_miso, hspi_mosi, hspi_cs);
// ... other setup code
}
void loop() {
// Communicate with device on VSPI bus
vspi.transfer(...);
// Deselect VSPI device and select HSPI device
digitalWrite(vspi_cs, HIGH);
digitalWrite(hspi_cs, LOW);
// Communicate with device on HSPI bus
hspi.transfer(...);
// Deselect HSPI device (if needed)
digitalWrite(hspi_cs, HIGH);
// ... loop continues
}```
Hello, I'm trying to get the following example code https://github.com/adafruit/Adafruit_SSD1306/blob/master/examples/ssd1306_128x32_i2c/ssd1306_128x32_i2c.ino working with a Adafruit ESP32 Feather V2
https://www.adafruit.com/product/5400 and Monochrome 0.91" 128x32 I2C OLED Display - STEMMA QT / Qwiic https://www.adafruit.com/product/4440 using the STEMMA QT / Qwiic connector. Nothing is showing up on the oled. The green power light on the OLED board is lit up. Any ideas as to why nothing is showing up?
One of our star Feathers is the Adafruit HUZZAH32 ESP32 Feather - with the fabulous ESP32 WROOM module on there, it makes quick work of WiFi and Bluetooth projects that take advantage of ...
These displays are small, only about 1" diagonal, but very readable due to the high contrast of an OLED display. This display is made of 128x32 individual white OLED pixels, each one is ...
I'm also using the latest board packages and libraries. Nothing else is connected to the feather besides the usb c power from my desktop
Did you check the serial to see if you get any error messages?
You could perform an I2C scan https://learn.adafruit.com/adafruit-esp32-feather-v2/i2c-scan-test to make sure the oled is detected correctly.
I can give that a try
void playnote(float length, float freq)
{
stepper.setSpeed(freq / 3.33333333333);
stepper.step(???);
}```
I can't figure out the equation for the thing here. I need it to rotate for a specific amount of steps at a specific frequency. For example, if the frequency was 1000 hz and the length was 1000 ms, it would step 1000 times, as its a frequency of 1000, which is 1000 times per second. But I am incredibly tired, and I cannot think. Somebody please replace the `???` with an equation.
For length in ms and frequency in hz? 1000 / (freq * length)
its not rotating at all
the length is 500 and the frequency is 164.81
Ah, I had it backward. freq * length / 1000
hello, i am trying to use both dht11 and scd40 using one arduino one r3 board. The default serial port baud rate is 9600. The sample code for dht11 uses 9600 baud and 1000 delay while the sample code for scd40 uses 115200 baud and 100 delay. Can I just use just 115200 baud and 100 delay for both? The sampling rate of dht11 is 1hz though. In terms of display and saving data the delay can be virtually done. Is this good to do?
would it be better if i just use circuitpython for both and use different baud and delay?
i dont know if that is even possible. I am still testing out circuitpython
Default port (Wire) I2C scan: 0x3C, the scan does detect it at the correct address. Turns out the screen was damaged in the top right corner.
does anybody know of a library I can use that lets me play (at least) 4 channel midi files? it can be anything, as long as it doesn’t require an sd card slot of some sort, because i don’t want to buy anything else unless absolutely necessary
As in, it separates the 4 channels and sends out signals at specific times so the separate outputs output at the same time but asynchronously, letting music be played in real time
If anybody’s thinking that a pi pico (running arduino) wouldn’t have enough power, I did originally use circuit python - but that didn’t have enough precision for perfect frequencies.
scratch that - i think i found one (PlayTune), but its better suited to playing with speakers and not motors. what i will need is some sort of parser, that can turn the raw byte data from miditones into something like [C4, 500] with C4 being the note/octave and 500 being the sustain/note length. at the moment, its all in byte data and numbers that I can't figure out how to read
It sounds like you're trying to build something like a Floppotron?
yes! but only with 4 stepper motors.
As floppy drives use stepper motors internally, a lot of the concepts would transfer
yeah. so, is there any midi playing code? or at the very least, midi parsing code
There are several helpful writeups in the AdaFruit learn guides, here's one to get you started: https://learn.adafruit.com/midi-for-makers
this is pretty useful, but not really what I need. the pico needs to be able to read a midi file somehow, and then output the correct note. i've already set up the actual note playing, i just need to get a midi file into that code, in any possible way. i already tried with chatGPT but that ended badly and the midi isn't playing correctly. its not outputting any midi signal, and i don't want to have to input it with a keyboard/usb connector
You might have to hack up an Arduino MIDI file library slightly to read your file from wherever you're storing it.
But most of the code is already there
the problem is that i don't have a place to store it - unless its possible to place files directly on the flash memory of the arduino? (i have a pi pico and not an arduino so it should have some space). i can't really get an sd card right now. otherwise, i would have to store it as a set of bytes directly in the code.
Ah, I figured you had already decided where to store it. The flash memory on the Pico should be suitable.
how would i access that with the arduino ide?
would i have to switch to a different code (again)? i can't go back to circuitpython, its not precise enough for playing certain notes.
No, you'd do it with Arduino. There are three major approaches. One is to embed the MIDI data with your sketch and upload it in a single operation. The second is to block out part of the flash and just store the data there directly. The third is to set up a filesystem in the flash and store data as files within that.
filesystem sounds the most convenient (i assume it acts as a usb drive), but i'm assuming its one of the hardest to set up?
You can look at the projects (search for "pico fatfs", it brings up a couple of repositories)
All of those seem to be for accessing an SD card. However, I did find adafruit TinyUSB ported to arduino, and it does produce a result - but that result is the drive being empty. on windows, it says "Please insert a disk into removable drive D. I'll keep trying though.
I didn't realize that. Again, you might have to modify the library to read/write from flash, at which point it may be easier to just store the file on flash yourself.
There's also a constant error sound, and the computer lags
I know nothing about windows so I'm no help there.
Ok, so this code here (https://github.com/adafruit/Adafruit_SPIFlash/tree/master/examples/SdFat_format) says that the pico (RP2040) is supported. An error is thrown when the code is ran, sent through the serial. "Error, f_mkfs failed with error code: 14". This happens when trying to format the on-board flash memory as FAT12
I need to either fix the issue, or find an alternative for making the flash memory writable.
Does anyone have any idea yet? I still haven't been able to find a solution.
Ok! Flash memory is working. But I still can't find something to parse the midi file. There is one library (MD_MIDIFile) but I can't find any good documentation and it doesn't support LittleFS.
(that is, without mods to the library that I can't easily do)
https://github.com/Zacdoesmath/MD_MIDIFileSPIFF I did find one that works with SPIFF but I don't think that would work with an RP2040
Extensive use of ChatGPT reveals that ChatGPT is not smart, and will not produce working code.
Its code recognises all notes as invalid events, but I can see a pattern of the correct events within the incorrect events.
For posterity, here's the buggy mess.
Ok, I'm switching back to Circuitpython. It has easier PIO, and also is easier to code in general with a better set of libraries in my opinion
Not trying to slander Arduino, but it's not a good fit for this project
Having trouble searching up an example for this specific situation - I'm using a TMC2208 with an ESP8266, I want to enable the passive braking mode, which evidently requires serial communication on startup. But there are no SCA/SCL pins labeled, just two UARTs. I guess I use the Wire.h library somehow, but I'm unable to find any good wiring diagrams which are relevant...
THis is in the datasheet - suggesting I hook up BOTH TX and RX to one (which?) UART pin?
I keep running into the same explanation - set IHOLD to zero and you can select passive braking or freewheeling mode. But nowhere (that I've found so far) does it explain how to do the latter!
`` if (timeStatus() != timeSet)
Serial.println("Unable to sync with the RTC"); // Print error message if unable to sync with RTC
else
Serial.println("RTC has set the system time"); // Print success message if RTC has set the system time
while (!Serial)
;
{
;
} `` I know the RTC is connecting because I have tested to see if the Ardiuno has the correct time after a full power cycle and yet I get the "Unable to sync with the RTC"
so what is wroung here
are you sure timeStatus() and timeSet are the same data type? (just a guess)
Finally found another datasheet which actually mentiones the FREEWHEEL setting in the registers. I've also learned that TMC2208 boards come in a lot of flavors and most, if not all, need a jumper (solder) before UART mode is even available. I see no empty solder pads on my boards... urgh!
Or could it be present with a 0-ohm black resistor? That little bugger between pins 3-4 (counting from top) on the yellow side?
I should order some different 2208 boards I guess. if only to have them en route while I keep futzing around wiht these...
hmm I've found a few places via Google Image Search with that photo, places advertising boards looking VERY similar to mine which say UART is enabled by default?!
It's asynchronous serial, not a synchronous protocol such as I2C. So instead of using a Wire library, you'd use a Serial library.
Good morning. Silly question. Which is the SS pin on an ESP32-S3 feather?
OK, I was misled by some bad code then. Still, I should probably confirm that it's even possible to use UART on my boards before I try to link up from the ESP. And perhaps, buy some different TMC2208 boards... but thanks for the tip!
the problem is when you're fiddling around with USB-Serial FTDI boards and wiring and so forth, when (not if) it doesn't work the first time, troubleshooting is a nightmare... I'll try to dig out something that also needs to be programmed via FTDI so I can at least verify my board still works, for one thing!
Do you mean Chip Select? It's any pin you want it to be.
Yes, I mean chip select. The reason I ask is I am using the SD card test from the Arduino-ESP32 core, and I cannot figure out what pin it wants to use as CS
So I am assuming there is a "default" CS pin for when you dont redefine it
It is SD_Test under SD in the examples for the board
could you point to the code?
I'm assuming you mean this example: https://github.com/espressif/arduino-esp32/blob/4e3523c212375ef65256d09506ee89425dbf5958/libraries/SD/examples/SD_Test/SD_Test.ino
you have this in code at the beginning:
The SPI pins can be manually configured by using
SPI.begin(sck, miso, mosi, cs).
Alternatively, you can change the CS pin and use the other default settings by usingSD.begin(cs)
Thank you
thanks @eternal cloud
Yes, I was wondering if there was a default pin for it though in general?
Is it defined in the feather board layout spec or something like?
I imagine it would be needed in the spec for something like the datalogger wing to work?
GPIO10 is default for ESP32 S3 in the arduino core, that's pin 10 on the feather
it's specified in code, chip select can be any gpio, it doesn't need hardware support
On the wing, the CS is in a selected location, that matches different pins for different feathers, but can also be moved, see here: https://learn.adafruit.com/adafruit-adalogger-featherwing/pinouts
Ah, fair enough. I had assumed (we all know how that goes), that the MCUs would be broken out in a consitent pattern, suppose part of that is true with MOSI/MISO/SCK always being in the same location and such
I would also guess that SDA/SCL are always in the same spot as well.
yes, those are part of feather spec
different boards and different form factors often have differing pin assignments though. Example, the various micro ESP32-C3 boards vs. the Seeed Studio one have different power pins, despite having similar appearances and the same footprint
I think I finally managed to make contact with the TMC2208 via UART - had to solder a tiny SPECK of a solder "jumper" which looked like a mote of dust, and make one of those wacky "Y" cables with a resistor, but the Watterott configurator software appears to be working now!
now I'll have to figure out how to talk to it from an ESP8266, sending the right voodoo codes upon each powerup... but that seems tractable now compared to figuring out UART communication on a board without pin markings.
That's the way I like to attack problems like that: instead of figuring the whole thing out at once, divide and conquer by figuring out a piece at a time.
rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:1448
load:0x40078000,len:14828
ho 0 tail 12 room 4
load:0x40080400,len:4
load:0x40080404,len:3356
entry 0x4008059c
I keep going into this reset loop on ESP32S,
I tried a multitude of fixes, i tried esptool.py erase_flash, tried checking if ESP32 is receiving enough voltage/current, tried checking connections to FT232 and ESP32 connections (using dupont jumper wires), tried different power source, tried securing connections, tried different ways of wiring FT232 to ESP32.
The only thing i suspect in this case is watchdog timer? but in this case, I don't know what causes watchdog to go into a reset loop, is there any guidance on what to look out for that might be causing watchdog to reset, or if you think the issue is not watchdog, please do tell.
I only have a multimeter, no oscilioscope, so there is that.
I'm using Arduino IDE, example codes don't send the esp into a reset loop.
i can't read which ESP-WROOM that is due to the shadow
ESP32SWROOM32
that is a lot of code. To debug I'd suggest disabling chunks of the code and see whether you get the boot loop. Do a divide and conquer to establish exactly which section is crashing.
don't pay attention to that, yes in this case it's a ESP-32S, but it's just a plate i found and welded an ESP32 into, it could be an esp32 in this case
esp32s is a module name, confusingly
Brownout is a power sag. Is there anything that takes a lot of current there? If you are driving it from a laptop USB port, you might have only 500mA or so. Or perhaps there are wiring issues or a short somewhere.
i posted the circuit earlier
FT232 is connected to PC
is the ft232 board being powered both from USB an from the "DC 5V"?
you may have fighting 5v supplies
are the connections soldered, or do you have soldered headers on the boards and you are using a breadboard?
ok, FT232 is only using 5v from USB, it looks like
no only from usb
soldered pin headers breadboard
i don't see any specifc problems. What is the 5V supply?
I'm using a modified PC power supply
i'd say monitor the 3.3V output and see if it's erratic.
but I don't have any other ideas, sorry
well
if have the esp by itself
it won't brownout
but as soon as i add something like an SD card reader
it will brown out
the AMS1117 board is supposed to supply 1 amp, but maybe it's not working well. check the voltage when you add something else
ah, no, i'm not adding sd card reader to AMS1117, i'm just hooking it in parallel with AMS1117 (sd card reader needs 5V)
still, measure the 5v line and 3.3v line and see what happens
now add something
that's with SD card reader
3.12 is already a little low
and a logic level shifter
yeah ESP32 browns out one time then resets and work the second
because i added capactiors in parallel the equivalent of 2510uF
an ESP32 can draw a few hundred mA when wifi is in use
oh no, i have it as a hotspot right now
you could measure the current with the ammeter on your multimeter
sure
i am out to take a walk for a while
yeah it's late for me, i will also go, i really appreciate your help! maybe we can discuss this later?
of course, cheers mate.
Normally this is done with LEDs, but since you're talking about adjusting the size, this is some sort of graphic render?
Hey sorry i wanted to have a few questions as i recently purchased a few Itsybitys, specifically the 'Adafruit ItsyBitsy 32u4 - 5V 16MHz' i bought one previously as a test that worked fine same model n everyting, recently ive been getting errors when uploading the code to the board and it seems to flag when uploading. im not exactly sure where im going wrong?
error code shows as
All my other boards work fine, i use a feather M0 Express and Basic Proto it states its not connected on COM3 and the driver and disconnects and reconnects when hitting the reset key
Sketch uses 6884 bytes (24%) of program storage space. Maximum is 28672 bytes.
Global variables use 211 bytes of dynamic memory.
Found programmer: Id = "��d�o"; type = �
Software Version = �.�; Hardware Version = �.�
avrdude: error: buffered memory access not supported. Maybe it isn't
a butterfly/AVR109 but a AVR910 device?
avrdude: initialization failed, rc=-1
Double check connections and try again, or use -F to override
this check.
avrdude: error: programmer did not respond to command: leave prog mode
avrdude: error: programmer did not respond to command: exit bootloader
avrdude: error: programmer did not respond to command: exit bootloader
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
ive tried several different usb's and uninstalled the driver directly multiple times and still cant figure out whats going on..
Could you start a thread in https://forums.adafruit.com ? If the board needs to be replaced that is the place to do it. ping me with the URL when you do it. Could you take a picture of both sides of the board, and if you have the board bag still, take a picture of the label on the bag.
Yeah cah do ill make a forum post now with everything i posted here with the photos also
I just found a forum post about this and im in a similar situation, if i didnt buy direct from adafruit but a distro in the UK am i still applicable?
Do you mean you have the same board and it doesn't work with Arduino?
Same board
could you point to the forum post you found?
OK, make a new thread, but never mind the photos, and just say it's the same problem as the other thread. Give the number on your bag, which I'm guessing is the same W22545-C. I'll reply an authorize a replacement and then you'll write to support@adafruit.com to get that process started.
we try not to piggy back on existing threads for replacment
Yeah i have a photo of the bags, one of them is a W17113B which is the one giving me issues and its been opened
give me 1 moment ill send you my forum post shortly! i spent almost 2 days troubleshooting haha
do you have recent others that don't have the problem? What is their bag number?
All of the ones i have currently had this issue, its the 1st time i rebought i dont have the previous bag number annoyingly but i can see if i can find it in my garage if it hasnt been thrown yet
ok, not a really big deal. The bag number helps us track the production problems but it sounds like this might have been a problem over more than one batch.
buti have x5 W22545 C and x1 W1711-B (which is the one from the errors above)
Say how many need replacement.
will do just typing it up now!
Are all the W22545C OK? Open them all to test as needed
it is our policy to do 100% testing but very very occasionally a step gets skipped on the production line
I can test them yes, ive only tested the W1711-B which isnt working ill open one by 1 and verify the same way
Hello! I'm experimenting with this tri-color e-ink display, it's connected to a ThinkInk Feather Friend and to a Huzzah ESP32 featherboard. I'm powering it with a usb cable, but also have a lipo battery I can use.
The problem is that nothing is shown in the display, even though I can see in the serial monitor of my Arduino IDE that the code is pushing and working. I'm using Adafruit's example code for my Tricolor display. Attached the code.
Any thoughts on why it's not working?
You chose the SSD1680 controller chip? Is that the chip on the display board? I assume this is a third-party display
Thank you for your help Danh, ive made my post
https://forums.adafruit.com/viewtopic.php?t=212104
the display is a 152x152 Tri-Color eInk / ePaper Display bought from Adafruit
great - following up there
That is https://www.adafruit.com/product/5925, which has an IL0373 controller chip
So in this code, comment out the SSD1680 choice, and uncomment the IL0373 choice:
/ 1.54" 152x152 Tricolor EPD with ILI0373 chipset
// ThinkInk_154_Tricolor_Z17 display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS,
// EPD_BUSY, EPD_SPI);
// 1.54" 152x152 Tricolor EPD with SSD1680 chipset
// ThinkInk_154_Tricolor_RW display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS,
// EPD_BUSY, EPD_SPI);
// 1.54" 200x200 Tricolor EPD with SSD1681 chipset
// ThinkInk_154_Tricolor_Z90 display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS,
// EPD_BUSY, EPD_SPI);
// 2.13" Tricolor EPD with SSD1680 chipset
ThinkInk_213_Tricolor_RW display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY,
EPD_SPI);
Thank you again!
just responded as i forgot to add the amount like the fool i am.
np 🙂
Hay is anyone familiar with the IR library called IRMP. I have a IR remote that this library recognizes the protocol, address, and commands from my remote and I want it to send those data out of my ir transmitter module. Any idea will help, because IR libraries have gotten more complicated than my brain can understand these days. I'm only 27 by the way.
By the way the IRremote library can't understand my remote but IRMP does.
not familiar with it but have an IR remote high on my to-do list - father-in-law has a TV that's a lot more complicated than it ought to be...
and if you're like most people, 27 is already on the decline for learning speed and efficiency! Go back and try this 8-10 years ago, you'll be fine.
I say balderdash to that, I'm (way) past 27 and still learning new stuff fine.
given that my son has turned 33 this year, I find the idea of "27 is already on decline..." quite funny.
well if you still find learning new things as easy today as you did decades ago, my hat is off to you! Me, my brain feels more like something you could use to pack delicate objects for shipment... especially lately, I've been trying to wrap it around the datasheet for the TMC2208 so I can work out how to send the right bits to turn on Passive Braking. There's a configurator utility and I briefly had a setup working where I could "snoop" on the bits it would send, and I worked backwards with the datasheet to see how they checked out, but A: the setup no longer works for reasons I can't discern, and B: one of the commands I tested in the configurator turns out not to be the one I need to enable the mode!
And you'd think that there'd be the relevant CRC calulator SOMEWHERE online but apparently not, just dozens of calculators for slightly different flavors of CRC. My 50-something brain took one look at the ~15 lines of code required and just crumpled...
now if I was 19, I'd have done it in a few minutes.
although to be fair electronics were in black and white back then, come to think of it
I learned on vacuum tubes, happily, the concepts transfer, although it took me a while to get the hang of bipolar transistors (FETs, on the other hand, work somewhat like vacuum tubes).
ILI9341 maximum SPI clock frequency
Anyone know of a WiFi library that will allow me to check the MAC address of a connected device/ip?
For which board? And what do you mean by "check the MAC address"?
Do you want to send raw ARP requests?
i have an ESP-32 running an AP, a DNS server, a webpage, and a websocket server. I want to be able to check the MAC address of a connected peripheral against a constant that has the mac address of my iPhone in it to verify that the connection is actually from my phone.
i have some code already using udp
it prints the mac adress of a connection in serial whhen it connects but thats only with verbose enabled (i think its something in one of the libraries, but i cant find a "getConnectionMACaddr" function or anything
im trying to controll a prodject on the ESP from a webpage accsessed on my phone
By 'connected', you mean a browser connecting to the web pages? So you want the web page to know the MAC address of the device the browser (clien) is running on. I think that would (as a minimum) need to be handled by the web server on the ESP. Or more accurately, by a program running in the 'context' of the web server. Where it has access to the session connection details. I don't know if that is included in the standard packets or that function would need to do a query back to the client.
If the goal is authentication, be aware that the MAC can probably be spoofed.
the esp hosts a webpage and acts as an acsess point so i connect to the ESP in my wifi settings on my phone and then i go to my url and it works
all of that is in serial because its verbose output
im not worried about security
its for controlling a cosplay
but i want to kick other unknown MAC adresses off
I forgot to mention but the access point isn’t connected to the actual WWW internet
A bit of quick research finds that web servers can not access client MAC address due to security and privacy restrictions. That path is blocked. Since you are working with your own local network other options like previously mention ARP are possible.
However, since the goal is to detect your phone, and you are controlling the AP, another option could get you there. The AP will (normally) include DHCP to assign IP addresses. Many DHCP servers can be configured to reserve a specific IP for a MAC. Which means you only need to check the IP address. If you do not want anyone else to even get on the AP (separate from accessing the web page), you might be able to configure DHCP to not provide an IP except for the specified MAC.
Ooh interesting! Thank you
Hello aRduino friends. I'm doing my best to create object oriented code that creates objects - much like the work done by Ardafruit on mulit-tasking with an arduino.(https://learn.adafruit.com/multi-tasking-the-arduino-part-1/a-classy-solution)
So far, I've done many LED patterns that I pass the GPIO pin (D1, D2 etc) and they are working great.
However, I also want the ability to use an I2C expander with the same library, so i'd like to be able to tell the object what the output is, and whether it's a pin or a global variable.
then in the constructor, configure the pin (pinMode type stuff) as needed.
would I simply write to the variable name?
if (pinOrVariable == 1){
digitalWrite(MotAOut, HIGH);
digitalWrite(MotBOut, LOW);
}
else{
//MotAOut = 1;
}
(where MotAOut is what was passed in the consutrctor)
<@&617066238840930324> I'm currently working on a wind sensor project that requires cheap force sensors that can track force in two perpendicular directions. I know this is a weird analogy, but I'm looking like something in the sensor of a Lenovo Thinkpad's Trackpoint (the little red dot in the middle of the keyboard that you move to control the mouse). Does anyone have any thoughts on which sensors that would fit this description or advice on finding some?
Ought to work
No need to tag community helpers.
The way those work is just a lever system and two linear sensors. The same arrangement should work for a wind sensor.
Please only tag if you are replying to someone, and definitely do not mass tag.
@everone I need some help. can anyone join in vc
i need some information about how to use arduino with python
This is not customer support. Please type your question, and if someone knows the answer, they will help you.
What board are you using, what are you trying to achieve, the exact programming language, are all useful details.
i am using arduino uno. I have heared about the we can also program the board in Python. So I need help in that , how to program it.
You can program some microcontroller boards in CircuitPython, or micropython.
Arduino Uno is not one of them, the chip is too weak to run python on it.
I don';t think I asked my question very well. If MotAOut simply is a variable (not a pin name) can I just write 1 to it like that?
i'll handle it being passed to the i2c expander later.
so could you program a simple code on python in vc. so that I can get better understanding
If you have a compatible board, you can install a circuitpython image on the board.
Then you can upload python code to that board, and have it run directly on there.
You can see more details about it in these guides https://learn.adafruit.com/welcome-to-circuitpython
https://learn.adafruit.com/circuitpython-essentials
And if you're interested, you can ask to get recommendations for boards that could run python, since the Arduino Uno can't.
ok
Yes, that's a valid way of doing this. It's a little confusing, but sometimes low level code ends up like that.
excellent! thank you! I just released some factory installed smoke from my el-cheapo L9110 motor drivers, once I solder up a few more, I'll dive into the code! 🙂
boards are soldered up with repaired parts. @north stream I need a little advice on what to google (terminology etc). I'm doing the whole object oriented mulittasking stuff. I started with LED's, but i'm actually making tiny gravestones that wobble!
i can move the GPIO's on my Wemos D1 (esp8266 based) no problem, and I now have 2 gravestones wobbling back and forth randomly every few seconds, and simply running, just like the adafruit example a GraveA.Update() and a GraveB.Update() call.
but now, I want to take the same idea, and use a PCA9685 GPIO expander to do this. This is the bit that's cooking my noggin.
rather than talking directly to the GPIO (or ones that I passed in the constructor), i now need to send the results of each update to a buffer, so they can be tx'd all togehter ?!?!? My brain hurts.
I guess I could create an global array of values for the 16 outputs on the PCA9685 device and pass an index that points to which "channel" in that global array each instance of wobble state machine is run?
sigh I'm reading that paragraph and thinking "anyone who isn't in my head right now, has NO IDEA what I'm rambling about.
It looks like the library doesn't expose that directly, but we can look at the library source to see what it does under the hood
Looks like the library just does one at a time, so you'd have to write your own wrapper to do it. I might do the same in your position. First, I'd create a struct that mirrors the register structure of the PCA9685 chip itself, then write accessor functions that update the various individual channels as needed, then a routine to simply copy the bytes of the struct out to the chip via I2C in one go.
Wow, the chip has 256 registers, that's a lot of data. Maybe just the 64 bytes that control the outputs.
using tag 'everyone' for anything short of really critical announcement in a server with many thousand users is a sure way to annoy most of them.
Fortunately, here this tag is blocked
And this particular server has 38133 members.
oops mb, i’m new here
lol customer support actually did refuse to help me and sent me here lmao
sorry i’m not super sure what you mean. also i was looking for a force sensor with no moving parts
It has a fixed pivot on one corner, and a sensor on each of two axes. For a force sensor with no moving parts, you might consider a load cell: https://www.adafruit.com/product/4630
I need help in connecting bme688 sensor with esp32. when I have connected the side pins which is working for my code but I need to connect it with the cable from where the wires are connected(you can see it in the image). When I am connecting it and uploading my code in ESP-32, the message is displayed in the serial monitor as " Communication failed". I am using it in I2C protocol.
Did you use the wires from the connector in the correct order? You need to check the documentation for your sensor board.
Yes I have seen the datasheet and the led in sensor is getting on
here is the code which I am using.
Is the code working if you connect the side pins of the sensor to your board ?
yes
Then the code is not relevant, only the wiring
Are you using the same pins on the esp32 for the wires from the connector ?
The same ones like you used for the side pins ?
Do you have a link to the sensor board product page ?
datasheet of bme688
link for the main component in the pcb of sensor. https://www.bosch-sensortec.com/products/environmental-sensors/gas-sensors/bme688/
This is the only relevant part ... did you connect the wires in the correct order?
And to the same pins on the esp32?
Well, the side pins and the 4pin connector should work the same, just i2c communication.
So it's probably some hardware error ( on the data lines, since the LED is on) ... try using the connector on the other side, or using different wires.
Hi Ritu, try Wire1 for the address. Some boards use a different I2C for the Qwiic/StemmaQT connector.
https://docs.arduino.cc/tutorials/uno-r4-wifi/qwiic/
Hey folks,
I have an odd issue with my project.
I have 4 Adafruit arcade buttons connected to a PCF8574 GPIO expander, and that is connected to my ESP32 board.
The ESP32 sits on a breadboard, and I've connected the ground wires of the arcade buttons to the ground rail on the board (for both the switch and led).
The first time i press one of the buttons, the logs show that it is triggering a press on all 4 buttons.
However, the second time I press the button, it works as expected.
Here's the log output
12:43:51.489 -> Setup complete. Waiting for button presses...
12:43:56.166 -> Button pressed on board 0, button 0
12:43:56.198 -> SHAC:1
12:43:56.198 -> Button pressed on board 0, button 1
12:43:56.198 -> SHAC:2
12:43:56.198 -> Button pressed on board 0, button 2
12:43:56.198 -> SHAC:3
12:43:56.198 -> Button pressed on board 0, button 3
12:43:56.198 -> SHAC:4
12:43:56.395 -> Button released on board 0, button 0
12:45:30.067 -> Button pressed on board 0, button 0
12:45:30.067 -> SHAC:1
Code is attached in a file
The PCF8574 requires that buttons are set to INPUT_PULLUP , not just INPUT
Also, that you connect LEDs to power (through a resistor) on the positive pin, and to the gpio on the negative pin - so you need to change those connections.
See the guide here: https://learn.adafruit.com/adafruit-pcf8574/arduino and JP's video about it https://www.youtube.com/watch?v=0LnzrMszOXg
This is super helpful! Thank you
Madbodger - I Wanted to thank you for your help. I was originally driving the Chirk Castle motor drivers directly with GPIO from the Wemos D1 Mini, but now wanted more outputs, without significant changes to my code.
It works beautifully - going to be able to drive 8 gravestones per expander. Spooky stuff!
my code will be open source, as are my schematics etc once the product is released.
Anyone got experience with Adafruit NRF51/NRF52 neo pixel BLE examples or library usage? It looks like it uses 'C' to distinguish colour packets, similar to bluefruit connect colorPackets, but I thought all bluefruit packets had a ! Prefix, but I must be wrong about that. Also curious when the different values for "stride" would be used
#include <RadioLib.h>
#include <SPI.h>
// Custom SPI bus
#define SCK 19
#define MOSI 20
#define MISO 18
// SX1262 module pins
#define CS 10
#define IRQ 7
#define RST 9
#define BUSY 8
SX1262 radio = new Module(CS, IRQ, RST, BUSY);
void setup() {
Serial.begin(9600);
// change the SPI bus pins to what I have defined, not the default one.
///...
}
Does anyone know how I can tell radiolib to use a different SPI bus on custom pins? Or chang the default? I am new to arduino (Circuitpython experienced), and have been pulling my hair out about this. I need to change the pins, as I am using a custom PCB with the KB2040.
Might be worth looking at the source code to see what initializers are available
// change the SPI bus pins to what I have defined, not the default one.
https://arduino-pico.readthedocs.io/en/latest/spi.html
use
bool setRX(pin_size_t pin);
bool setCS(pin_size_t pin);
bool setSCK(pin_size_t pin);
bool setTX(pin_size_t pin);
before you call any radio.begin() (or similar) function
thanks! I didnt know there was separate docs for different ports. In hindsight that makes a lot of sense 🤦
Hi, how can I read a feed with arduino? or better how can I use 115200 baud as serial communication with arduino
The original Arduino only has one hardware serial port, which is shared with the USB adaptor. You can use that one, but you'll have to disconnect it to upload software. You can use SoftSerial to get more serial ports, but it may not be reliable at that speed. Some later chips offer more hardware serial ports, and might be a better bet.
baud is serial speed?
yes.
115200 baud = 115200 bits per second
oooh oke, bout this why it can't read?
hi everyone, I'm trying to connect an Adafruit SCP40 breakout board to a ESP32S3 Dev Module and I'm using the sample code provided in the tutorial. However, I keep on getting
Error trying to execute getDataReadyFlag(): Received NACK on transmit of address
The wiring is in the picture below.
Does anyone know how to fix this issue?
The GND/3V3/SDA/SCL are all connected in the same order
Hi wootoonooyoo. I'm not familiar with this devboard, but I know that I've had trouble with the the SeedStudio XIAO ESP32S3 on and i2C in the past. Unlike some of the other microcontrollers I've used (feathers, Picos and old Arduinos), I had to provide external pullups when using the pins for SDA and SCL. What a pain!
I don't understand what you're asking
I mean, the code should work, ignoring that it don't has wifi, the other code that I putted should do something, cuz I use Serial.print and don't send anything
Serial.print (on an original Arduino or clone) sends the data to the D1 pin. That's connected via a 1k resistor to the USB serial interface as well. So data sent that way should show up on the D1 pin as well as the USB virtual serial port.
is not showing in the ide
Do you have the IDE's serial monitor running and set to 115200/8N1?
Is anything else connected to D1?
in d1 nop, is nothing connected to the arduino and how can I set it to 115200? I tried but it just let me use the presets, I changed it to 9600 to try but still nope
Does anyone have experience with the USB Host Feather and the Arduino IDE? Been having a world of trouble getting it to run even the built in examples. Currently I can't get the serial port to work on the Adafruit TinyUSB USB Stack with any of the example code that I compile, but the factory reset .uf2 works fine.
the esp32s3 has the bt and wifi right?
Probably? SPI is SPI, and the other control pins are generally configurable.
The RP2040 USB Host feather yeah? The basic list USB vendor id/PID/devices should work. You can also list files using https://github.com/adafruit/Adafruit_CircuitPython_USB_Host_Mass_Storage
I've not played with reading serial over USB yet sorry
I've seen it, but don't remember where, and I can't put together a search query to save my life. I just need to use a clip, and arduino, to make an arduino into a dedicated SPI flash programmer
That's just it, the "list the USB vendor etc." example code doesn't work, the Feather doesn't send any serial data back to the computer, even though the serial port does show up. I assume the problem is in my IDE since precompiled .uf2 files work fine, but manually deleting and reinstalling the related libraries and board files did nothing so I'm out of ideas.
I've been trying to convert an integer to a 4 char array (for use in an alphanumeric display) but don't seem to be having much luck. I've tried snprintf(displaybuffer, 5, "%4d",presetPosition); but for some reason it changes the initial variable. I wasn't able to get itoa to work either itoa(displaybuffer, presetPosition, 10);
How is “displaybuffer” defined?
int presetPosition = 139;```
I think your buffer is too small. Needs 4 chars for the actual chars and one for the null terminator. Usually I define a char buffer well above the necessary size in case I make a mistake with my printf args. I do stuff like this a lot and it works:
#define maxbuflen 10
char buf[maxbuflen];
int someval = 234;
snprintf(buf, maxbuflen, "%4d", someval);
Serial.printf("buf = '%s'\n", buf);
just trying to get the functions working in the Arduino IDE
Compilation error: no matching function for call to 'print(const char [12], char [10])'
was trying to change it to serial.println. Let me try to use the larger buffer though
Sorry, the printf() should've been Serial.printf(), if the Arduino core you're using has Serial.printf(). Otherwise you can do:
Serial.print("buf = '");
Serial.print(buf);
Serial.println("'");
gotcha gotcha, that works in the test program, let me see what happens when I put it into the main one
think the larger buffer is working so far, just running a bit more testing though
writing the part of the program that increases and decreases the number of presets hah. Thanks for the help
Good luck. String stuff in C is always kinda gnarly
Hi folks. I followed Adafruit’s excellent tutorial on object oriented programming and using state machines to generate a number of different objects/behaviours for led (eg flashing, candle flicker, lightening etc). Works great very happy.
However, the objects are created prior to setup(), which, as far as I understand, get compiled into the code.
How would I make the selection of led mode something that could be changed during run time?
(The tutorial I’m referring to: https://learn.adafruit.com/multi-tasking-the-arduino-part-1/a-classy-solution)
This is an example of the code they use —
Could I write a conditional if statement in the loop() that’s says if a button is pressed:
Candle led1(12);
Assuming the only parameter needed for Candle is the pin. 🙂
That should work
So I could have all my LEDs created prior to the setup() as flashers, then when a button is pressed in loop(), redefine them as Candles?
That means that unused classes still get compiled and linked?
Prior to setup, I had:
Flasher led1(d1);
Then later in loop(), I’d have a conditional to at runs:
Candle led1(d1);
It depends on how you set up your code. You could instantiate classes on the fly when you need them (useful if you have large or many classes and limited memory), or just do what you described, instantiate all of them to start with and switch between them (easier to code and faster to run, but eats memory)
(I’m sat on a plane, doing mental workouts here, otherwise I’d just sit at the bench and try it!)
How do I kill instantiations then?
I’d like to kill Flasher Led1(d1) before creating a different one 🙂
My ultimate goal is to run a website on an esp8266 that lets you select from a dropdown which effect you want. 🙂
Ok - more frantic reading on my phone… by using the same name for the instance, it cleanly destroys the old one? (So the code and member used by Flasher is replaced by Candle)?
a cleaner solution would be to have a single class LedEffect which would take as input pin number, various on/off/times, and mode:
LedEffect led1(pin, ontime, offtime, MODE_FLASHER)
...
led1.mode = MODE_CANDLE
Of course, it means that led1.Update() should work differently depending on mode, so the definition of this class gets more complicated
@vivid rock I was thinking about that too…. But I was trying to avoid breaking code that currently works! 🙂
Not everyone needs to dynamically change their output behaviour.
I suspect I need to dynamically change my output behavior! 😆
I have a broad range of customers. Some are still attaching coin batteries to LEDs…. Others are asking for DMX lighting controls for tabletop gaming
Meeting the needs of both and making it accessible is HARD
Truth
Hello. So I've run into a problem with my Matrix Portal M4 module where it won't take in any other UF2 files. I wanted to try doing a factory reset but I have no clue how.
Most of the stuff I've been seeing is stuff related to the Portal S3 so I've been stuck for a long while
what do you mean "it won't take in..."?
this is #help-with-arduino , btw, are you using arduino or circuitpython?
ah i think this is supposed to be circuitpython
What i meant is that the UF2 files I add to the module kinda just make it crash and circuitpy wont pop up on my file explorer
moving to #help-with-circuitpython
im still new to this stuff so i wasnt sure where to post TwT
Has anyone gotten the Adafruit VS1053 Module (non-feather) working with an Arduino Nano 33 (IoT) ? I've been trying to figure out why it won't connect, so not sure if it is the pins that are wrong (since the docs don't really convey what breakout pin is should be connect what kind of pin on the microcontroller.)
Kind of lost at the moment, but mostly wondering if I can get this to work? I've tried cross-referencing pins with stuff like ESP32 and then the Nano, but it didn't work, so either I'm doing something wrong, or its getting too late and am still doing something wrong
Have you seen the Learn Guide for the VS1053? It had pinout recommendations https://learn.adafruit.com/adafruit-vs1053-mp3-aac-ogg-midi-wav-play-and-record-codec-tutorial/simple-audio-player-wiring
I have, and it's where I have issues with the pinouts. It is focused on the Uno, but I'm not working with one in this situation
The only connections relevant to which board is used are the SPI pins, SCK, MOSI COPI, ~~MISO ~~ CIPO... so use the ones for your Nano https://www.arduino.cc/reference/en/language/functions/communication/spi/
The rest are regular GPIO (some of them might need to be analog capable) that you just have to specify in code.
hey guys i'm trying to use adafruit motor driver 2927 with a dc motor acutator PQ12-30-6-s and it says that the duty cycle is limited to 20 percent ant that's what i did, but the acutator isnt moving or moves just a little and very slow and there is hmming sonund like if you block a motor. can you guys tell me what's causing this? i checked with oscilloscope and i reverses the polarity but doesent move in other direction. and it's causing this block that i'm testing : driver.release(0); driver.move_fwd(0); driver.release(0); delay(3000); driver.release(0); driver.move_bwd(0); delay(3000);
Might be a power supply problem, what sort of supply are you using and how do you have it hooked up?
You have the red region marked on that image for a reason? That’s not the current for the motors but its limit switches. The stall current for the motor is 550 mA at 6V, both more that standard USB can supply if you’re trying to power this from a USB cable
It's not usb It's 12V 2A adapter with a buck
It was just blocked, it just needed some manual mouvement at first, but the speed I'm getting at 6V 20% dutycycle isn't the same as datasheet
It says 28 but I'm getting around 15
Mm/s
Are you running it at 20% PWM duty cycle? I believe that maximum duty cycle refers to the frequency and duration of operation, not a PWM maximum.
Yeah 20%PWM, what does that mean?
That means you can run the motor at 100%, as long as you don't have it running for more than 20% of the time.
20% of what time?
Any time.
Well, I'll be using it to press buttons 1 button every second or smthg and there will be multiple and 1 for each button
Andand do you have some links that are more detailed on this?
What should I search for?
While these duty cycles aren't necessarily clearly defined in smaller hobby motors, the graphics explain the concept well
So if I use it for 2seconds at max and leave it for 10 is it ok?
Or if I use it with 50%pwm can I use it more often?
Yes and yes.
Duty cycle limits in this context is similar to pwm, except averaged over a much longer period. Continuous 20% pwm and 2s 100% 8s off would both be fine.
I'm following the instructions on https://learn.adafruit.com/adafruit-feather-rp2040-with-usb-type-a-host/usb-host-device-info I set the CPU speed and the USB Stack as instructed.
When run in the Arduino IDE 2.3.2, the code only prints "TinyUSB Dual Device Info Example" on the Serial Monitor. It does nothing else.
However, the Factory Reset UF2 works correctly, displaying the device descriptor info for a USB mouse I have plugged into the USB Host feather board.
Any suggestions?
hello
"random IPs" doesn't help much - what is the beginning octet of the IPs?
ok then @wanton sedge
#include "hidcustom.h"
#include <Ethernet.h>
#include <SPI.h>
#include <usbhub.h>
#define ETH_SS 5
#define USB_SS 10
int port = 62576;
int x = 0;
int y = 0;
char symbols[] = "-,0123456789";
const char code[] PROGMEM = "HAMODIISGAYS";
bool encrypt = true;
void decryptCommand(char *command) {
if (encrypt) {
for (int i = 0; command[i] != '\0'; i++) {
for (int j = 0; j < sizeof(code) - 1; j++) {
if (command[i] == pgm_read_byte_near(code + j)) {
command[i] = symbols[j];
break;
}
}
}
}
}
byte mac[] = {0x89, 0xF8, 0xB9, 0x3B, 0x46, 0xEA};
EthernetServer server(port);
EthernetClient client;
signed char delta[3] = {0, 0, 0};
void MouseRptParser::Parse(USBHID *hid, bool is_rpt_id, uint8_t len, uint8_t *buf) {
MYMOUSEINFO *pmi = (MYMOUSEINFO *)buf;
if (CHECK_BIT(prevState.mouseInfo.buttons, MOUSE_LEFT) != CHECK_BIT(pmi->buttons, MOUSE_LEFT)) {
CHECK_BIT(pmi->buttons, MOUSE_LEFT) ? Mouse.press(MOUSE_LEFT) : Mouse.release(MOUSE_LEFT);
}
if (CHECK_BIT(prevState.mouseInfo.buttons, MOUSE_RIGHT) != CHECK_BIT(pmi->buttons, MOUSE_RIGHT)) {
CHECK_BIT(pmi->buttons, MOUSE_RIGHT) ? Mouse.press(MOUSE_RIGHT) : Mouse.release(MOUSE_RIGHT);
}
if (CHECK_BIT(prevState.mouseInfo.buttons, MOUSE_MIDDLE) != CHECK_BIT(pmi->buttons, MOUSE_MIDDLE)) {
CHECK_BIT(pmi->buttons, MOUSE_MIDDLE) ? Mouse.press(MOUSE_MIDDLE) : Mouse.release(MOUSE_MIDDLE);
}
if (CHECK_BIT(prevState.mouseInfo.buttons, MOUSE_PREV) != CHECK_BIT(pmi->buttons, MOUSE_PREV)) {
CHECK_BIT(pmi->buttons, MOUSE_PREV) ? Mouse.press(MOUSE_PREV) : Mouse.release(MOUSE_PREV);
}
if (CHECK_BIT(prevState.mouseInfo.buttons, MOUSE_NEXT) != CHECK_BIT(pmi->buttons, MOUSE_NEXT)) {
CHECK_BIT(pmi->buttons, MOUSE_NEXT) ? Mouse.press(MOUSE_NEXT) : Mouse.release(MOUSE_NEXT);
}
if (pmi->dX || pmi->dY) {
OnMouseMove(pmi);
}
if (pmi->wheel) {
OnWheelMove(pmi);
}
prevState.bInfo[0] = buf[0];
}
void MouseRptParser::OnMouseMove(MYMOUSEINFO *mi) {
delta[0] = mi->dX;
delta[1] = mi->dY;
}
void MouseRptParser::OnWheelMove(MYMOUSEINFO *mi) {
delta[2] = mi->wheel;
}
USB Usb;
USBHub Hub(&Usb);
HIDBoot<USB_HID_PROTOCOL_MOUSE> HidMouse(&Usb);
MouseRptParser Prs;
void setup() {
pinMode(ETH_SS, OUTPUT);
pinMode(USB_SS, OUTPUT);
digitalWrite(ETH_SS, HIGH);
digitalWrite(USB_SS, HIGH);
// Ethernet initialization
SPI.begin();
// USB initialization
SPI.beginTransaction(SPISettings(14000000, MSBFIRST, SPI_MODE0));
digitalWrite(USB_SS, LOW);
if (Usb.Init() == -1) {
while (1);
}
HidMouse.SetReportParser(0, &Prs);
digitalWrite(USB_SS, HIGH);
SPI.endTransaction();
Mouse.begin();
delay(1000); // Added delay for stabilization
SPI.beginTransaction(SPISettings(14000000, MSBFIRST, SPI_MODE0));
digitalWrite(ETH_SS, LOW);
Ethernet.begin(mac); // Use DHCP to obtain IP address
digitalWrite(ETH_SS, HIGH);
SPI.endTransaction();
if (Ethernet.localIP() == 0) {
while (true) {
Serial.println(" and ip is wrong");
delay(1000);
}
}
server.begin();
Serial.println(Ethernet.localIP());
}```
like even if my lan cable is connected or not i get random ips
as in 412.xxxxx 952.xxxx 144.xxxxx
huh, 412 and 952 aren't even possible IP addresses.. and you're sure you're reading the IP addresses and not something else?
Curiously does this code ever just freeze?
i have a loop but thing is i cant even get pass the dhcp assignment
ive tried static
everything
this is how it looks
what is your ethernet port plugged into? (on the other end)
my router
like ive tried checking the manual assignment ip for mac addresses nothing
SPI.beginTransaction(SPISettings(14000000, MSBFIRST, SPI_MODE0));
digitalWrite(ETH_SS, LOW);
Ethernet.begin(mac); // Use DHCP to obtain IP address
digitalWrite(ETH_SS, HIGH);
SPI.endTransaction();
if (Ethernet.localIP() == 0) {
while (true) {
Serial.println(" and ip is wrong");
delay(1000);
}
}
Is the code in question correct?
thats the main part thats not working
are you setting the spi device select pin high?
(I havent read through every line yet)
ive done the spi.begintransaction because i need to gain exclusive access to the ethernet module because the ethernet module and usb host shield share the spi bus/lane to the arduino leonardo
obviously
ok my bad
check the start of void setup
usb host shield works perfectly fine but i just cant establish an ip and ping it
have you tried with just the ethernet adapter to see if you can get an IP from your local subnet? thinking wouldn't hurt to try break it out into a separate test to make sure you don't have a conflict. https://docs.arduino.cc/tutorials/ethernet-shield-rev2/dhcp-address-printer/
yes
i does work
// USB initialization
SPI.beginTransaction(SPISettings(14000000, MSBFIRST, SPI_MODE0));
digitalWrite(USB_SS, LOW);
if (Usb.Init() == -1) {
while (1);
}
This going into a while(1) loop is weird to me but you seem to know whats going on there and its intentional.
I dont know the api well enough to just spot a problem
but when i connect it to the usb host shield
bro that while loop for usb host shield means if it does not initilizes
goes into a halt
and im using usb host shield 2.0 library and ethernet2
ive tried default ethernet lib
but still same issue
ill do some reading and see if I manage to drum anything up for you
thx man <33
I'm more familiar with the networking sides of things (IT person here ;D) haven't done much with SPI but definitely sounds like a "conflict" of sorts, although not sure that would explain the random IP addresses.. I would almsot expect it to just "not work".
like ive done everything ive couldve think of 1. making sure the spi does not crash with the usb host shield and ethernet module 2. ive made sure the cs_pin is selected properly
yeah exactly its like some sort of conflict idk how to exactly fix it
Don't think I'll be much help here, but posting the code was a good start - I'm sure someone much smarter than I will happen along soon and have some ideas 🙂
<33
i think its the arduino leonardo r3 itself
everytime when i buy the brand from keyestudio the arduino never worked
but a original arduino one worked
I bought another original one because the first original arduino I got I shorted it with a dc 90 W and 20 current flowing through to the port on the leonardo 😂
@dry galleon
awesome!
Been looking around for a comprehensive how-to since yesterday - I'm trying to add the ability to do an HTTPS "post" to an ESP8266 sketch, so it can send Ntfy notifications.
This apparently involves running a Python script to gather up some security certificates, which I've done, and installing an uploader to put them onto a "LittleFS" filesystem, which I've done. But the sample code still can't find the certs.
I think I'm supposed to partition the Flash somehow, but I downloaded the tool to do that (a .jar, supposed to show up in the Tools folder) and can't seem to find the right place to install it.
Have tried a BUNCH of different locations in ~/Arduino, .arduino15, and various subfolders. FWIW I'm on Linux and using the .appimage, could that be the problem? Becuase at no point does anything appear in the Tools folder.
FWIW I can do ctrl-sshift-P and look up the "upload to LittleFS" entry in that long list of - tools? - but I read somewhere that I should make the partition on the flash first, THEN upload the certs, and then the sketch can be uploaded.
A lot of the how-tos seem outdated (for instance, the Python script to collect certs did not work, so I searched again and found a more recent Python script...) and/or only provide specifics for Windows installations.
OK I think I've tracked the problem down - looks like I had the right tools, I just trimmed too much from a big example program to use for testing purposes... another test program DID work and I found out that just because a sketch still compiles without errors when you comment out a library-include, that doesn't mean you've still got a working bit of code
That's happened to me too.
It's odd though, innit? You'd think if a library is #included then it would be referenced somewhere; and if it's commented out with no other changes, at LEAST a warning during compilation? Otherwise how can it even DO anything...
hey are y'all familiar with the M5Stack Cardputer? I've got one, programming it with the Arduino IDE. I'm trying to read the keyboard, but best I can tell, every 2 cols are connected to the same pin, and I can't figure out what pins the rows are on
There's a diagram on the back of the device with pin numbers for the kb, I'll post that as well rq
I'm not entirely sure what that device labeled 74HC 138 is, I'm assuming some form of shift register, but I'm not sure how to communicate with it using only 3 pins
my current code that I'm using to figure out the pins. oddly, pin 3 is always high. I'm not certain that I'm indeed accessing the right pins, as they are all prefixed with G on the board. However, they are changing with key presses.
void setup() {
Serial.begin(9600);
pinMode(7, INPUT);
pinMode(6, INPUT);
pinMode(5, INPUT);
pinMode(4, INPUT);
pinMode(3, INPUT);
pinMode(15, INPUT);
pinMode(13, INPUT);
pinMode(8, OUTPUT);
pinMode(9, OUTPUT);
pinMode(11, OUTPUT);
}
void loop() {
Serial.print("Pin 3: ");
Serial.print(digitalRead(3));
Serial.print("\n");
Serial.print("Pin 4: ");
Serial.print(digitalRead(4));
Serial.print("\n");
Serial.print("Pin 5: ");
Serial.print(digitalRead(5));
Serial.print("\n");
Serial.print("Pin 6: ");
Serial.print(digitalRead(6));
Serial.print("\n");
Serial.print("Pin 7: ");
Serial.print(digitalRead(7));
Serial.print("\n");
Serial.print("Pin 13: ");
Serial.print(digitalRead(13));
Serial.print("\n");
Serial.print("Pin 15: ");
Serial.print(digitalRead(15));
Serial.print("\n");
delay(75);
}
The cardputer is running an M5 StampS3 for the MCU, which is an ESP32-S3
the 74hc138 is a 3-line-to-8-line demultiplexer. The keyboard circuitry saves pins by decoding 3 pins into 8 column lines (or row lines?)
ahh 
someone actually made an extension to circuitpython to handle this kind of matrix keyboard
I don't know of an Arduino library, but it's not so hard
currently trying to figure out how to interact with the 74hc138. Changing A0 or A1 doesn't seem to have an effect on the output when pressing keys on the keyboard. This prolly wont take much for me to write a library to handle it all, once I can figure out how to read the matrix keyboard, I just can't seem to do that rn
I can't evne tell where the 74hc138's outputs are, they seem to go into R0 through 7 on the keyboard matrix, but that doesn't make much sense tbh
There's a whole Arduino library for the Cardputer provided by M5Stack (see: https://docs.m5stack.com/en/arduino/m5cardputer/program and https://github.com/m5stack/M5Cardputer), but @stable forge is right, there's not much to reading the keyboard: use the 3 pins connected to the '138 to select one of the 8 rows, then read the column pins to see if any key is pressed. then repeat until you have scanned all the rows.
ahh ok, thanks! I had just found that library and was starting to install it, hopefully they have some decent docs
I vaguely remember trying to use this library, but struggling from lack of documentation, which seems to be a common theme for M5Stack
heh yeah and with most libraries
luckily I know how to read C++ and header files lol, I'm determined to figure out how to use this thing
That is odd, but sometimes it happens, leftover #includes that pertain to nothing that's in the code
The inputs to the 74hc138 appear to be G11/G9/G8. I’d assume each row is tied to one combination of those three pins.
first time using an rp2040 board; I can't program it with the Arduino IDE or platformio without replugging it while holding the BOOTSEL button. is that common for this chip?
SparkFun Pro Micro RP2040 in linux.
I see both the IDE and platformio try flipping the board into programming mode by twiddling its USB serial port baud rate, but it doesn't seem to do the trick. the mass storage device doesn't show up & get mounted.
I've got all the common stuff done; udev rules installed, user has access to the serial device, ModemManager isn't running. both the Arduino IDE and platformio are humming along with some non-rp2040 boards.
same behavior with an adafruit QT Py RP2040, seems like, though easier since the QT Py has a reset button.
Isn't that by design? It's been awhile since I played with one but doesn't it show you the contents of Flash as a drive, unless you switch to programming mode manually?
Hey guys - this isn't really a question, but I've got an ESP8266 sketch which, among other things, has a button linked to a GPIO which has an interrupt handler that sets a global flag which a timer object will see and activate a countdown so that, when it hits 0, if the button is still down, it will set a different flag so that the loop() will do some stuff that's too time-consuming to do in a timer or an interrupt handler.
The logic is getting tangled, so my question is, what over-the-counter pain medication do you find is best for logic aches?
Yes, this is the intended behavior on RP2040 https://learn.adafruit.com/rp2040-arduino-with-the-earlephilhower-core?view=all
Having a reset button is very helpful, and SparkFun Pro Micro should have one too, that's what it says in the docs
I wonder if you could (ab)use a switch debouncer library to do it for you
thanks, and you're right, the SparkFun board is totally documented to have a reset button. I don't know what I was reading that convinced me it was something else. 😶
those adafruit docs do say you may need BOOTSEL for the first sketch upload, but they seem to imply that the first one does something that enables automatic uploads. in my case, I think it turned out to be a permissions issue.
in my case, the platformio rp2040 auto-upload failure turned out to be linux permissions. since IIRC it uses libusb to upload code, not the mounted filesystem, it's not enough that the mounted filesystem and serial device have the correct permissions, the underlying device needs them, too. in addition to the platformio udev rules, I needed the udev rules installed by this script, which fixed it:
https://github.com/arduino/ArduinoCore-mbed/blob/main/post_install.sh
I see, good to know!
though maybe what the script really did was reload my udev rules after I updated the platformio rules, heh. I do see my USB ID in the platformio rules. though, the script's rules list a couple extra boards that might be helpful for others.
and it still seems I have to use the BOOTSEL trick sometimes. maybe once each time I replug the board, and then auto mode works after that? but I can live with that.
I am not sure, I never used arduino on linux, but I did have to manually put boards in bootloader mode lots of times, even though I was just updating already existing code
Different chips too, rp2040, esp32 ... sometimes arduino gets confused, lol
Possibly, but bear in mind the switch can be turned on or off at any point. I want the user to be able to turn it on, and then if it's turned off within 5 seconds, no action is taken. After 5 seconds, a signal is sent. And if it remains on for a total of 30 seconds, then later on when it IS turned off, a different signal is sent. Oh but a status flag is always updated for every change in state. and sometimes that status flag is sent off, by a different means.
And the timing is done by a timer interrupt, while the switch sensing is attachInterrupt, neither of which can be used to send the (MQTT and HTTPS, plus Serial at least during development) signals. So there's this cascade of global Boolean flags that have got all tangled up in my head... but I'm simplifying it.
You are doing a state machine. If you can think in that mode, the flags should simplify drastically.
hey, not sure this is the right channel but im currently working on an arduino program to get orientation from magnetometer, accel and gyro and im strugging with the magnetometer on the feather sense. I cant get it give a north south east west reading going around the z axis. going around the x axis works for some reason but thats not helpful. I am calibrating the magnetometer using Adafruit_Sensor_Calibration.h but im not sure how much its doing
turns out i was being silly ignore me
Hello can someone when they are available help me turn on this Monochrome 2.42 128x64 OLED Graphic display. I have tried everything I can for hours to get it to respond and I am not sure if it's something wrong with the code or the wires or me.
you are familiar with existing algorithms such as Madgwick, right?
ooh, Madgwick looks cool. I knew someone had to have developed some impenetrable math that could do a better job than projecting a magnetometer vector onto a plane from an accelerometer measuring gravity. I think I have a project that could use this if I added a gyro. thanks for the pointer.
check github of Kris Winer:
https://github.com/kriswiner
he has written implementations of Madgwick algorithm for various IMU chips
Adafruit also has some libraries of their own:
https://learn.adafruit.com/how-to-fuse-motion-sensor-data-into-ahrs-orientation-euler-quaternions/overview
Hey guys my Arduino r4 wifi is not showing up in the IDE any idea on why this is?
Trying to use I2S.h with other Adafruit libraries like Adafruit_GFX.h results in a compilation error due to "multiple definitions of DMAC_Handler" - anyone have any advice?
Hello everyone! (I'm not a native speaker, I hope my question makes sense)
I am working with a fingerprint sensor in a ESP32 using Adafruit's library. Is there any pre-built method to upload fingerprints to a place that's not the internal memory? Maybe a SD card or an external server. And then download them?
I implemented something to upload stuff to a server but I am not able to save it in the internal memory after download. My goal is use one fingerprint reader to register people and then another reader (or multiple) to install it near a door. This way, if I have, say, 5 readers distributed, I don't have to register in every one of them. Thank you in advance 🙏
@bold hemlock if the buttons are comming into a shift register then they wont be rows or colls (or the rows and colls are coming into a shift register)
Reading an input shift register is not hard lots of tutorials on it for code on how to do it.
The idea is that a shift register takes a bunch of analog things like buttons, and you wire them all into the shift register and it sends the entire state of all the analog stuff connected to it at once.
So lets say you have a shift register with 8 buttons. It willl send your microcontroller a 00000000 when no buttons are pressed an 11000000 when the first two are pressed and so forth. The reason this works good is cause you can use "byte shifting" on the binary string which works really fast and will let you scan the binary for the state of each button single
https://docs.arduino.cc/tutorials/communication/guide-to-shift-in/ is an example of input shift registers
It’s not a shift register, it’s a 3-8 decoder or a demultiplexer.
Nah, it’s just a different method of using less pins to control outputs. The shift register uses fewer pins for more output combinations, but the demultiplexer doesn’t have any timing considerations to worry about.
ahhhh!
hello, i am trying to connect an MPU6050 GYRO SENSOR to an I2C multiplexer PCA9548A through arduino
i dont know how to write the program for this
im a beginner
can smone pls help me
with the program
HEy all, having a bit of a problem with my Adafruit music maker, following the tutorial on the site, but dosn't seem to be working
https://learn.adafruit.com/adafruit-music-maker-shield-vs1053-mp3-wav-wave-ogg-vorbis-player/play-music doing just what it says, and nothin
just using the straight code, and getting the error that the article mentioned, but doing the fix didn't help anything
What error do you mean exactly? Which code are you using?
There is a lot of info in that guide, did you follow all the steps? Which one are you stuck on?
on the Play Music step, and the error is the one they mentoned, Adafruit VS1053 Simple Test
Couldn't find VS1053, do you have the right pins defined?
And I did change the code to what they said, but not sure what's up
What board are you using this with ?
The Metro
Could you please post pictures of your boards and wiring ?
sure one sec. This was part-way through the build of a Ghost Trap, but when the board didn't work, tried to test it with the test music player
I'm not sure how well those stranded wires are soldered, I'd need to see the other side too.
I'm assuming this gets stacked on top of the metro?
Did you cut the jumper for DREQ, since you rewired it to pin 2? Also, did you change it in the code you were testing with ?
I meant if you changed #define DREQ 3 to #define DREQ 2 in player_simple.ino, since 2 is the pin you're using now , not just the change from breakout board to shield
The picture is kinda blurry... did you cut all 4 of those jumpers, or just the one for pin 3?
That error indicates a wiring problem, so that's what you need to double check
Just the one for pin 3
OPk, I'll change that over, hopefully that's what's wrong with this! Heh, course, the actual ghost trap isn't quite working, but we shall fix that later
Drat, that didn't work, Changed it to #define DREQ 2 and nothin
ok, the simple serial output worked, so that's something.
Anyone know off the top of their head how far in what directions did the Adafruit CLUE board move its display between Alpha and modern versions?
Trying to modify a 3D print case design to be useful for an alpha CLUE board, I only seem to have my eyes to go on though...
...Maybe right by 1/24th of the display area, seems 23.4mm, so 1mm?....
// Mod in OpenSCAD for https://www.thingiverse.com/thing:4321766
difference() {
import("Clueslim-Top.stl");
translate([-09.55,-9.533,0]) cube([23.4,23.61,2.2]);
translate([-14.55,-11.125,1.2]) cube([30.5388,27.365,2.802]);
}
Maybe 1/7th of a person would appreciate this. May this make you whole. ;-)
This is the Arduino channel, better to try https://discord.com/channels/327254708534116352/330445847382851587 or https://discord.com/channels/327254708534116352/330406777009209346
Also, I'm not sure what you mean. The Thingiverse link you're using is a Clue case designed by Adafruit, and it fits the current version of the Clue, not some "alpha"
That would depend on the fingerprint reader you're using. I have no experience with them (I bought a couple for a future project but they're still untouched) but I would be surprised if they let you do what you want to do.
Usually, fingerprint readers don't store a full image of a print - they create an encoded version, often called a hash, which is stored securely. Future fingerprint reads are also converted to the code, and compared to the list of stored codes.
If I were designing a consumer-grade fingerprint reader, I would not let people pull the hash out of the storage, even for a good reason like yours.
But I could be wrong. If the product you're using has this capability, and the library is designed to enable it, then the library's documentation will have the info you need.
Hi y'all! I'm running a sketch for the MLX90640 on the Adafruit Clue. I'm using the learning guide: https://learn.adafruit.com/mlx90640-thermal-image-recording
That sketch is on the PyBadge but I'm using the Clue and the image size takes up only about 1/3 of the screen.
Does anyone know how to change the screen size? Thanks!
Looking for code that works with the Adafruit Feather HUZZAH with ESP8266 using the deep sleep with or without battery. I've tried so many different pieces of code but none work. it works for a while and then creashes. This is the only output I get on the serial:
ets Jan 8 2013,rst cause:2, boot mode:(3,6)
ets Jan 8 2013,rst cause:2, boot mode:(3,6)
I then manually press the reset button on the HUZZAH with ESP8266 but it will not come out of this state. I have to unplug power to get control again
I found some chatter on the forums that says the Adafruit Feather HUZZAH with ESP8266 board has errors that do not allow it to deep sleep - Is this confirmed?
some sources for these comments would help us verify or not
I'm guessing the only way forward with an alpha bootloader CLUE is to update the UF2? Was hoping to read off a copy of the default program first.
I don't remember if the factory program is a CircuitPython program or Arduino? Does a CIRCUITPY drive appear when you plug it in? If not, it is an Arduino program.
Does CURRENT.UF2 appear in the BOOT drive? If so, and it's an Arduino program, you can copy the program off by copying CURRENT.UF2.
I was able to snag a current.uf2, though it is somewhat inscrutable to me. I don't see a circuit python mass storage device, and the CLUE screen proclaims "Filesystem not found".
The dribbles in the serial terminal don't seem to have any reaction to CTRL-C.
I will assume I've done all the scraping I can and work towards pushing bootloader 0.2.9 into the future then.
Awesome response, thank you!
CURRENT.UF2 is the contents of the internal flash on the nRF52840 chip. So it's the running program, which could be an Arduino program or CircuitPython itself. It can't be the Python code the CircuitPython is running.
undid that change, it's wrong. there is a separate chip for CIRCUITPY
2MByte SPI, by the diagram, I guess the 1MByte is internal to the nRF?
that's right
That thread says there is an inherent hw problem. I haven't seen a contradiction of that, but this may be interesting: https://github.com/esp8266/Arduino/issues/2049
note the last post about adding pull-ups
I have two of then and tried both of them but got the same results. Okay, it seems there is a HW problem then 😦 So it's confirmed. I have been pulling my hair out over this one. What is weird is that the nodemcu 8266 and the Wemos D1 Mini don't seem to suffer this issue.
maybe they have pullups on board?
or the board initialization code for those boards is different
and capacitors
With the help of ChatGPT, the sketch was modified not only to fit the screen of the Clue but to display the minimum and maximum temps. Anyone interested, let me know and I'll upload the sketch here.
Do you know if any of the Adafruit ESP32 boards suffer the same fate? I just want to log temp and humidity with a DHT22 sensor, go into deep sleep for an hour and then wake-up and send out the readings before going to sleep again. Obvioulsy running off a battery. I'd need to replace the two ESP8266 boards but don't want to run into the same issue.
I think this is an ESP8266 issue. I have not heard of ESP32 boards having such an issue. You'd want to choose a board designed for minimal power consumption when sleeping. for instance: https://learn.adafruit.com/adafruit-esp32-feather-v2/power-management
Thanks Dan. Does Adafruit offer a trade-in or rebate on those HUZZAH boards? I was thinking of getting the Adafruit ESP32-S2 Feather with BME280 Sensor or the new Adafruit ESP32-C6 Feather?
nope, no trade-ins, etc. C6 support is young for both CircuitPython and Arduino. C3, C6 and original ESP32 don't have full USB, so can't expose the CIRCUITPY drive or provide other than serial USB capabilities. I'd suggest you look for any Arduino issues about sleep for ESP32-S2 or other type of board you choose.
Is this where to ask about questions with bluefruit?
I'm trying to play a .wav file on the adafruit pygamer but nothing happens. I'm using the example script from the adafruit_arcada github
It has read the audio file successfully but I don't hear anything
Trying SD Card filesystem
SD card found
QSPI filesystem found
QSPI flash chip JEDEC ID: 0xC84017
Mounted filesystem(s)!
Found filesystem!
WAV Files available:
---------------------------------
System Volume Information/
2 Portal Radio (Uncompressed).wav 8773702
---------------------------------
Playing file: 2 Portal Radio (Uncompressed).wav
I have also tried using headphones but still nothing plays
do the wav files need special settings???
Do you have all the necessary libs installed? https://learn.adafruit.com/adafruit-pygamer/arduino-libraries
Hi there! We have an Adafruit Feather M4 express. We have installed the fastled neopixel library and we are trying to upload the following code https://github.com/Electriangle/Fire_Main on it but it fail everytime. The board seems to turn dead after uploading the code. We have successfully used Circuit Python (so the Hardware is fine). Anyone can give us an hand ?
Hello. Could you release a new version for Adafruit_Protomatter library? https://github.com/adafruit/Adafruit_Protomatter
With the Adafruit GFX library, is it possible to manually access and update the buffer and then just call display? Bypassing any other function calls?
I'd assume so.
Need a little help with a Seeed Xaio esp32-c3. It came with an external antenna that has a small coax connector, no more than a couple of mm in diameter. I think it's an IPX connector, but to be honest I'm not 100% certain of that. I can see well enough with the current state of my cateracts to see that the connector on the end of the cable should mate with the connector on the board.
What I don't actually know how to do is to get them to attach. It's not a "press-fit" as far as I can tell, but I can't tell if it's threaded or a bayonet connection or something else.
They generally come in push on versions. Correct alignment makes it push together easily. Other forms are screw on and they will have flats on the mating part but these are expensive and normally only seen on high end/ high freq equipment. When we get to the age of cataracts they should supply a 12 year old with every miniature appliance remote control or technological marvel.
Finally got it attached. When it lines up correctly, it slips in with very little force.
I"m using a Feather M4 Express & trying to get the simple Blink sketch running. I've copied the Blink code from the installation guide after running all of the appropriate setup for Arduino. Most of the time I'm getting:
Sketch uses 10904 bytes (2%) of program storage space. Maximum is 507904 bytes. No device found on cu.usbmodem311201 Failed uploading: uploading error: exit status 1
Curiously, the sketch did load once. I've tried quitting, restarting, selecting the board & port again. Any ideas what might be causing this? Thanks!
Might be you need to re-enter the bootloader
I took a look - it said says:
Model: Feather M4 Express
Board-ID: SAMD51J19A-FeatherM4-v0```
That's above the 3.9 the learn guide suggests needs the update. It happened to both an M4 and M0 in Arduino that I just bought. That's why I was wondering if there might be some odd setting I need to deal with to prevent some sort of time-out.
If you're running Linux, you could set a udev rule so it doesn't change device nodes when the USB bus re-enumerates
Running a Mac.
I'd get one out, but the only handy board is a Pro Trinket and it's bedtime for me. Sometimes a Mac will think these boards are potential network interfaces
I saw your query on Mastodon as well. The best sequence for Arduino I have found (in general, not just on Mac) is to double-click to get the BOOT drive, then reselect the port in the Tools->Port menu, then upload.
THanks a ton, Dan. This seems to have gotten things working! I had the latest bootloader, even re-installed the Arduino IDE thinking I might have inadvertently hit some setting with a hotkey, but the double-tap reset seems to get it back on track for receiving uplaods. I seem to have to do this for every upload, but as long as I do this, it's accepting what I send. I'll be sure to put this tiop into the build lesson I create. And so sorry if I missed something obvious in the documentation. As always, your kindness and helpfulness is world-class. Cheers!
Hi!! , I could'nt find channel for ESP , so i came heree... Im having trouble using OTA feature. When i upload the Arduino BasicOTA Example File , it uploads normally via serial connection to my ESP8266. But when i upload the same code again via Network , It shows me the following error...
- . Variables and constants in RAM (global, static), used 28992 / 80192 bytes (36%)
-║ SEGMENT BYTES DESCRIPTION
-╠══ DATA 1504 initialized variables
-╠══ RODATA 1352 constants
-╚══ BSS 26136 zeroed variables
-. Instruction RAM (IRAM_ATTR, ICACHE_RAM_ATTR), used 60824 / 65536 bytes (92%)
-║ SEGMENT BYTES DESCRIPTION
-╠══ ICACHE 32768 reserved space for flash instruction cache
-╚══ IRAM 28056 code in IRAM
-. Code in flash (default, ICACHE_FLASH_ATTR), used 285060 / 1048576 bytes (27%)
-║ SEGMENT BYTES DESCRIPTION
-╚══ IROM 285060 code in flash
-13:19:23 [ERROR]: No Answer
-Failed uploading: uploading error: exit status 1
Hi, I'm new to nrf52 devices and want to start with a simple freertos setup. I managed to setup arduino framework with the adafruit library.
I can include the freertos.h and setup a task but i think that nobody calls the tick for the freertos. Do i have to add some code for that or is it already setup with the freertos libs?
#include <FreeRTOS.h>
#include <FreeRTOSConfig.h>
void setup() {
xTaskCreate(DebugInputTask, NULL, 256, NULL, 1, NULL);
vTaskStartScheduler();
void DebugInputTask(void *arg)
{
debug_serial.println("DebugInputTask");
while (true)
{
debug_serial.println("DebugInputTask running start");
digitalWrite(24, LOW);
//vTaskDelay(1);
digitalWrite(24, HIGH);
debug_serial.println("DebugInputTask running end");
vTaskDelay(1);
The Taks is started but only runs to the first xTaskDelay(). If i remove the xTaskDelay the whil(true) loop runs several times (but logging crashes :))
I found I had an Adafruit ESP32-S2 Feather with BME280 Sensor, but the temperature readings I'm getting are way off - I'm inside the house and I'm getting readings of between 42°C and 46°C (over 100°F) which is not correct. It should be between 20°C and 25°C. I'm guessing the ESP32 running is generating heat that is causing the incorrect readings - Is this right?
That could well be, and you could check this just with your finger. You might see what the temp is after it cools off to room temperature. The other functionsof that sensor may be more useful
Putting my finger on the senor and the temperature dropped to 36°C - Now i'm even more confused??
... But the Humidity went up??? Do you think that the library has been coded incorrectly. I do print on the serial port before posting them out.
Is it hot to the touch? I think the library is fine; we would have gotten reports if not. Humidity would be up be cause temp is down and/or your finger is wetter
@onyx junco
BME280 does not have a thermally isolated sensor, so there is self-heating in the sensor as part of the humidity measurement process. With a fixed polling rate, this heat should be pretty close to constant offset from ambient, so if you compare this value to a known ambient temperature, you can use the difference between the two as a calibration constant for your system.
Definitely not hot to the touch. It is very strange. Not sure what to make of it or solve it?
Thanks - This is the BME280 that is built directly on the Adafruit ESP32-S2 Feather - https://www.adafruit.com/product/5303
hello, does anybody know if the Adafruit bno08x library ( https://github.com/adafruit/Adafruit_BNO08x ) can handle two bno08x sensors?
I want to take it every 5 mins after deep-sleeping. Currently it is doing it every 5 mins without deep-sleeping
Yes, you can do this.
/*!
* @brief Sets up the hardware and initializes I2C
* @param i2c_address
* The I2C address to be used.
* @param wire
* The Wire object to be used for I2C connections.
* @param sensor_id
* The unique ID to differentiate the sensors from others
* @return True if initialization was successful, otherwise false.
*/
bool Adafruit_BNO08x::begin_I2C(uint8_t i2c_address, TwoWire *wire,
int32_t sensor_id) {
Are you using some simple program like this? https://github.com/adafruit/Adafruit_BME280_Library/blob/master/examples/bme280test/bme280test.ino
wifi uses a lot of current, and might heat things up more.
Here is another library to try as well: https://github.com/sparkfun/SparkFun_BME280_Arduino_Library
Anyone using a nrf52 with the adafruit arduino library. I just realized that there is already a Freertos running for all the BLE stuff. How can i add my tasks to the existing FreeRTOS? I don't want to edit the library code...
which esp32 would you guys recomend for someone new to the using them but that has experience w/ arduino
this is the one i was looking at but it's rlly my first time looking at them so i thought i should prob ask for advice
I used this one in a recent arduino project. I found it fairly easy to find sample code and appropriate libraries to accomplish what I needed.
Comes in 2 varieties: PCB antenna or w.FL connector. I got the second one since I wanted an external wifi antenna.
https://www.adafruit.com/product/5438
oh awesome! i'll look into that one, tysm!
Thanks @stable forge for your reply. I tried it this way but don't get it to work. Do you use one instance of the Adafruit_BNO08x class for both sensors (e.g. with IDs 0 and 1) or do you create two instances? (I tried both..)
Both sensors work by themself. The one initialized first works, the second one fails (begin_I2C(...) returns false). I swapped the code to init the other one first - it's not a matter of the sensor, the second one to initialize always fails.
I2C scanner finds both sensors on 0x4A and 0x4B.
I use the https://www.adafruit.com/product/5325 and two of the https://www.adafruit.com/product/4754; connected via the Stemma QT connectors.
#include <Adafruit_BNO08x.h>
#define SENSOR_COUNT 2
Adafruit_BNO08x bno08x;
const uint8_t I2C_ADDR[] = { 0x4A, 0x4B };
void setup(void) {
Serial.begin(115200);
while (!Serial) { delay(10); }
Wire1.setPins(SDA1, SCL1);
for (int i = 0; i < SENSOR_COUNT; i++) {
if (!bno08x.begin_I2C(I2C_ADDR[i], &Wire1, i)) {
Serial.printf("Failed to find bno08x chip with address %d\n", I2C_ADDR[i]);
while (1) { delay(10); }
}
delay(1000);
}
...
Any ideas what could be wrong?
I always get Failed to find bno08x chip with address 75 (which is 0x4B; if I swap both addresses in I2C_ADDR[] to { 0x4B, 0x4A }, 0x4B succeeds fails and 0x4A fails)
You'll need two instances of the Adafruit_BNO08x object, one for each sensor. You could do this as an array ```arduino
Adafruit_BNO08x[2];
Hello. We have a question about the motor "Servo Motor Micro MG90S – 360 Degree Continuous Rotation".
We use this motor so that we can position ourselves wherever we want. However, since we do not need it to turn at full speed, we cannot position it at a specific angle due to the lack of potentiometers.
Could you let me know how to control this motor?
This is Arduino code.
#include <AFMotor.h>
//#include <Servo.h>
#include <VarSpeedServo.h>
VarSpeedServo myservo;
//Servo myservo;
int pos = 0;
void setup() {
// The servo control wire is connected to Arduino D2 pin.
myservo.attach(10);
// Servo is stationary.
myservo.write(90);
}
void loop() {
myservo.write(100);
delay(425);
myservo.write(90);
delay(1000);
myservo.write(80);
delay(350);
myservo.write(90);
delay(1000);
}
https://protosupplies.com/product/servo-motor-micro-mg90s-continuous-rotation/
If your need is to position it at a specific angle, it's probably not the right part for you. If you want to run it at a specific speed and direction, the code you have should work.
Without the addition of some encoder or potentiometer externally, there isn’t an accurate way of reading arm position.
If you need accurate position control and continuous rotation, consider adding closed loop feedback or switching to a stepper motor.
Thanks @north stream for having a look. I tried it, but still encounter the same problem. Here's my updated code:
#include <Adafruit_BNO08x.h>
#define SENSOR_COUNT 2
Adafruit_BNO08x bno08x[SENSOR_COUNT];
const uint8_t I2C_ADDR[] = { 0x4A, 0x4B };
void setup(void) {
Serial.begin(115200);
while (!Serial) { delay(10); }
Wire1.setPins(SDA1, SCL1);
for (int i = 0; i < SENSOR_COUNT; i++) {
if (!bno08x[i].begin_I2C(I2C_ADDR[i], &Wire1, i)) {
Serial.printf("Failed to find bno08x chip with address %d\n", I2C_ADDR[i]);
while (1) { delay(10); }
} else {
Serial.printf("Found bno08x chip with address %d\n", I2C_ADDR[i]);
}
delay(1000);
}
...
It's again always the second sensor in I2C_ADDR[]that fails to init:
const uint8_t I2C_ADDR[] = { 0x4A, 0x4B }; -> 0x4B fails
or:
const uint8_t I2C_ADDR[] = { 0x4B, 0x4A }; -> 0x4A fails
Thank you very much for your help here, I highly appreciate it!
I looked at the library code, and the library is only supporting one Adafruit_I2CDevice, which I believe is wrong. https://github.com/adafruit/Adafruit_BNO08x/issues/32
I just created that issue
@jovial isle I'm discussing this internally, and it's not clear how easy this is to fix. It depends on the Bosch-supplied library we use underneath being re-entrant, and it may not be (but we need to look).
@jovial isle Indeed, there is a problem with the underlying code that we didn't write. See https://github.com/adafruit/Adafruit_BNO08x/issues/32#issuecomment-2289595987
That's unhappy
I'm more curious what the application is for multiple BNO085 sensors. Is the intention to read the sensor data simultaneously? If not, an I2C multiplexer like the TCA9548 could switch between multiple BNO085s without needing multiple instances of said sensor.
Unless the driver maintains some sort of state, in which case switching between sensors could result in confusion.
We currently have no other solution but to use this engine because it needs to follow the sun and because it is a prototype of small dimensions for our needs. So far we have found that we can control it to go clockwise and counterclockwise. How to control the speed, but we have a specific problem when positioning, for example, we need 30 degrees and it turns 30 but does not return to 0. This allows us to delay.. If you have any ideas on how to solve this, please suggest (without changing the motor) ...
Best regards and thanks in advance.
This servo has no position control, only speed control. In order to add position control, you need to figure out a way to add some sort of position sensing. Common approaches involve adding some sort of encoder to track rotation around its axis, but for specific applications like sun tracking, a light sensor regularly checking for maximum light could work.
An accelerometer or magnetometer could also offer arm angle relative to the earth.
I am aware that this motor is intended only for speed control, but I think it can be countered with a delay, it is clear to me that it is not more precise, but I am just wondering if I can somehow make the mathematical calculation more precise, for example for speed 100 x=5.82*angle /360
and a certain number of seconds is obtained.
Thank you for giving me advice, it means a lot to me. ❤️
The speed will depend on the voltage, load, and even direction of rotation
The speed control is relative to its own max speed, which depends on the factors above and others too
Even temperature could make a difference in speed, which could make a difference in angle traveled.
You’d have to experiment with timings to see what works, but this won’t be suitable for much past one-off demos.
The speed control, to my knowledge, isn’t responsive enough for braking either, so precision is going to be very difficult to achieve.
If there's a particular position you care about, you could have a simple encoder that just actuates when it's at that position.
it is completely clear to me
if I had the opportunity, I could put it on, but they told us to try it without the encoder, and I feel like I'm in the matrix while I'm looking for a solution.. initially it was very difficult to find out how to control it, but thank you for the ideas...
and if it's not a problem, I have one more question about the mgs90 micro servo 180 servo motor
how can I make it stand still with the help of the program.. because I've tried many ways and it's simply frozen and I don't need that because it can overheat and kill my arduino and everything alive
and thank you for help
I'm not sure what you're using to control it, but many motor drivers have a "brake" mode where they simply don't apply voltage, just connect the ends of the windings together. That will discourage rotation but won't heat the motor with power.
It's clear to me, but if I give it a job, it doesn't do anything, like at the moment there's no voltage, why it's stuck doesn't make sense to me... I used to work with various motors, but now when the question is servo, I don't know how to do it properly.
Oh right, it has its own built-in controller.
ugh I don't know how to solve any problem anymore, I'm not smart
and what would be the solution for that
Seems to me a lot of the easy answers aren't available to you at this point. Why don't we take a step back for a moment? What is the situation with this motor, and what kinds of changes are you allowed to make?
What is your overall goal, and what is defining the hardware you're allowed to use?
I would like to start from the hardware, so from the hardware I have two servo motors, one of which turns 180 degrees and the other 360 degrees, the other one I have one motor shield and an arduino mega
the point of this project is to track the sun with the help of mathematical formulas, that's why I need a 360 servo... (I didn't choose and I can't choose, unfortunately)
and I specifically need to send it to a certain position, for example 223.3 degrees, and our question for that is whether to do it through a mathematical proportion or (I have no more ideas because I've exhausted everything).. And with the second engine I want (180degrees) while standing in a certain position, it doesn't work because it would waste energy unnecessarily, it's clear to me that the prototype is small, it's useless that my engine overheats...
It's unfortunate that you didn't have the option to select a motor, but if there's room for adding other components, closed loop feedback could be as simple as adding a magnet and a hall sensor or magnetometer like https://www.adafruit.com/product/4366 to the axis of rotation somehow.
Servos do draw power to hold a position. If force is needed to hold the arm in the right spot, your energy consumption does go up. If you don't need the servo to hold the position, you can disconnect power or stop sending signals to the servo to reduce power consumption when at rest.
I also see the word "prototype" a couple of times in the text. If the goal of the prototype is simply to demonstrate function, hopefully there is another opportunity to define more suitable hardware at a later stage of the design process.
There are 360° servos that aren't continuous rotation, that would have been a good choice, but as you said, that option was not open to you.
thanks for your help
I hope that I will succeed in some of what you told me
❤️
Dear @stable forge , thanks for checking this and replying. I'll have a look at some other sensors like the BNO055.
the application is for a theatre show. Think of it as two sticks connected by a spherical joint.. and I want to read the orientations of both sticks.
I also thought about multiplexers, but Adafruit already says that this will be an issue... https://learn.adafruit.com/adafruit-9-dof-orientation-imu-fusion-breakout-bno085 ("[...]and it does not work well with I2C multiplexers.")
Anyone got an idea as to why Arduino IDE claims that there is no device on the upload port?
Waiting for upload port...
Upload port found on COM10
"C:\Users\magla\AppData\Local\Arduino15\packages\adafruit\tools\bossac\1.8.0-48-gb176eee/bossac.exe" -i -d --port=COM10 -U -i --offset=0x2000 -w -v "C:\Users\magla\AppData\Local\Temp\arduino\sketches\BAAFA6A961ED28D5021055A5B278EB2D/samd21_blink.ino.bin" -R
No device found on COM10
Set binary mode
Failed uploading: uploading error: exit status 1
Unfortunately, the BNO055 has its own problems. See https://learn.adafruit.com/i2c-addresses/troublesome-chips.
Here are some other 9-DOF's: https://www.adafruit.com/search?q=9-dof
How do I solve the com port access being denied? I need help!
Tried solutions:
Changed cable
Updated drivers of ports
Reinstalled software
PC Restart
which OS are you using? Windows, Mac, Linux?
i am using windows 11
Is there another application open that accesses the com port? Like a Serial Monitor? Or another instance of the Arduino App? (Which, after a restart, like you said, really shouldnt be... just to make sure)
Or could it be that you have restricted user rights, like on a computer from a company, where the IT admins don't want to allow you the access to com ports? - but if you can install software, that also shouldnt be the case...
I am using nrf5340 audio DK in my project. unlike other MCUs, it creates 2 COM ports. one for the application core and another for the network core.
I don't know whether that the reason behind this issue
how can i convert RGB565 to HEX on arduino
Well, it's just 16 bits, so you could convert it directly to hex. But I'm suspecting what you actually want is to convert it to RGB888. That being the case, it'll look something like this:
typedef struct {
uint8_t r;
uint8_t g;
uint8_t b;
} RGB888;
RGB888 unpack_rgb565(uint16_t rgb) {
RGB888 result = RBG888();
result.r = rgb >> 9;
result.g = (rgb >> 5) & 0x30;
result.b = rgb & 0x20;
return result;
}
-# DISCLAIMER: I typed this on my phone. It is untested.
This is technically not arduino but its relevant
I am trying to write an extremely basic test cpp class
led_builtin.cpp:
#include "pico/cyw43_arch.h"
#include "led_builtin.hpp"
LedControl::LedControl()
{
cyw43_arch_init();
}
void LedControl::turnOn()
{
cyw43_arch_gpio_put(CYW43_WL_GPIO_LED_PIN, 1);
}
void LedControl::turnOff()
{
cyw43_arch_gpio_put(CYW43_WL_GPIO_LED_PIN, 0);
}
led_builtin.hpp:
#include "pico/stdlib.h"
class LedControl
{
public:
LedControl();
void turnOn();
void turnOff();
};
main.cpp:
#include <stdio.h>
#include "pico/stdlib.h"
#include "pico/cyw43_arch.h"
#include "led_builtin/led_builtin.hpp"
int main()
{
stdio_init_all();
LedControl ledControl;
while (true)
{
ledControl.turnOn();
sleep_ms(250);
ledControl.turnOff();
sleep_ms(250);
}
}
I just get undefined reference to `LedControl::turnOff()' when trying to compile
I cannot tell if this is a programming mistake or a build environment mistake.
I feel like I am going crazy. apparently you need to add stuff to cmakelists to be able to add classes to other files?
is there something i can read or watch that will explain how to break a simple c++ program up into multiple files?
no matter what I do I just get undefined reference to `LedControl::LedControl()
Arduino generally just uses C++ without the standard library.
this is not arduino
there isnt really another channel for code that makes sense
its just cpp
Oh wait I had the discussions mixed up.
next time i will stick to arduino, this thing is impossible
i am just trying to get a crappy test project onto an rp2040. i cannot figure out how to get a separate.cpp and .hpp file to work
One issue is that you declare but never instantiate ledControl. The full line should be
LedControl ledControl = LedControl();
(it would work the same way with arduino, by the way)
yeah
Also, you need include guards in the hpp file.
i still just get undefined reference to `LedControl::LedControl()' on line 10, which is the declaration
for sure. problem is i cannot even get it to compile at all.
Lack of include guards will cause a compilation error (although it isn't this error).
the more i add the more there is to break so i am trying to keep it as barebones as possible
Yes, but that's not something you can remove.
i have tried to add include_directories(src) to cmakelists.txt and that somewhat alleviates the error (goes from file not found to undefined reference)
i will try to figure out how to do include guards
And that's because you never instantiated ledControl.
In your case it'd be
#idndef LED_CONTROL_H
#define LED_CONTROL_H
// File contents go here...
#endif // LED_CONTROL_H
Ok, that's a build env error. I don't have time to debug it right now.
its not even attempting to compile the file lol
only the main file is in the compilation command
Thanks ill try this out
i have been trying to make this work for 4+ hours now so i am going to take a break before i throw my laptop off my balcony.
That's probably a good idea.
And yeah, C(++) build environments have always been a mess.
the worst part is that there is zero documentation
nobody has just written down "how to set up a cpp build environment"
and the official documentation is useless because it assumes that you are a 70 year old gigaprogrammer with 38 years of experience
like thanks for not telling me what include_directories does lol
Unfortunately 40+ years of cruft have made "just writing it down" difficult.
doesnt help that the raspberry pi "project generator" generates the most useless, least functional "project" that is possible either
is this the cpp SDK for the pi pico?
Yes
imma be real, using it looks miserable and insanely complex for beginners. id suggest using arduino pico instead
too late.
i have don a ton of arduino, python, etc
i literally just cannot make this thing compile
i can smash it all in one file and that would be fine
but that is gore and i dont want to do it
Looks like one file is including from a subdirectory and one isn't
I just use PlatformIO because I can still stay in the "relatively comfortable" Arduino environment and have those libraries and APIs but it's super easy to use multiple files cause it detects what H files you import and automatically compiles all CPP files. Then I also don't have to use the Arduino IDE which is a bonus.
I've been playing around with some ideas for the LED glasses using the nRF52840 glasses driver board. Yesterday I started trying to do some work with the built-in LIS3DH and noticed that suddenly my program took a huge framerate hit. It seems like once I call begin() on the LIS3DH library, ~30ms of time is added to the execution loop, even if I never actually take any readings from the accelerometer. Prior to adding the accelerometer code my entire loop was ~10ms so this is a pretty massive slowdown. Is this expected? Is there anything I can do to mitigate this?
Okay I have a little more info. It seems to be an unexpected (by me) interaction due to using both the LISD3H and the IS31FL3741 LED driver. Each frame I'm calling show() on the LED driver, which prior to calling begin() on the LISD3H would take about 9-11 ms to complete. Once calling begin() on the LISD3H, the LED driver show() method takes about 40 ms. Seems like it's I2C related but I'm not sure what the exact culprit is yet.
Well, I found a "solution", but I still don't completely understand the reason. Apparently you need to call begin() on the LISD3H driver before calling begin() on the IS31FL3741 driver 🤷♂️. Doing it the other way causes updating the LEDs to take about 4 times longer.
I am looking at the LIS3DH driver to see if it enabled an interrupt handler or something but I don't see that. I don't see why it should hog the I2C bus.
are you making any other calls to the LIS3DH library in the loop?
Nope, all I was doing was calling the begin() method on it. Never referenced the accelerometer in the program after that
now that I've swapped the initialization order, I added code to take readings, and everything is working as expected, with no framerate hit
could you upload your sketch with the + to the left?
Let me make a sample sketch for you with just the relevant code, this sketch has grown quite large lol
and confirm that sketch has the problem too 🙂
Here's a minimal reproduction of the issue. You can see the difference in the output depending on whether initAccelFirst is set to true or false.
@stable forge
Aha, see how the IS driver sets the speed to 400 kHZ:
ool Adafruit_IS31FL3741::begin(uint8_t addr, TwoWire *theWire) {
delete _i2c_dev;
_i2c_dev = new Adafruit_I2CDevice(addr, theWire);
if (_i2c_dev->begin()) {
// User code can set this faster if it wants, this is simply
// the max ordained I2C speed on AVR.
_i2c_dev->setSpeed(400000);
so if you set up the IS31 first, the bus is inited and set to 400 kHz, but if you set up the LIS3DH first, the bus is already inited and I bet the speed change does nothing
I'll bet that's the case too. Interesting though, because I didn't know the nrf52840 could have an I2C bus speed faster than 400k 🤔
no the speed is 400 kHz (400000)
my bad that's what I meant
the code in Wire_nRF52.cpp also leads me to believe that's the case 🤔
void TwoWire::setClock(uint32_t baudrate)sorry {
if (master) {
_p_twim->ENABLE = (TWIM_ENABLE_ENABLE_Disabled << TWIM_ENABLE_ENABLE_Pos);
uint32_t frequency;
if (baudrate <= 100000)
{
frequency = TWIM_FREQUENCY_FREQUENCY_K100;
}
else if (baudrate <= 250000)
{
frequency = TWIM_FREQUENCY_FREQUENCY_K250;
}
else
{
frequency = TWIM_FREQUENCY_FREQUENCY_K400;
}
_p_twim->FREQUENCY = frequency;
_p_twim->ENABLE = (TWIM_ENABLE_ENABLE_Enabled << TWIM_ENABLE_ENABLE_Pos);
}
}
"that's the case" not sure what you mean
sorry, I mean to say that it seems like, according to the code there and the documentation I've found, 400 kHz should be the max speed
LIS3DH first: bus is inited and set to 100 kHZ.
IS31 first: bus is inited and set to 400 kHZ
okay that makes much more sense
sounds like this should be in the guide
Agreed! Thanks for taking the time to look through this with me. Hopefully this will prevent headaches for others in the future 😄
I think that one's right. The LIS3DH needs to go first
oh, hmm, I thought it was the other way round. OK, maybe my expalnation is wrong
🤔
makes sense
Fortunately I think the code in the examples is fine, so anyone just working from that would probably never notice the issue. I do think it'd be worth a special note somewhere in the glasses guide anyway though
i will add one as soon as understand what is really going on
Yeah I was about to say, assuming the issue can't be fixed for whatever reason.
okay yeah I think I traced the code, and you're right
ok, this is a bit of a rathole: https://github.com/adafruit/Adafruit_BusIO/blob/master/Adafruit_I2CDevice.cpp. I'll look at this later.
where are you seeing the "don't change it"
sorry, not sure what you mean here
where are you seeing that the IS driver setting the speed to 400 kHz is not taking effect?
oh gotcha
so the begin() method in both the LIS3DH and the IS32FL classes call i2c_dev->begin()
That takes us to bool Adafruit_I2CDevice::begin(bool addr_detect), which finally calls _wire->begin()
in the IS32FL class, after that, it then manually sets the clock speed to 400 kHz
the LISD3H class does not do that
and the _wire->begin() call sets the speed to 100 kHz
ok, got it - I didn't see the last thing
so, that seems to support your theory that the IS32FL driver is setting the speed to 400 kHz, and then the LIS3DH is setting it to 100
got it. I'll add a warning box somewhere in the guide
Thanks!
Also as a further bit of confirmation, if I add Wire.setClock(400000) after initializing both objects, then the order doesn't matter.
@north stream @lethal yarrow update on trying to get separate cpp/hpp files to work:
I fixed it. dont know what this does, but it makes files in /src work.
in cmakelists.txt:
file(GLOB_RECURSE PROJECT_SOURCES ${CMAKE_CURRENT_LIST_DIR}/src/*.cpp) # NEW TO MAKE SRC FOLDER WORK
add_executable(projectname
main.cpp
${PROJECT_SOURCES} # NEW TO MAKE SRC FOLDER WORK
)
file(GLOB_RECURSE HEADER_DIRS LIST_DIRECTORIES true ${CMAKE_CURRENT_LIST_DIR}/src/*) # NEW TO MAKE SRC FOLDER WORK
target_include_directories(projectname PRIVATE
${CMAKE_CURRENT_LIST_DIR}
${CMAKE_CURRENT_LIST_DIR}/.. # for our common lwipopts or any other standard includes, if required
${HEADER_DIRS} # NEW TO MAKE SRC FOLDER WORK
i click compile, there are no errors. I don't know why, and can't find any documentation or tutorials or anything that explains why this works. all I know is that the glob_recurse bits are somehow finding relevant files in the src folder and passing them in to other config lines which existed already from the project generator.
so if any of you know what the heck this does, I am all ears :)
Ah, I did not know you were using cmake
Hi folks - I am a bit new to ESP32 programming to so go easy on me... hoping I have a silly question here... I am working with my FeatherS2 programming it with the Arduino IDE - everything I am doing works great with the board plugged into my computer but when I try to run it off battery (3.7v ICR18650) it doesnt seem like it is doing anything... I know the LDO2 needs to be enabled by setting GPIO21 to HIGH (which I have done) - but what else am I missing?
can you please post a pic of the battery and how it's connected to the feather?
Hey guys, bit of a question. I am usibng an Adafruit Huzahh ESP8266 to control some neopixels & run a webserver. For some reason, the board force-resets periodically every few minutes. I've tried a few different things to isolate the issue, such as reducing the number of neopixels & adding yield() invocations in case the neopixel code was taking too long and timing out the watchdog timer, but no luck. Any ideas? I can share code as needed ofc
Sounds like a power supply problem
Try running it at much lower brightness and see if the same thing happens. Is the strip powered separately or from the board?
The power supply is new, and I also had it connected to my computer over usb as well
I was able to narrow down the problem area to specifically when strip.show() is called (even though the wdt timeout is intermittent, every time it fails is during that call). I also noticed that it occurs regardless of the neopixel strip size, as I am getting the same issue with both a 10 pixel strip and a 144 pixel strip
I looked in the forums, and I see a few similar issues, but nothing definitive. The ESP8266 is quite limited in seveal ways. You might consider an ESP32-something. It does sound like the neopixel code is locking out something for too long
Do you think it might still be possible to resolve via a software work-around?
I do not know. You could upload your code here. Use the + to the left to upload the file. You could also ask in the forums, where the offical support people hang out.
Heres a repo I quickly made w/ the code:
https://github.com/kkingsbe/SmartStrip/tree/main
SmartStrip::tick() is called each time from the main loop, and after running for a few mins it hits the wdt timeout. (narrowed down to specifically the strip.show() call, which is within the NeopixelController class. Tested with 10 & 144 leds
do you have to make strip.show() be in a critical region? Does it mess up if you don't?
you are calling MDNS.update() a lot. I would think that is expensive.
If you make the strip length just one pixel, do you still hit the watchdog?
You could check out WLED and just use it or see how it codes similar stuff:
https://kno.wled.ge/
https://github.com/Aircoookie/WLED
I could definitely give that a try. How would I not call it wihtin a critical region? (I'm only familiar with that in the context of stm cores)
Does it need to be called as often or do you think I could get away with calling it once every second?
Just remove the cli and sei calls
Do you need mdns at all? Is this to advertise the server? I don’t think you need it to find clients?
Once every ten seconds might be fine. I really don’t know.
I’d do some web searching on this
Oh yeah initially I didn't have those, they were added for debugging this issue
Its running on my local network, didn't want to fool around with figuring out how to give it a static ip so I just went with wdns so it can have the same name each time (I have a few instances of this running on my network)
The NeoPixel library should be doing critical sections as it needs them, so I wouldn't add extras. I'd take that away, and also the wdt feeding. Then reduce the mDNS calls.
Ah I see, that makes sense. Also I just did some addtl digging and it looks like there is an mdns library specifically for the esp8266 😅. Will give that one a try and see how it works out
Hi all, trying to use Arduino as a standalone UPDI programmer for ATtiny816. I followed the example code for ATtiny817 https://github.com/adafruit/Adafruit_AVRProg/tree/master/examples/attiny817_updiprog
However, I cannot compile the project in Arduino IDE due to error:
avrprog.setUPDI(&Serial1, 115200, AVR_POWER); // can also try 230400
^~~~~~~
Serial
exit status 1
Compilation error: 'Serial1' was not declared in this scope
It's true that Arduino Uno doesn't have Serial1 interface, so this should fail. However, in this tutorial video from Adafruit https://blog.adafruit.com/2021/10/05/fast-standalone-updi-programming-library/, she could still use serial monitor and UPDI interface at the same time. I read the source code and I'm really sure it must use 1 serial interface for UPDI programming, and I don't think debug print can share the same serial interface as it willl break the programming messages. So what is the secret here that I don't know can someone please tell me? Thank you
Another question I have for this UPDI standalone prorgammer library is that if it's possible to program both eep file and hex file? If yes, how can I configure it in the images.cpp file?
I'd suggest to look into SoftwareSerial https://docs.arduino.cc/learn/built-in-libraries/software-serial/
But why Adafruit published the library that uses a totally different code from the code they used in the video?