#help-with-arduino

1 messages · Page 39 of 1

pulsar charm
#

I'll try it out now then, thanks again @north stream !

carmine sun
#

does anyone have a good resource to learn how to use pointers in arduino or how to read very large csv files from an SD card. I'm having a hard time gleaning much from the arduino documentation and forums

humble anchor
#

Are you talking about software serial on the arduino or on the Pc? @pulsar charm

north stream
#

Hmm, I use pointers all the time, but I don't know a good reference for doing so. Looking around a bit, I found this page https://www.dyclassroom.com/c/c-pointers-and-array-of-structures which mentions some useful details like arrays are actually pointers, strings are actually pointers, and uses the -> notation for pointers to structures.

#

For reading CSV files, you can either read a line at a time (break on newlines) and then split up the string with strtok() or whatever, or to save a little memory, you can read a token at a time. Note that if you have escaped commas or newlines, it's going to be trickier (also, there are at least four different ways of doing comma/newline escaping).

pulsar charm
#

@north stream software serial is really nice indeed

#

@humble anchor on the arduino!

#

I would probably be using it much more moving forward since platformio allows me simultaneous upload to two unos at once

#

and the library basically helped me to steer clear of the hardware serial pins

#

@carmine sun I find that writing your code in object-oriented(OO) forces you to really know how pointers are used

#

I think codeacademy has a new class and pointers course out but I think that just scratches the surface

#

but its a good introduction if you are just starting out

north stream
#

I tend to think of objects as having "handles" more than "pointers", as to me pointers are a low-level concept (a memory address), and objects abstract that away to classes, instances, and methods.

pulsar charm
#

I think in OO pointers to object instances was my big hurdle to understanding the entire concept

#

@north stream If I placed an LED on the TX software serial pin, will I get that blinky feedback

north stream
#

Yeah, the LED doesn't care how the pin is being driven, it just lights up if there's a voltage difference.

pulsar charm
#

awesome! I was starting to miss the heartbeart

#

cant believe it took me this long to use software serial

carmine sun
#

sorry, I just checked back in, thanks for the help

elfin kiln
#

anyone having trouble getting trinket m0 on arduino ide?

vale anchor
#

is it still the case in SoftwareSerial that you cannot receive bytes while you send bytes?

north stream
#

To install Trinket M0, you need to install both the Arduino SAMD board package and the AdaFruit SAMD board package.

elfin kiln
#

@north stream hi, I was able to get arduino but not adafruit

humble anchor
#

Follow this

elfin kiln
#

@humble anchor Ifollowed the guid but same problem

humble anchor
#

Do you have multiple json links in the third party board section?

elfin kiln
#

no just the one provided

humble anchor
#

Can you maybe give a screenshot of the boards manager with adafruit typed in?

elfin kiln
humble anchor
#

Aaah, you have installed it

#

The boards should appear in the list with the other boards

elfin kiln
#

but the only adafruit board is circuit playground

humble anchor
#

Could you sends a screenshot of the board list?

elfin kiln
humble anchor
#

And when you scroll down you still dont see it?

elfin kiln
#

@humble anchor thanks for the help, I just noticed there's an error message , I had a misspelling in the http

humble anchor
#

aaaah, that is bad

#

Sometimes there is also a problem

#

with connections or something

elfin kiln
#

It's there now thanks!

humble anchor
#

No problem!

proper forum
#

is the trinket 5v not plug and play with the ina219/vanilla i2c libraries?

proper forum
#

nvm I ripped out the Wire stuff and replaced it with TinyWireM

#

idk if that's a kosher solution but it works

pulsar charm
#

@vale anchor I'm not aware of that problem, but I don't really know how to test this either

#

SoftwareSerial seems to be working fine for me both ways

#

but there's always the issue of losing bytes as @north stream mentioned

#

I think software serial is great for any application requiring single byte data, otherwise you need to implement your own serial buffers and markers

north stream
#

I had to use a similar TinyWire hack when I was running a Crickit from a Trinket.

paper prawn
#

Does anyone know how to soft reset an M4 device in Arduino?

umbral bloom
#

Hi, I'm trying to install teensyduino on Arduino 1.8.9 fresh installed, but my pc says something like "version.txt doesn't match". I'm running pop os 19.04. What can I do?

umbral bloom
#

Correction: it says incorrect version format

humble anchor
#

@paper prawn Sure, plug the M4 device in and press the button on the board twice

#

This is will open up the bootloader and if you want you can for example flash it back to circuitpython

#

I am not sure if that was what you meant

#

Aah nevermind, you were talking about soft reset.
You can always attach an digital output to reset pin and just drive it high when you want to reset

#

Not the most elegant solution but it should work

north stream
#

@umbral bloom What does Contents/Java/lib/version.txt contain?

umbral bloom
#

It's fixed now

#

I reinstalled Arduino in /opt

umbral bloom
#

Oh well I got another issue now

#

I try to install teeonardu and it says this:

#

Hope it's readable

#

The GitHub about this says to upload this to get midi functionality

#

Cos I'm making a mini untztrument

humble anchor
#

@umbral bloom Seems like your made a mistake in your code

umbral bloom
humble anchor
#

Official teensy 2.0?

#

o nevermind

#

or do you want USB host capabilities?

umbral bloom
#

I'm just following what the mini untz guide says

#

I need teensyduino because I can upload midi code to it

#

If I don't then I can't upload

humble anchor
#

So you solved the problem?

umbral bloom
#

Nope

humble anchor
#

You can't upload midi code to the MidiUSB library?

umbral bloom
#

Tell you what I'll send a few pics of what happens when I try different stuff later

humble anchor
#

ok!

full bronze
#

Does anyone know what the blink codes of the LED#13 on Adafruit Feather 32u4 are? The LED next to the BLE chip keeps flashing three long red pulses. I'm having some other problems with it, wondering if that's related

past token
#

Between the MPU-9250 and the ICM-20948, which gyroscope would you guys recommend?

#

I plan to use it towards a rocketry flight computer

#

So performance and accuracy is necessary

mighty elbow
#

@pulsar charm okay so I got my new power supply in and the thermal priter STILL wont print

#

I have no idea why I can't get it working

#

its the right voltage and right amount of amps

north stream
#

@full bronze I think 3 blinks means the Bluefruit module is in Command Mode.

mighty elbow
#

the green light is blinking so the printer works

#

but its not feeding the paper out

#

okay So I tried my other usb printer but it prints gibberish

#

but at least it prints

pulsar charm
#

@mighty elbow I haven't ran my printer in a couple of years, I could do a check for you later. What sketch are you running?

umbral bloom
#

And I get the same errors every time

mighty elbow
#

@pulsar charm I’m running the test sketch

#

I have both the original and usb thermal printer

#

The usb printer does print but it prints gibberish

#

The TTL (I believe it’s called) printer doesent print at all

#

But it works

#

The light goes on it’s just not spitting out paper

humble anchor
umbral bloom
#

For the second is from teensy's USB midi guide

wraith current
#

@past token In the quadcopter scene it is generally believed that the MPU gyros are less noisy

humble anchor
#

Did you install Teensyduino itself?

#

Maybe use the example supplied with the TeeOnArdu

#

Teensy also changed some stuff around if you go to the bottom of their midi page

pulsar charm
#

@mighty elbow could you point me out to the particular model of printer you got from adafruit?

pulsar charm
#

mine seems fine! you might have to switch the RX/TX pins, its strange but their library refers to the RX_PIN as matching the RX_PIN on the printer

#

mine was initially pushing paper but not printing (the opposite of your problem)

#

you could use the button beside the ledpin to check if paper is able to be pushed

#

@mighty elbow also try running the printer directly to a switching power supply first to make sure it isn't a power supply problem you are dealing with. I noted that mine drew a max of 1.5A when pushing paper

mighty elbow
mighty elbow
#

I already messed around with the baudrate

#

It’s set at 9600

#

Which should be the correct rate

umbral bloom
#

@humble anchor Yes I did install teensy duino

mighty elbow
#

no idea why its printing out garbage

inland crag
mighty elbow
#

are these for the printer?

inland crag
#

yeah it's on the product page

mighty elbow
#

If so i havn't so let me do that

#

there are 2 .exe files I assume I just run those

inland crag
#

probably just the driverinstaller one

mighty elbow
#

got it

#

k installed

inland crag
#

hope that helps

mighty elbow
#

hmmm this is new

#

Invalid library found in C:\Users\Hindenburger\Documents\Arduino\libraries\drivers: no headers files (.h) found in C:\Users\Hindenburger\Documents\Arduino\libraries\drivers
Invalid library found in C:\Users\Hindenburger\Documents\Arduino\libraries\drivers: no headers files (.h) found in C:\Users\Hindenburger\Documents\Arduino\libraries\drivers

#

invalid library error

inland crag
#

hmm

#

honestly I have no idea I just found that driver link on the product page

mighty elbow
#

no problem, thanks anyway

#

okay fixed that but its still printing out garbage

pulsar charm
#

@mighty elbow so what's the problem with the serial printer

#

the usb-ttl one that I have

#

I can't tell you for sure what might be wrong for the mini-usb one because I don't have it

mighty elbow
#

The serial printer won't feed paper out

#

the usb one prints but it prints a jumbled mess

#

the serial printer won't even print a test page when i hold the button down

pulsar charm
#

its not supposed to print anything when you hold the button down, its just supposed to move the roller to feed paper

#

have you tried using just a bit of paper and see if the roller manages to push it?

#

like just run a sliver of your previously printed pieces through it

#

if it doesn't move its either your power output or its a faulty motor

sick latch
#

Hey a question about the ds3231 rtc breakout:
I query RTC.now to update the struct. I call now.year, and it returns the correct value (I set the rtc using an esp module, pinging a nist server). However, when I call now.unixtime, it gives me a timestamp 3 years in the future according to epochconverter.com

Why is now.year correct, but now.unixtime is giving me garbage?

sick latch
#

Update: I thought maybe some libraries were conflicting, so after removing time.h and timelib, it is now giving me a Unix timestamp only 4 months in the future lol

mighty elbow
#

@pulsar charm tried that just now

#

nothing

#

can't be the power, i baught and am using the very power adapter you suggested a while back

#

I have 2 basically new printers that I cannot get working

#

this is frustrating

#

one does print but its not printing the test page

#

its printing jibberish

pulsar charm
#

It's probably a bad motor then, contact adafruit? Have you tried to connect it to a switched mode power supply? Just run it at 5V and 2A. I didn't use the packaged adafruit power supply at all actually

mighty elbow
#

the supply I'm using is 5V 2A

#

this is the model that is currently working for me its just printing random characters

#

so maybe if someone could help me how to get this one working?

sick latch
#

Ok update: My ds3231 query code works perfectly on the Adafruit esp module, but the exact same code gives me a nonsensical Unix time on the Nano.

Anybody know where the error might be? Like is this a general compatibility problem?

north stream
#

Missing pull-up resistor?

#

Logic level mismatch?

#

@mighty elbow, you have two printers, and neither one will print the test page? How are you powering it on? Are you connecting the supply then plugging the supply into the wall, or are you plugging the supply into the wall then connecting it to the printer?

mighty elbow
#

@north stream here’s how it’s setup: I’ve tried plugging the supply in the wall and connecting the printer and the other way around

north stream
#

This while holding down the button?

mighty elbow
#

I can’t remember if I did or not

#

Why?

north stream
#

That's how you trigger a test page print.

sick latch
#

Ok I think I found it; the timeLib and RTCLib functions break each other

#

Yeech I wanted to use timeLib

mighty elbow
#

@north stream which method? Or does it matter if you plug it in one way or the other

north stream
#

I'm not sure if it matters, it may be an issue with the risetime of the voltage, so I'd try it both ways.

pulsar charm
#

@mighty elbow I think videos/pictures would go a long way, your wiring, your setup, the components being used. I find most of my problems by just rubber ducking the problem

mighty elbow
#

I’ll post some pictures next week and a video so you can understand everything clearer for sure

serene birch
barren scaffold
pulsar charm
#

@barren scaffold that's awesome!!!

serene birch
#

The problem is that it's triggered when a button is pressed, just like the gun itself.

#

Maybe you can help me a little....

north stream
#

The same basic approach: you have the loop() function check each button you want to monitor, and if it's time to update LED or servo parameters. Something like ```c
#define DONE 0xfe
#define ENDSERVO 200
#define SERVOINC 20
#define SERVODELAY 80
#define ENDLED 0x0f
#define LEDINC 0x01
#define LEDDELAY 130

static int curservo;
static int curled;
static unsigned long nextservo;
static unsigned long nextled;

void
loop()
{
unsigned long curtime;

curtime = millis();

if (digitalRead(BUTTON_A) == LOW) {
// check for curservo == DONE for not retriggerable
curservo = 0;
setservo(curservo);
nextservo = curtime + SERVODELAY;
}

if (digitalRead(BUTTON_B) == LOW) {
// check for curled == DONE for not retriggerable
curled = 0;
setled(curled);
nextled = curtime + LEDDELAY;
}

if ((curservo != DONE) && (curtime > nextservo)) {
curservo += SERVOINC;
if (curservo >= SERVOEND) {
curservo = DONE;
} else {
setservo(curservo);
nextservo = curtime + SERVODELAY;
}
}

if ((curled != DONE) && (curtime > nextled)) {
curled += LEDINC;
if (curled >= LEDEND) {
curled = DONE;
} else {
setled(curled);
nextled = curtime + LEDDELAY;
}
}
}

barren scaffold
#

Yep. Searching 'state machine arduino' should give good reference materials. https://www.instructables.com/id/Finite-State-Machine-on-an-Arduino/ shows something similar to the Adafruit one, and then moves on to this Yakindu software that lets you diagram and model the state machine ahead of writing code, but it looks like it requires Eclipse. Yakindu also appears to have some code-generation tools included to turn the state machine model into Arduino code.

Instructables

Finite State Machine on an Arduino: Today, we will implement a finite-state machine (FSM) on an Arduino. This allows you to set up systems with a precisely defined behaviour based on distinct states. You will learn what a finite-state machine is and what it’s good for. In a...

brazen idol
#

Why does the ide show the same com port many times?

cloud peak
#

Hi, I've got an issue with copying files from an SD card to a Feather M4's internal SPI flash. In the program I'm writing, I have a routine that is supposed to copy 27 different files from the SD card (inserted into a TFT Featherwing) to the internal flash, but it only copies the first 5 then just halts right when it starts the 6th. When viewing the internal flash in the Windows file explorer using the CircuitPython firmware, I can see that the first 5 files are there, the 6th file was created but is empty, and the drive label and all the default CircuitPython files that I left are gone. Could anyone help with this? I feel like there's something extremely simple and dumb that I'm missing :p
My code is here: https://paste.ee/p/dCQ7P (the routine in question is transferFromSDCard() on line 141)

north stream
#

I wonder if the file names come out even. Perhaps you're trying to read "6.sbi" and there's no file by that name (maybe there's a 06.sbi or somesuch). You might also try keeping the filesystem descriptors open instead of closing and re-opening them (there could be some weird caching behavior). There's a chance that the TFT updates are somehow causing issues with the SD/flash interactions. You could try adding some debugging (perhaps serial so if it is a TFT issue, you can catch it). Maybe count the transfers in the while loop and report that?

cloud peak
#

From a quick test I did, the code is able to catch if it's trying to read from a file that doesn't exist. I did try removing all TFT functions and having it only report over serial, and now it stops at 0.sbi at byte 33792. What's weird is that when it stopped, I wasn't able to interact with or close the serial monitor at all

#

I tried again after reformatting the flash with the circuitpython uf2, and this time it stopped at 4.sbi at byte 34816. You might be right with there being some kind of weird caching stuff going on?

rigid roost
#

Can someone please help this newbie out. I am working with a YUN shield ( dragino ) and trying to get it to save some data to the USB. I have tried everything I can find in the CC forums but to no avail.
I can access the http://192.x.x.x/sd and see files that I put there manually.
I have tried every option I can think of for the save path :
I tried some code from the public domain :
http://www.arduino.cc/en/Tutorial/YunDatalogger

humble anchor
#

What do you want to do exactly? @rigid roost

#

One thing you must understand is that this code isn't run on the Yun Shield, so that you can see the sd card in the browser doesn't mean the Arduino can see it

#

and reads the sensors from the Arduino, instead of having the arduino send data to the yun shield

rigid roost
#

Hi Bonnom. I will research the yun-code option. At this point anything is helpful. I am trying to record several digital and two analog inputs every 5 minutes to a file, and then every 30 minutes ftp that file to a web server. At the beginning of the project the Yun seemed like the ideal wifi device to use.
My code runs on a Uno, and uses the bridge library to communicate with the yun. I can upload the arduino code via wifi through the yun, so the only part that appears not to be working is saving files to the USB.

humble anchor
#

Files to the SD works? @rigid roost

#

The great thing about programming the Yun instead of the Arduino is that you can eventually do more advanced stuff like webpages

rigid roost
#

yeah the dragino Yun shield does not have SD, only USB. the original Yun board has a microSD on the bottom. I liked the idea of it serving its own pages. I am experimenting with power supply now, as the Yun will not run successfully using usb power on the Uno.

humble anchor
#

Earlier Dragino shields did have them.

#

So basically you need code to that writes to USB instead of microsd

#

Surprisingly hard to find stuff about that

#

I think I got it

pulsar charm
#

I think this is a job for a raspberry pi

humble anchor
#

Can you get to the root of Yun filesystem? @rigid roost

#

File dataFile = FileSystem.open("/mnt/sd/datalog.txt", FILE_APPEND);
This line writes to the sd card

#

but instead of "/mnt/sd/datalog.txt" you must change it to something like "/mnt/MYUSBDRIVE/datalog.txt"

#

Where myusbdrive is the name the yun gave your drive

rigid roost
humble anchor
#

Ok you see 'Mount Point'

#

You must change sd with sda1

#

In the example from Arduino

rigid roost
#

yes, I have tried all combinations of /mnt/sda1/datalog.txt

humble anchor
#

Hmm weird that it doesn't work

#

Do you have a folder in the drive?

rigid roost
#

I have created the /arduino folder in the root, and the yun symbolically links it to /sd

#

which I know is working as I can browse the /sd folder and see files I have manually placed in the /arduino/www folder.

humble anchor
#

can you try '/mnt/sda1/arduino/datalog.txt'?

#

Otherwise I'm out of ideas

#

I don't see any commands in Bridge to see if connection between Yun and Arduino is succesful

rigid roost
#

yes tried that path. the connection must be successful as I can upload the sketch via wifi through the yun. Its doing my head in. Been on it for a couple of weeks on and off.

humble anchor
#

Yeah, I don't understand it either. I would personally just try python at this point

sudden holly
#

I am having trouble using an M4 metro to perform I2C comms with an IMU (tried both BNO055 and FXAS2100) - I download example program using arduino-ide and once it starts to run it disables the COMM port connected to computer USB. Tried on a few computers with same result. This used to work fine on a plain Metro. Any ideas?

#

Also, If I use CircuitPython it works as expected - trouble is I can't use CircuitPython for this project - need time critical code execution and use of interrupts.

humble anchor
#

Official Adafruit library?

sudden holly
#

yes

humble anchor
#

Did you also install Adafruit Unified Sensor Driver?

sudden holly
#

yes

#

trying to use the sensorapi examples

#

I have even tried putting in pull-up resistors just in case

humble anchor
#

If you lose the comport how do you flash it again?

#

Reboot manually into the bootloader?

sudden holly
#

disconnect the SDA line or power down the imu

#

then the device reboots to look like its a drive to have bootloader installed

humble anchor
#

Owwww, check the wiring

#

Does the COM port get removed when you connect the sensor or when you flash the program?

sudden holly
#

I have even tried connecting to A4 and A5 with the same result

#

COMM port dies when I connect the sensor

humble anchor
#

With Wire.Begin(A4, A5);?

sudden holly
#

different code, but yes

humble anchor
#

Usually a 'com port dies' if there is a short somewhere, but strange that it worked with circuitpython

#

Basically the entire device shutsdown

sudden holly
#

I was thinking their may be an addressing issue - so I tried changing the I2C from default - but got the same result

humble anchor
#

Yeah, and when connecting SDA and SCL on the board should work just fine

#
SCL - the I2C (Wire) clock pin. There's no pull up on this pin by default so when using with I2C, you may need a 2.2K-10K pullup.```
You also did that
sudden holly
#

the IMU boards have their own pull-ups

humble anchor
#

This is from the M4 Metro pinouts page

sudden holly
#

but to answer your question I tried it with no difference

humble anchor
#

Can you also try using pin 2 and 3?

#

Or connect the i2C device to 2 random ports and see what happens

#

If it shuts down aswel

sudden holly
#

I plugged SCL/SDA from the IMU board into A2/A3 and things are still running

#

It is a really odd issue and has been perplexing me for a 2 days

humble anchor
#

Yeah, report it on the Adafruit ArduinoCore-samd, especially mention that it works just fine on Circuitpython

#

With a copy of the example code just to be sure, and connection diagram.

sudden holly
#

ok, thank you

humble anchor
#

or connection in words

sudden holly
#

going to reverify that circuitpython does still work, Friday was a mess, when I tried to change the bootloader back to arduino-ide, my comm ports on computer stopped workgin properly and required a reboot

humble anchor
#

Good idea!

#

In my experience when COM starts disappearing there is an short somewhere

feral pivot
#

please we send a code for oled screen serial text writing

humble anchor
#

@feral pivot that sentence doesn't make much sense. What do you mean?

feral pivot
#

ı m need make a watch with arduino but ı cant write time to oled screen

humble anchor
#

Is the connection between the oled and arduino: serial, i2c or spi?

feral pivot
#

I2C connection ı can connect arduino and oled screen but ı cant write real clock data

#

and ı sorry my english is very bad

humble anchor
#

You can write stuff like 'Hello' on the screen?

pulsar charm
#

does anyone know of a true random gist/library for arduino

feral pivot
#

ım used demo test code ı cant write nothing

pulsar charm
#

@feral pivot can you show us a photo of your wiring?

humble anchor
#

@pulsar charm Why do you need true random?

pulsar charm
#

@humble anchor Trying to mock some sensor output (because I didn't bring it home)

#

I wanted to do something like that:

void mockIonCount() {
  if (hue == 0) {
    hue = random(50, 180);
  }
  else {
    int8 rand = random(-2, 3);
    hue += rand;
  }
}
#

But I realized that rand runs on a moving average

feral pivot
#

wait please

humble anchor
#

Aah, you not looking for true random but a good random number generator

#

Have you tried randomseed?

#

It gives the same result everytime but it might do what you need

feral pivot
#

not ım write real time data only

humble anchor
#

Sorry was talking to @pulsar charm !

pulsar charm
#

@humble anchor Yeah I have, but should I be running it everytime I generate a random number?

north stream
#

I'll often use something a little unpredictable (reading from an unconnected analog pin or two) to seed a pseudorandom generator so it at least won't give the the same sequence every time.

humble anchor
#

You just want to have some example data right? People usually use randomseed

#

You can also use random with in randomseed

pulsar charm
#

let me try that right out right now

#

tragic, its still not random 😦

#
void mockIonCount() {
  if (hue == 0) {
    hue = random(50, 180);
  }
  else {
    randomSeed(analogRead(A0));
    int8 rand = random(-2, 3);
    hue += rand;
  }
}
#

and this is my output
251
137
157
177
197
217
237
123

humble anchor
pulsar charm
#

I think it might have something to do with the fact that I'm using a task scheduler

humble anchor
#

There is an example

pulsar charm
#

I've seen that, and I've got that in my setup as well

#

it doesn't seem to be doing anything

humble anchor
#

Do the randomseed in the setup only, I think

pulsar charm
#

yeah It's been actually in my setup this whole while

#

bah! Perhaps I should abandon mocking

#

its such bad code practice

humble anchor
#

Don't reset the randomseed!

#

Not sure if you did that, but I wouldn't do that

pulsar charm
#

I tried both to be honest

#

hmm

#

wait I found another stray randomSeed

#

let's see if this is the culprit

humble anchor
#

In the code you send, you did have the randomseed in a weird place

pulsar charm
#

ah ha!

#

its fixed

#

@humble anchor you're a lifesaver!

#

yeah ... I thought so as well

#

time to fire up my mesh experiment ⚙

humble anchor
#

No problem!

rotund gate
#

I'm working on programming a Trinket m0 with Arduino. When I go to upload the sketch, the trinket goes into bootloader mode (RGB led showing green) but arduino gives the error message sam-ba operation failed. Then, for the next 10 seconds or so, when I try to upload the sketch, i get a port busy error message. After that the sketch uploads without an issue. Does this have to do with the CircuitPython bootloader at all? (I'm totally fine with removing it completely). Would it help to use the burn bootloader tool in the arduino ide?

queen moth
#

I'm having an issue with an Feather Adalogger 32u4, I bought a dozen about a month ago, and having been using them slowly for a work project. All the other ones have worked perfectly, but when I opened a new one today, it seems dead. The battery charge led lights up, but no others, and it doesn't show up as a com port when I plug it into the computer. I have confirmed that it is a data USB cable. I have also tried all of the fixes on the feather help page, to no avail.

#

Am I missing something, or is it really dead?

hazy wadi
#

hello multi vers im trying to measure voltage using a voltage divider without using the arduinos drive voltage as a reference is this possible google is failing me today :/ ?

north stream
#

I'm not sure what you mean by using drive voltage as a reference. The Arduino has a couple of available reference voltages for its ADC circuitry, are you just using the default one?

hazy wadi
north stream
#

In any case, you can use a voltage divider to measure voltage.

hazy wadi
#

yes so he uses a voltage devider and then uses the arduino drive voltage to figer out a caebration voltage :/ but it meens if the drive voltage chages your output dose

north stream
#

I'm still not sure what you mean by drive voltage.

#

Perhaps the power supply voltage?

#

Generally you can just calculate the calibration, unless you're looking for higher accuracy.

hazy wadi
#

yes supply voltage . iv not found away to cacluate it as of yet :/

#

heres ther code the guy in the video ses to use float val = analogRead(A0);
float in = (val * 5.0) / 1024 ; // the end reading is linked to the power

float output = (in*2.020833333);// calibrationb voltage needs taking on new circut

Serial.println(output);

sinful saffron
#

Anyone know of a way to ensure an Arduino boots even with a connection to the RX pin present?

north stream
#

I'm guessing the first expression calculates the voltage at the pin, and the second one scales it to match the voltage divider (but it looks like it's backwards to me).

hazy wadi
#

it might be ill have to keeo looking

north stream
#

Nah, you have all you need, just that code makes things look more complicated than they are.

#

Just replace the second one with an equation to match your voltage divider (calculated from the resistor values) and you're done.

#

Something like ```c
float rlower = 1000.0; // 1kΩ lower resistor in voltage divider
float rupper = 10000.0; // 10kΩ upper resistor in voltage divider

int val = analogRead(A0);
float pinVoltage = (val * 5.0) / 1024; // calculate voltage at pin
float scaledVoltage = (val * (rlower + rupper)) / rlower; // calculate voltage into voltage divider

hazy wadi
#

hmmm think i tryed somthing like that before with no look ill go give it ago

sinful saffron
north stream
#

Note I had misremembered the equation so I edited my code above to be correct.

#

Unfortunately, "no luck" doesn't really give a useful starting point for debugging. What happened? Did it compile? Did it crash? Did it give the wrong value?

hazy wadi
#

i don't appeared to be getting it scaled right :/

#

float r1= 10000;
float r2 = 10000;

void setup() {
Serial.begin(9600);
}

void loop() {

float val = analogRead(A0);
float in = (val * 5.0) / 1024 ;
float out = (val * (r1 + r2 )) / r1;

Serial.println(out);

delay (1000);
}

#

5v = 1022 on the serial print

#

@sinful saffron thanks for the link i had already found that still no look i think im just missing something i might go to bed and try again in the morning

sinful saffron
#

are all the resistors correctly placed, and the pins correctly assigned

hazy wadi
#

ye from what i can tell

sinful saffron
#

Think this is what I had that worked

int voltageInput = 0;
float vout = 0.0;
float vin = 0.0;
float R1 = 92000.0; // resistance of R1 (100K) -see text!
float R2 = 9500.0; // resistance of R2 (10K) - see text!
int voltageRead = 0;

void setup() {
pinMode(voltageInput, INPUT);
}

void loop() {
VoltageRead();
delay(1000);
}

void VoltageRead(){
// read the value at analog input
voltageRead = analogRead(voltageInput);
vout = (voltageRead * 5.0) / 1024.0; // see text
vin = vout / (R2/(R1+R2));
if (vin<0.09) {
vin=0.0;//statement to quash undesired reading !
}
}

hazy wadi
#

i changed the math still no look its very late here im going to head to bed try again in the morning thank for your help

sinful saffron
#

alright, I'd just double check with the schematic when you get a chance

#

good luck with it though

north stream
#

Might not have the voltage divider grounded properly

pulsar charm
#

I just read up the teensy 4.0

#

that is one stupid fast processor

mild elk
#

Has anyone used ATmega 328PB with Arduino? Is it possible to use second I2C, SPI and UART?

humble anchor
#

The UART does seem to work according to Pololu @mild elk

#

But the hardware i2c and spi are not implemented

mild elk
#

This is bad news, I was planning to use this microcontroller from now on

humble anchor
#

You need 5V?

mild elk
#

But first I2C and SPI do work?

humble anchor
#

Very likely

mild elk
#

Ok, at least this is good
No, it doesn't have to be 5V
3.3V is also fine

humble anchor
#

But why do you want to use this chip in particular?

#

Why do you need two i2c and spi?

pulsar charm
#

dual screens perhaps

#

Does anyone here own a teensy

mild elk
#

Dual I2C is useful if you have two ICs with the same address and want to use both in a project. For example DS3231 and MCP3421 have the same address and can't be used on the same bus.

#

@humble anchor

humble anchor
#

I just use an TCA9548A in that case

#

But I agree it is more elegant to have two channels

mild elk
#

That's why I was hoping it will be supported

humble anchor
#

To bad that the new ARDUINO NANO EVERY doesn't have two i2c channels

mild elk
#

I have to do a little bit of research on how wire library works to maybe write some simple code for second channel on PB

humble anchor
mild elk
#

Yeah, this might be helpful
I'll start working on it as soon as I get my hands on 328PB

narrow thorn
humble anchor
#

But I think the problem might actually be in the Arduino core for the Atmega328PB @mild elk

mild elk
#

Why?

humble anchor
#

I am not sure, but I think they have to add a second i2c interface in it

mild elk
#

🤔 yeah, I'll definitely how to look into that. But first I'll get the chip and get it up and running on my breadboard.

humble anchor
#

But why not use a chip that does have build in support for multiple i2c channels?

mild elk
#

Like? Give me some examples

humble anchor
#

Also that github link I send you earlier about esp32 and two i2c channels

#

I thought there were problems with the SAMD21

mild elk
#

Honestly I don't know 😂
I really like 328 and feel like it still has a lot of potential I'm not using. I don't need anything more powerful, I just thought it would be nice to have some added functionalities like additional timers or serial ports.

humble anchor
#

To be honest it is a bit strange that 8-bit chips are still popular

mild elk
#

Why do you think so?

#

There are some applications where you don't need 32 bit CPU

#

And they are very easy to work with because they come in packages that you can solder yourself and not sometging like 100 pin BGA

#

Honestly I think it's a shame that 328PB doesn't come in DIP package

humble anchor
#

Because they are not necessarily more expensive or come large packages

mild elk
#

I'm not considering the price here
Then please tell me exactly which non-8bit CPU i could solder myself
Maybe you even convince me to leave 328

north stream
#

@pulsar charm I suspect a bunch of folks here own Teensys. I know I do.

#

NXP and others used to offer DIP packaged 32-bit ARM CPU chips (including one in an 8-pin DIP), but I think they've all been discontinued by now.

humble anchor
#

The new teensy 4.0 is pretty nice but it doesn't have analog output, and is fairly new. Not sure if it has the extra i2c channels implemented yet.

I like the ESP32 for a bit, but something can sometimes be a bit hard. For example the weird PWM commands.

The esp8266 is very popular and there are some sellers that sell boards at a really low price.

#

The esp32 and esp8266 also have wifi, the esp8266 has only one analog in port

mild elk
#

Ok, but let's say I want to build a wrist watch. I can't quite wear teensy on my hand, ESP32 is too big and ESP8266 is QFN package which I can't solder

humble anchor
#

You probably can if you are willing to learn and not have any physical limitations to do it

north stream
#

So, you want something smaller than an ESP32, big enough to hand solder, and has wireless connectivity?

mild elk
#

No, smaller than ESP32, big enough to hand solder and with two I2C interfaces

north stream
#

Is software I2C acceptable?

humble anchor
#

You can get ESP32 and ESP8266 modules

mild elk
#

No, I'd like a hardware port

humble anchor
#

ESP8266 doesnt have 2 i2c ports but the esp32 should have them

#

esp32-wroom module is pretty small, but might be to big

north stream
#

MSP430F5232?

humble anchor
#

But that is more of a prebuild thing

north stream
#

Why two I2C ports? You can parallel I2C client devices on the same bus.

mild elk
#

But if you have two ICs with the same address you can't

humble anchor
#

You know that you can order a MCP3421 with a different adress right?

mild elk
#

I do

#

I'm just giving an example

north stream
#

That's awkward. You could use an I2C multiplexor, but that's a whole additional chip.

mild elk
#

Yeah, that's probably the solution

humble anchor
#

An esp32-wroom module is to big?

mild elk
#

Yes

north stream
#

I ended up using an MSP430FR5969 once when I needed a bunch of serial and SPI ports.

humble anchor
#

I think the uChip would have been a board to your liking but to bad it didnt succeed

#

It is basically a SAMD21 development board in DIP package

pulsar charm
#

@north stream is using the teensy fairly straightforward? I currently don't have a need to drive 4000 leds at once, but I'm thinking of saving up for some hardware to drive much larger led matrices

north stream
#

Yeah, the Teensy is pretty easy to set up and use. I've built them into a bunch of projects.

pulsar charm
#

Time to add another board to the family then!

past token
#

speaking of the teensy, just got mine set up right now!

#

it's smaller than the arduino nano... they weren't kidding when they called it teensy

proper forum
#

trinkets tho

#

tiny bois

north kelp
past token
#

teensy 4.0 is weird

#

my serial output is inconsistent

warm zinc
#

t

carmine sun
#

Hello arduinites I'm having some trouble and am in need of some help.
I'm trying to create a device that reads a csv file from an sd card with times recorded on it, subtract the two times to determine a delay then send an a digital pulse to a mosfet to activate something else and finally take a temperature measurement from a thermistor and write it to a DIFFERENT file on the SD card.
Where I'm having trouble is opening and closing the two files on the SD card. How do I do this? I'm somewhat experienced in arduino but nothing crazy and I just cant figure out why I can't understand what I'm doing wrong.

#

Why does this not work?

#include <SD.h>
#include <SPI.h>

/* CSV File Reading */
File file;
int SC = 10;  //SC - Pin 53 Arduino Mega
char location;
long x;
//int e = 0;
long delayTime;
long readValue1 = 0.0;
long readValue2 = 0.0;

void setup() {
  // Open serial communications and wait for port to open:
  Serial.begin(57600);
  //SD Card Reader Setup
  Serial.begin(57600);
  if (!SD.begin(SC)) {
    Serial.println("begin error");
    return;
  }

}

void loop() // run over and over
{
    file = SD.open("datalog.CSV", FILE_READ);
  if (!file) {
    Serial.println("open error");
    return;
  }
  readSD();
  delay(delayTime);
  file.close();
}

bool readLine(File &f, char* line, size_t maxLen) {
  for (size_t n = 0; n < maxLen; n++) {
    int c = f.read();
    if ( c < 0 && n == 0) return false;  // EOF
    if (c < 0 || c == '\n') {
      line[n] = 0;
      return true;
    }
    line[n] = c;
  }
  return false; // line too long
}

bool readVals(long* v1) {
  char line[200], *ptr, *str;
  if (!readLine(file, line, sizeof(line))) {
    return false;  // EOF or too long
  }

  *v1 = strtol(line, &ptr, 10);
  if (ptr == line) return false;  // bad number if equal
  while (*ptr) {
    if (*ptr++ == ',') break;
  }
  //e += 1;
  return str != ptr;  // true if number found
}

void readSD() {
  readVals(&x);
  readVals(&x);
  readValue1 = readValue2;
  readValue2 = x;
  delayTime = (readValue2 - readValue1) * 1000;
  Serial.print("Delay Time:");
  Serial.println(delayTime);
}
#

And this DOES work?

#include <SD.h>
#include <SPI.h>

/* CSV File Reading */
File file;
int SC = 10;  //SC - Pin 53 Arduino Mega
char location;
long x;
//int e = 0;
long delayTime;
long readValue1 = 0.0;
long readValue2 = 0.0;

void setup() {
  // Open serial communications and wait for port to open:
  Serial.begin(57600);
  //SD Card Reader Setup
  Serial.begin(57600);
  if (!SD.begin(SC)) {
    Serial.println("begin error");
    return;
  }
    file = SD.open("datalog.CSV", FILE_READ);
  if (!file) {
    Serial.println("open error");
    return;
  }
}

void loop() // run over and over
{

  readSD();
  delay(delayTime);
  //file.close();
}

bool readLine(File &f, char* line, size_t maxLen) {
  for (size_t n = 0; n < maxLen; n++) {
    int c = f.read();
    if ( c < 0 && n == 0) return false;  // EOF
    if (c < 0 || c == '\n') {
      line[n] = 0;
      return true;
    }
    line[n] = c;
  }
  return false; // line too long
}

bool readVals(long* v1) {
  char line[200], *ptr, *str;
  if (!readLine(file, line, sizeof(line))) {
    return false;  // EOF or too long
  }

  *v1 = strtol(line, &ptr, 10);
  if (ptr == line) return false;  // bad number if equal
  while (*ptr) {
    if (*ptr++ == ',') break;
  }
  //e += 1;
  return str != ptr;  // true if number found
}

void readSD() {
  readVals(&x);
  readVals(&x);
  readValue1 = readValue2;
  readValue2 = x;
  delayTime = (readValue2 - readValue1) * 1000;
  Serial.print("Delay Time:");
  Serial.println(delayTime);
}
#

With the first portion my delayTimes are always 0, with the second one the difference comes out properly every time

warm zinc
#

I legit thought that said help with Arduino but I was wrong, I just pasted what I said there,in here

#

But could someone help me?

warm zinc
#

I cant think how to do this

past token
#

@warm zinc I think you should look into relay boards

warm zinc
#

maybe ill do it when i get more experience programming in c++ and arduino, im really new to this

#

i just got my kit yesterday

past token
#

Do these offsets look normal for MPU-6050 calibration?

#

The accZ axis looks concerning

barren scaffold
#

@warm zinc responded in the other channel, but yeah, need a relay.

warm zinc
#

okay, maybe i should do another project for beginners..

#

let me solder the dang fan back together now

woven mica
#

@carmine sun the problem with the first program is that you are always reading the first line of the CSV. Every time you open the file, you start reading it from the beginning.

#

To fix this, you can use File.seek(position) to change the position in the file you are reading from

carmine sun
#

omg thank you! is position just an integer? @woven mica

#

and does it read down the whole file or does it go line by line? My file will be several thousand lines long.

woven mica
#

The position is an integer - its value means how many bytes far from start of the file

carmine sun
#

ah dang, wont that slow my program down if it has to count a bajillion bytes before it gets to the one I want

woven mica
#

You can save your last position in a variable every time you read a line

#

And then next loop just seek to it

carmine sun
#

oh great is that just File.position() ?

woven mica
#

yes, that should be it

carmine sun
#

I'll give it a shot! if it doesn't work do you mind if I ping you again for input later?

woven mica
#

Well, I am going offline soon, but tomorrow you can ping me

carmine sun
#

okay cool thanks

woven mica
#

You're welcome

warm zinc
#

does anyone know any good tutorials that go in depth about c++?

carmine sun
#

Hello again, I'm still having trouble with the problem I previously stated. @woven mica suggested using file.seek and file.position but my data is not in a fixed width format and I'd have a hard time reading from it. Are there any other suggestions for methods to read specific values from a csv file on an sd card?

calm parcel
#

If you have irregular line lengths the only simple option for getting line X is to read the entire file up to that point.

carmine sun
#

Unfortunately my file is several thousand lines long

#

@calm parcel

calm parcel
#

what is your goal? do you need to read a random line in the file or always at the end or something else?

#

random == arbitrary

carmine sun
#

I'm trying to create a device that reads a csv file from an sd card with times recorded on it, subtract the two times to determine a delay then send an a digital pulse to a mosfet to activate something else and finally take a temperature measurement from a thermistor and write it to a DIFFERENT file on the SD card.

calm parcel
#

so you always start at the beginning of the file and need to handle every line?

#

in order

carmine sun
#

yes, I need to grab the first value of every line as a number

#

but if I made an array populated with thousands of values I'd run out of space very quickly

#

^that's a shorter, sample of the file I'll need to read

calm parcel
#

I think you should be able to open the file for reading at the beginning and never close it. Read a line, do stuff, repeat

#

do stuff would include saving the current value to be used as the previous value in the next iteration.

carmine sun
#

ah but you see, I need to read from 1 file and write to another and arduino does not like having the file open all the time. also if I lose power suddenly and have't closed the file I loose all the data I was gathering

calm parcel
#

you should not lose data in a file opened read-only.

carmine sun
#

but I will in the one I am writing to. Remember I'm writing to one file and reading another

calm parcel
#

call file.flush() on the file you are writing after each data point is written.

patent ore
#

would there be anyway to send shutdown signal to Odroid HC1 via UART ?

north kelp
wraith current
#

@carmine sun sounds like a rasberry pi would be better tool

heady hawk
#

Hello! I created 100 custom pcb around samd21 and w5500 Ethernet chip. Now I'd like to create unique ip/mac from the samd21 serial. In the datasheet they say

Each device has a unique 128-bit serial number which is a concatenation of four 32-bit words contained at the following addresses:
Word 0: 0x0080A00C
Word 1: 0x0080A040
Word 2: 0x0080A044
Word 3: 0x0080A048
The uniqueness of the serial number is guaranteed only when using all 128 bits.

And with the teensy I use https://github.com/FrankBoesing/TeensyMAC

Any idea to achieve something similar ?

Regards

#

Here is the PCB for the curious

frozen marlin
#

Hi Peeps, I'm a beginner and in a bit of a pickle. I have a RTC module connected to a UNO, I'm able to have it post the time to the monitor though I'm trying a "If statement and it's just not working. Any help would be greatly appreciated

#
String ReadTimeDate(){
String temp;
int TimeDate [7]; //second,minute,hour,null,day,month,year
for(int i=0; i<=6;i++){
if(i==3)
i++;
digitalWrite(cs, LOW);
SPI.transfer(i+0x00);
unsigned int n = SPI.transfer(0x00);
digitalWrite(cs, HIGH);
int a=n & B00001111;
if(i==2){ 
int b=(n & B00110000)>>4; //24 hour mode
if(b==B00000010)
b=20;
else if(b==B00000001)
b=10;
TimeDate[i]=a+b;
}
else if(i==4){
int b=(n & B00110000)>>4;
TimeDate[i]=a+b*10;
}
else if(i==5){
int b=(n & B00010000)>>4;
TimeDate[i]=a+b*10;
}
else if(i==6){
int b=(n & B11110000)>>4;
TimeDate[i]=a+b*10;
}
else{ 
int b=(n & B01110000)>>4;
TimeDate[i]=a+b*10; 
}
}
temp.concat("Date:") ;
temp.concat(" ") ;
temp.concat(TimeDate[4]);
temp.concat("/") ;
temp.concat(TimeDate[5]);
temp.concat("/") ;
temp.concat(TimeDate[6]);
temp.concat(" ") ;
temp.concat(TimeDate[2]);
temp.concat(":") ;
temp.concat(TimeDate[1]);
temp.concat(":") ;
temp.concat(TimeDate[0]);

if (temp.concat(TimeDate[4] > 13)) ;
  Serial.println("Yes") ;
return(temp);
}
carmine sun
#

Just a little formatting

String ReadTimeDate() {
  String temp;
  int TimeDate [7]; //second,minute,hour,null,day,month,year
  for (int i = 0; i <= 6; i++) {
    if (i == 3)
      i++;
    digitalWrite(cs, LOW);
    SPI.transfer(i + 0x00);
    unsigned int n = SPI.transfer(0x00);
    digitalWrite(cs, HIGH);
    int a = n & B00001111;
    if (i == 2) {
      int b = (n & B00110000) >> 4; //24 hour mode
      if (b == B00000010)
        b = 20;
      else if (b == B00000001)
        b = 10;
      TimeDate[i] = a + b;
    }
    else if (i == 4) {
      int b = (n & B00110000) >> 4;
      TimeDate[i] = a + b * 10;
    }
    else if (i == 5) {
      int b = (n & B00010000) >> 4;
      TimeDate[i] = a + b * 10;
    }
    else if (i == 6) {
      int b = (n & B11110000) >> 4;
      TimeDate[i] = a + b * 10;
    }
    else {
      int b = (n & B01110000) >> 4;
      TimeDate[i] = a + b * 10;
    }
  }
  temp.concat("Date:") ;
  temp.concat(" ") ;
  temp.concat(TimeDate[4]);
  temp.concat("/") ;
  temp.concat(TimeDate[5]);
  temp.concat("/") ;
  temp.concat(TimeDate[6]);
  temp.concat(" ") ;
  temp.concat(TimeDate[2]);
  temp.concat(":") ;
  temp.concat(TimeDate[1]);
  temp.concat(":") ;
  temp.concat(TimeDate[0]);

  if (temp.concat(TimeDate[4] > 13)) ;
  Serial.println("Yes") ;
  return (temp);
}
#

@frozen marlin shouldn't the return function not have temp in parentheses

#

like:

return temp;
#

also you didn't put any operations in your last if statement. it just sits there

frozen marlin
#

All good guys, figured it out

#

It's commented out now but yeah :/

#

Only reason I wanted to be able to hit it is so I can place the uno to sleep when I'm ready to code that in

#

@carmine sun for the formatting, do you mind if I ask how you did that

#

Thanks*

carmine sun
#

then ``` again

#

with your code inbetween

frozen marlin
#

Thankyou 🙂

carmine sun
#

try it out in dm with yourself or a trash server it works everywhere

#

also if you have extra long code use pastebin

frozen marlin
#

That was my next question haha

carmine sun
frozen marlin
#

Anyone familiar with the DS3234 (Sparkfun RTC Module). I have it all running fine but I'm not quite sure how I can just get it to run on the battery and not the 3.3 from the UNO?

mild elk
#

I have read DS3231 datasheet (the same chip but with I2C) and it says that it will work on Vbat if you just simply start communication with it so I assume it might be the case here as well. Give me a sec I'll get DS3234 datasheet
@frozen marlin

#

No, seems like I was wrong. DS3234 isn't accesible when powered with Vbat.

#

But I was right about DS3231: it CAN operate on Vbat.

#

I'm just not sure why would you want to run the chip from battery when external power is available

#

Also DS3234 should run on 5V just fine

rough geyser
#

I've adopted a library (the Adafruit_Thermal library) into my codebase so that I can modify it instead of editing the original. My goal is to fit it onto an ATTiny85.

For the project I'm working on I know there's a bunch of stuff I don't need like printing barcodes, character sets from languages other than english, etc, so those are easy wins.

My question is more of a fundamental arduino/cpp one: what kinds of stuff can I remove to save space?

Like I know that removing comments won't affect the space b/c the compiler rips them out, the pre-processor stuff like #define doesn't make a difference b/c by the time you're at compile those constants have already been replaced with their values (right?). Is there good stuff to look for chopping out to save space? Does stuff like shortening variable or method names make a difference (it doesn't because when it's compiled down to assembly it doesn't use the var names anyway, right)?

#

I'm assuming removing overloaded methods that I know I'm not going to call will help, correct?

barren scaffold
#

variable names shouldn't matter. I seem to recall there being a difference between using flash RAM and the other kind of RAM (can't remember the term) to store things.

elfin kiln
#

I'm using trinket m0 does it matter what ide programmer I use?

mild elk
#

I have a question: do You know if I could use additional functionalities on ATmega328PB by directly accesing the registers? I have a core installed that claims to support 328PB

wraith current
#

@elfin kiln Arduino IDE is usually the easiest but other IDE's will work (eg. VSCode, Atom )

crystal mesa
#

I know at least in the case of VSCode plugin that it requires the Arduino IDE and basically is a VSCode wrapper around that

#

As much as I love the VSCode editor, I personally found the combination a touch overwhelming and went back to the Arduino IDE

frank linden
#

@elfin kiln I use PlatformIO in VSCode and since using it I have never gone back to Arduino IDE. Personally I like the autocomplete it offers more than anything else, but it also has the benefit of not having to install various boards from the board manager as they are already added, much better file organization, and the ability to have your own formatting options just to name a few. I am by no means a professional programmer, or even an experienced one, and at first I did feel a touch overwhelmed, but the benefits of it outweighed the challenge for me.

crystal mesa
#

@frank linden wow, that looks a lot nicer than the plug-in I used previously. Does it automatically support Adafruit boards?

#

And does it have an integrated library manager?

pulsar charm
#

@crystal mesa yes, and yes

#

its essentially a wrapper built over the arduino-cli

#

getting libraries into your projects requires you to get a little more hands on

#

it has an integrated library with semantic versioning, that allows you to revert versions (like I had for the latest FastLED release that was breaking APA102 code) much easier than Arduino IDE, the catch is that the ones in the integrated library need to be registered, so not all are there

#

you could clone your one-off libraries into your projects, or manually expand your library include path to include your current arduino libraries filepath (ie ../Arduino/libraries) per environment that you are working on

#

its definitely a more fully-featured IDE over the Arduino IDE, and requires you to be more hands-on with fiddling about the platformio.ini file

frank linden
#

@crystal mesa Hope @pulsar charm answered your questions. The things to look out for when getting started with PlatformIO is to always '#include <Arduino.h>', use function prototypes if you declare the function after your code, and if you use a baud rate other than 9600 to declare it in platformio.ini as 'monitor_speed = 115200' or whatever speed you want, all of which Arduino IDE handles normally but outside of Arduino is very uncommon, and good code practice to get into. That will get you started with it and I hope you enjoy it as much as I have.

crystal mesa
#

@frank linden @pulsar charm I have downloaded it and am evaluating it right now.

past token
#

Hi guys, quick question!

#

I'm trying to read the temperature value from my MPL3115A2 sensor

crystal mesa
#

Okay, is it just me, or does PlO not support the Feather Huzzah??

past token
#

Which register do I need to request from to get the temperature value?

#

That would be the datasheet, on page 19 is where it lists all the register values

#

But there seems to be multiple registers related to temperature

#

Or should I disregard getting raw temperature values using Wire.h and just use the supported library instead?

rain horizon
#

really dumb question probably

#

but i have no idea how to fix this

pulsar charm
#

@crystal mesa have you downloaded the cores for esp8266?

wraith current
#

@rain horizon are you sure COM4 is the right port ?

rain horizon
#

I restarted my pc and it fixed

#

So nvm

mild elk
#

Always read error messages carefuly because they usually tell you what the problem is

frozen marlin
#

@mild elk Thanks kactus, I want to run it from battery so I can interrupt wake the arduino (battery powered to conserve power.

mild elk
#

This doesn't require the clock to run from battery. When arduino is sleeping it still needs power. Very little, but still. Battery is usually used to keep time when system power is discontinued ( when you unplug your arduino )

#

@frozen marlin

#

Also: how does your sleep function work?

frozen marlin
#

I place the Arduino to sleep using LowPowerDeepSleep, using the RTC as a interrupt. Under DeepSleep I thought that it would not supply enough power for the RTC hence why the battery comes with one.

#

(I should note I am new to Arduino)

past token
solar sail
#

"All digital pins have Interrupt capability" according to that image

mild elk
#

@frozen marlin the CPU isn't responsible for power delivery on the board. 5V is drawn from USB, 3.3V form onboard regulator which also runs from USB. Power will be available regardless of what is CPU doing. Your clock will still run even when CPU goes to sleep.

past token
#

@solar sail thanks! didnt notice that

half glacier
#

Hi all, is anybody available to give me assistance or guidance on how to create a specific thing for my project? its kind of detailed so i don't wanna bore everyone, all i'l say is its going into a power armour suit 😉 if anyone would be willing to help please can they let me know so i can brief them, thanks and sorry to disturb y'all 🙂

barren scaffold
#

Might as well start with a couple of details on what you think is most pressing right now, and post to the channel, either people will have suggestions or not.

wraith current
#

@half glacier if its not arduino centric then maybe #help-with-projects is a better place. But don't worry about boring anyone, people can just scroll past if they aren't interested.

half glacier
#

well i wanted to try and set an arduino up so as it boots up or whatever it uses a camera and has a live feed to a screen, without using wifi or anything? as well as putting an overlay over the top of the camera output on the screen. im not sure how it would work but that's why im askin you geniuses 🙂

humble anchor
#

@half glacier I don't really have experience with it. One problem is that a lot of cameras are really bad images.

#

What type of screen do you want? Like a large display or something small?

half glacier
#

Yeah thays the idea, its mean to be a grainy, scratchy ish image

#

And a small one

#

Maybe car satnav sized? It's to attempt to fit in a power suit helmet, if it dont work I'm gonna make up a board and jabe it all connected so I can understand how it works too, like a test rig

humble anchor
#

Yeah, using a larger screen wouldn't be in the scope of arduino

#

There is a Sipeed MAIX bit kit with LCD and camera available. It is relatively new and not very popular but it should be able to do it.
It might be a bit of a tricky project

frank linden
#

This sounds much more like a job for a Raspberry Pi, a Rasp Pi Zero could probably do it. I say this both because a Raspberry Pi has a camera port and video port, and is much closer to a computer you would normally use to do such a thing with, just a thought.

half glacier
#

I have a rpi with the camera module on at the moment, but it's just the same issue of struggling to understand code or any of the smart guy stuff lmao

humble anchor
#

Yeah Raspberry pi zero W is probably an easier option but that one doesn't have a buildin display connector, but you can try like a SPI screen.
Like 4 inch 320 × 480 pixels with SPI

#

The 'smart guy' stuff is usually just finding the right libraries

#

It would be a lot easier if OBS was on the raspberry pi

#

Basically you can easy overlays on that

#

Doesn't use OBS, that would have been so much easier

half glacier
#

Brilliant, il watch it later- as long as I doesn't require wifi connections at all then it should be fine

#

Space wise, it dont matter how much it takes up since this suit is around 8ft

#

I've seem on the rpi you can open camera view as a demo shot almost but idk any ways of keeping it open or making it open upon boot. Anyway this is arduino based chat so my apologies :)

#

Thanks for the help though!

barren scaffold
#

Any Pi will have a lot more room to play with than an Arduino on video, yes. I have an 800x480 screen (Hyperpixel) hooked up to all the GPIO pins on my Pi Zero W, and it runs Chrome and a light JQuery page without problems. Boots into a desktop and starts Chrome automatically. That could turn your overlay problem into a web programming exercise, if you can get the camera feed onto the web page. The web page doesn't have to be on another system, could be local to the Pi.

wraith current
#

@half glacier why not just skip the code all together and run a wire from the camera to the screen? Fpv drone gear is cheap, cameras, lcd screens, etc

frozen marlin
#

Thanks @mild elk

past token
#

the more i do embedded programming in C, the more i realize just how much i don't know about computers

#

how 2 not feel lost

solar sail
#

C is one of those things that I had to grow new wrinkles on my brain for (especially being my first programming language)

half glacier
#

Because I initially wanted to see I'd j ciud have it open it from boot up to go to a camera with a custom overlay without all that hassle of setup every time

barren scaffold
north stream
#

@past token It's true: C is a "low level" language, basically just a gloss on assember (which is, in turn, just a gloss on machine code). On the one hand, it's fast and enables you to do pretty much anything you want with the computer, on the other hand it's dangerous and tedious, as you have to deal with all the details explicitly. As for how not to feel lost, I would suggest starting small and building on that, don't try to build a big complicated system your first time out, just start with things like blinking LEDs and sending strings. Using libraries is great when they're available, they let you talk to a bunch of sensors without having to address all the details yourself. Using interrupts is more subtle and complex, and might take some real effort before you're comfortable with it.

past token
#

@north stream Thanks for your reply! I have been trying to communicate with my GY-521 sensor without the usage of any libraries. It was a tedious and frustrating experience, as I never really had experience working that low of a level before. I resorted to just using libraries, but I will still take a look at the source code and pick at it one by one to see how it works.

#

Also, I thought this video was pretty cool:

worthy thistle
#

Tagging @fluid nebula

#

also @pine bramble

surreal pawn
#

/Users/nick/Documents/Arduino/libraries/Arduboy2-master/src/Arduboy2Beep.cpp:50:19: error: 'ARCADA_MAX_VOLUME' was not declared in this scope
sine1.amplitude(ARCADA_MAX_VOLUME);

#

seems to be expecting it to be defined in Adafruit_Arcada.h, which I can't see that it was ever

dusty meadow
#

I'm assuming that its not...

#

I like to use snaps, and there is a snap for the 1.8.5 build of arduino, but not the newest. I wonder how easy it would be to snap the newest version...

gaunt stag
#

@dusty meadow If you have sudo rights, you can always fetch the tar from the official Arduino site. It has a simple install.sh that will handle the install for you.

simple horizon
#

I can't get my 0.96 tft connected to my esp32 feather properly. Does anyone know a fix?

#

I even tried 2/3 wire spi

wraith current
#

@surreal pawn you could try putting the following at the top of the sketch and see if it fixes it

#

#define ARCADA_MAX_VOLUME 1

surreal pawn
#

@wraith current that doesn't work because it's not my code that has the error, is cpp files in the arduboy beep or play tune libraries I listed

wraith current
#

If you put that define statement BEFORE you include any libraries, then it will replace any occurances of ARCADA_MAX_VOLUME with the value 1, even in other libraries.

surreal pawn
#

a fix would be to add a line like that to Adafruit_Arcada.h or Arduboy2Beep.h for example

#

I tried adding it to the top of the INO, didn't fix it

wraith current
#

@surreal pawn did you see this ? "These replace the existing libraries but add support for Arcada boards, for that reason, you should remove any existing libraries you have with these names!"

surreal pawn
#

I didn't previously have any Arduboy libraries

#

The only arduboy libraries I have are from the adafruit github

wraith current
#

sounds like it's a missing library somewhere

surreal pawn
#

I doubt it

#

that file only includes the corresponding Arduboy2Beep.h which only includes Adafruit_Arcada.h

wraith current
#

That's pretty crazy that there are ZERO google search results for ARCADA_MAX_VOLUME

surreal pawn
#

from what I can tell, no revision on that repository has had that symbol

wraith current
#

so maybe its in one of the other 12 libraries required

surreal pawn
#

I think ARCADA_MAX_VOLUME should be 255 because the Adafruit_Arcada implementation defaults volume to 255

wraith current
#

you could always modify the library to statically use 255 in that function call.

#

but most likely it's just the first of many errors if something is really missing.

surreal pawn
#

that's the only error I've run into. defining that symbol as 255 compiles and runs but I haven't checked if sounds are played correctly

wraith current
#

hope that works, good luck.

simple horizon
#

So I got the 0.96 tft to work on the itsy bitsy M0 but I want it to work on the esp32 feather. I put CS in pin 14 and DC in pin 15.

#

mosi and sck are in their respective spots.

pine bramble
#

Hey, I need help with arduino, I have a arduino due

#

I'm new to arduino but I saw a really cool project where you can combine the arduino with node

#

it uses firmata

#

on the github repo they dont list the arduino due, is there still a way to use it for this project?

#

I also have a genuino 101

barren scaffold
#

I don't see a listing for any particular Arduino at all at https://github.com/firmata/arduino , So I'd just give it a shot with either board and see if the basic examples work. If you've never done Arduino at all, you might want to start with the regular C++ code in the Arduino IDE, but maybe Firmata just works out of the box and would work better for you. No way for me to predict that ahead of time.

delicate coral
#

@pine bramble firmata just turns your due into a dumb peripheral. If I were you I'd just buy an uno to play with firmata, rather than trying to get the due working.

The due is a bit of a pain to get running with firmata. According to https://forum.arduino.cc/index.php?topic=606939.0 you need to:

  1. Connect the Due to your computer using the Programming port.
  2. Upload the StandardFirmata example sketch to your Due.
  3. Start the Firmata Test software.
  4. Select the Due's port from the Firmata Test software's Port menu.
  5. Press the reset button on the Due.

You can substitute your node app for the Firmata Test software.

delicate tartan
#

I'm looking at the Arcada examples (for the PyGamer) and I understand how to use the GFX library to draw primitives directly to the screen. I also see how to create a framebuffer with some other means (like calculating the values in the mandelbrot example) and then "blit" it to the display. The thing I can't get my head around is this: Can I use the GFX library functions to "draw" to the framebuffer instead of drawing directly to the display? I'm sure there's a way to do this, I just can't figure it out!

pine bramble
#

Thx

winter furnace
#

I'm having some trouble with the st7735 library where I have rainbow static for the last couple of pixels around the edge on two sides

#

oh, actually, it looks like I have a few extra rows

#

nvm, one sec

#

after drawing some outlines, it seems like my problem is that the display area starts at 1, 2 instead of 0,0 and then I have static for those lines on the other side of the display opposite the origin

#

I'm using the adafruit ST7735 library

#

this is a banggood special though, so I wouldn't be surprised at all if it's the display that's wonky and not the library

#

anyone seen it before?

#

easy fix 😁

patent marsh
#

Has anyone had success programming SAM devices over raspberry pi GPIO using OpenOCD?

#

I can get it to see the device ("Info : samd51j19a.cpu: hardware has 6 breakpoints, 4 watchpoints") but I can't get any code on the device successfully.

inland crag
#

I've got it working in the past @patent marsh but my config file is lost to the ages unfortunately

#

make sure your openocd version is recent

#

if you're on a debian variant installing from apt I would expect it to be an out of date version that doesn't have samd51 support

patent marsh
#

It's able to run source [find target/atsame5x.cfg]

inland crag
#

actually, now that I think about it, I might have had problems flashing over openocd too

patent marsh
#

But the program command gives me
Error: SAM: NVM programming error Error: Failed to erase block containing 00000000

inland crag
#

I think I used bossac for flashing and openocd for debugging

#

yeah you gotta mess with the lockout bits and even then it doesn't work sometimes

patent marsh
#

was bossac easy enough to use?

inland crag
#

yeah

patent marsh
#

I don't really care the tool so much as it being able to program on linux over raspberry pi gpio

inland crag
#

even better you can do it over usb on any computer

#

the command I usually use is bossac -e -w -v -b -R -o 0x4000

#

plus the filename

#

erase write verify (I forget what the b is) reboot offset 16k

sturdy bobcat
#

Okay, so I thought there wasn't a pre-flashed bootloader in the SAMs?

inland crag
#

yeah I got my wires crossed, I thought we were talking about adafruit ones

sturdy bobcat
#

Okay. Because, not at this very moment, but I'd love to be able to have an option for flashing SAMs and I'd meant to either do some experiments with OpenOCD or try out one of the flasher boards.

inland crag
#

jlink works pretty well

patent marsh
#

In my case USB is not an option

sturdy bobcat
#

The ambiguity of the jlink licensing bothers me because I'm far from a pro at electronics but I'd use it to manufacture lighting implements for art, which I have made money on.

#

Anyway.

patent marsh
#

I need to be able to flash over the cortex debug connector without an external programmer

inland crag
#

I'm not sure but maybe Black Magic Probe works too @sturdy bobcat

#

never tried

#

@patent marsh what do you mean by "without an external programmer"? no hardware probe?

vast cosmos
#

the black magic probe has pretty limited target support

#

i know for example the SAMD51 isnt supported

#

meaning all of adafruit's M4 boards

inland crag
#

I think adafruit may have an arduino script for flashing over swd but I don't know much about it

vast cosmos
#

@sturdy bobcat IMO that would qualify as commercial usage. i dont think they distinguish user experience or ability. but then again you could also argue you're usage is for hobby, and you use what youve learned personally for your professional endeavors

#

commercial usage is a pretty broad blanket -- if you -plan- to make money directly from the result of using their product, you are using it for commerce

#

i actually came here for a related question: i'm using my jlink debugger to figure out what's happening with some I2C comms, and its really bothering me how the current line in gdb keeps jumping around forward and back through the source code because of compiler optimizations. is there a way in arduino (1.8.9) to disable aggressive optimization altogether? i want to debug my program as close to source code as possible

#

this is on a grand central M4, btw, with its giant collection of compiler options in the arduino menu

inland crag
#

arduino isn't really made for debugging

#

you might be able to hack in some compiler flags idk

vast cosmos
#

but the least optimal compiler option is "small (-Os)"

#

yeah, where are the flags set? if i remove all -O flags, then it won't optimize (beyond whats necessary)

#

i'm used to just defining simple makefiles, i'm not real sure how arduino constructs its invocations to gcc

#

what do you mean arduino isnt made for debugging?

#

lots of arduino boards have JTAG/SWD pins dedicated specifically for debugging

inland crag
#

it's more for beginners who don't have swd probes

#

anyway, I can't find the compiler options either

#

again, it's for beginners

vast cosmos
#

thats awfully presumptuous, and overly generalized, but i know what you meaning

inland crag
#

why are you using arduino instead of regular c++?

vast cosmos
#

because i've had a headache trying to get a portable build system using anything other than arduino. i really only use it as a compiler, not as an editor (or debugger, if thats even possible)

#

what build toolchain do you use?

inland crag
#

gcc

#

or rustc 😉

vast cosmos
#

well, arduino uses gcc, that's not what i meant -- how do you invoke gcc/linker/assembler and flash your targets?

inland crag
#

make

vast cosmos
#

so you have to construct a unique makefile for every target and project? i would love to see your makefile template

inland crag
#

I don't actually do that much embedded C

#

but I have a non-embedded makefile template

#

somewhere I think

vast cosmos
#

well yeah, thats pretty trivial. that's what i use for my pc development too

inland crag
#

yeah I mostly do rust on embedded

#

cargo build --target=thumbv7m-none-eabi has me covered most of the time

vast cosmos
#

the actual template is near the bottom

inland crag
#

this is my template

# the compiler: gcc for C program, define as g++ for C++
CC = g++

# compiler flags:
#  -g    adds debugging information to the executable file
#  -Wall turns on most, but not all, compiler warnings
CFLAGS  = -g -Wall \
          $(foreach dir,$(LIBDIRS),-L$(dir)) \
          $(foreach dir,$(INCLUDEDIRS),-I$(dir))

# the build target executable:
TARGET = L6Q1 

# define the C++ source files
SRCS = L6Q1.cpp Point.cpp Tetromino.cpp

# define the C object files 
OBJS = $(addprefix $(BUILDDIR)/,$(subst .cpp,.o,$(SRCS))) 

# the libraries we are linking
LIBS = 

# the directories where we have our header files
INCLUDEDIRS = $(CURDIR)

# the directories where we have our libraries
LIBDIRS = 

# the directory where we will build
BUILDDIR = $(CURDIR)

# the directory where our source files reside
SOURCEDIR =  $(CURDIR)

all: $(BUILDDIR)/$(TARGET)

# create object file from c++ file
$(BUILDDIR)/%.o: $(SOURCEDIR)/%.cpp
    $(CC) $(CFLAGS) -c -o $@ $< 

# link libraries and create final executable
$(BUILDDIR)/$(TARGET): $(OBJS)
    $(CC) $(CFLAGS) $(OBJS) -o $(BUILDDIR)/$(TARGET) $(LDFLAGS) $(LIBS) 

# delete all the build artifacts
clean:
    $(RM) $(BUILDDIR)/*
#

pretty simple, no perl required

vast cosmos
#

only supports one language at a time 😛

#

and doesnt initialize any source files

inland crag
#

good enough for the girls I go out with

#

😉

vast cosmos
#

was that a personal comment?

inland crag
#

it's a quote from AvE iirc and I'm not going out with any girls at the moment XD

#

I'm not exactly sure what you mean by personal comment, but it was basically a jab at myself

patent marsh
#

@inland crag I mean a RPi connected via usb to something like an Atmel-Ice that is in turn connected to the microchip via 50mil, 10 pin, cortex debug cable a no-go. A Pi connected from the Raspberry Pi GPIO directly to the SWD connector is fine.

inland crag
#

that's a tricky limitation

patent marsh
#

I have the hardware connection figured out

#

It’s not the problem

inland crag
#

yeah I understand that

patent marsh
#

The problem is getting openocd to do more than just erase the chip and set bootloader protection but

#

bit*

inland crag
#

yeah I had troubles there as well

#

that's why I'm suggesting maybe this arduino flashing script might be a better option

#

openocd has issues

patent marsh
#

But I don’t understand why writing a bootloader seems so fundamentally different from just writing code that doesn’t need one directly to the flash.

inland crag
#

because there is protection to prevent you from accidentally overwriting the bootloader and bricking your device

patent marsh
#

Why on earth would overriding a bootloader brick a device? The whole point of debugger level access is that you can write the bootloader.

#

So if you overwrite the bootloader you can just write one again.

vast cosmos
#

what is happening with the complex wiring scheme to make you say "a no-go" ?

#

and sorry if youve already mentioned, but if you have a configuration that works, why do you need the more complex one?

patent marsh
#

I have an application that will have peripherals hooked up to it. These peripherals have chips in them that will need to be software updatable remotely. I do not have the assurance that all chips will come from a particular manufacturer nor is there a pre existing list of all chips that there might be. Some chips may be using JTAG or SWD or SPI. I do have the assurance that I have hardware access to the programming pins. Embedding a debugger like a Segger J-link may work but it would also raise the cost hundreds of dollars per unit and I can only really afford to buy a couple J-links, not like 30. On the other hand, OpenOCD theoretically already does all this and can do it over a Raspberry Pi's GPIO. I have a proof of concept that is tantalizingly close to doing everything I need but figuring out exactly why I can't put code on SAMD chips is proving to be a pain.

sturdy bobcat
#

Yah, my sympathies. I think the intention is to make it really hard to brick the device by overwriting the bootloader.

#

Can you write to other blocks of memory?

patent marsh
#

I don't even have a bootloader

#

and I can successfully overwrite the bootloader already

sturdy bobcat
#

OOoh, I missed that.

patent marsh
#

And calling
atsame5 booloader 0
turns off bootloader protections anyway

#

That bit works

#

similar commands work for other chips

sturdy bobcat
#

Hm. So, comparing what the OpenOCD code does versus the Adafruit DAP library, it looks like OpenOCD is trying to erase the chip block-by-block instead of doing a full chip erase.

#

Does a chip-erase command work?

patent marsh
#

I think so. I will check tomorrow.

#

It certainly stops all code from running but I can't remember if it runs error free.

sturdy bobcat
#

Yeah, like, that seems to be a really obvious bug if they wrote a broken block-erase.

#

Hm, no, they do a block-by-block erase as well.

#

Okay, so this is weird.

#

Here's what I think is going on, looking at the code:

#

If I search the file for more unlock-block commands, they aren't there.

patent marsh
#

I'll have to take a look at this more in detail tomorrow. It could explain some things.

sturdy bobcat
#

Yeah.

patent marsh
#

On the other hand I would think that it works on the E54, E53, E51, or the D51 or they wouldn't have committed the file in the first place

inland crag
#

I wouldn't bet on it

patent marsh
#

Obviously not every command sequence would be tested on every target clearly

sturdy bobcat
#

It wouldn't be the first time that I came upon some code where I was like "Wait, how did that ever work?"

patent marsh
#

but I would think you'd have some test hardware while writing some code

sturdy bobcat
#

Well, they aren't protecting any memory blocks.

#

You can also do a protect-check and see if it is, in fact, protected.

#

If they had been goinking with the device and had managed to get it all unprotected, the code won't protect it if they don't deliberately set it to.

#

..and I don't see an unprotect command.

#

This makes me want to get a SAMD51 of my own.

sturdy bobcat
#

So, if I'm right, the patch looks something like this:

#

/* Issue the Unprotect Block command. */
if (res == ERROR_OK)
res = same5_issue_nvmctrl_command(target, SAME5_NVM_CMD_UR);

gilded jay
#

guys

#

having hard time running a stepper motor and displaying a scrolling text smoothly at the same time

#

is it possible to do it on a huzzah esp8266 or "it is too weak"?

#

stepper motor needs to loop 4000 times with a delay of less than 1ms to run smoothly

odd fjord
#

What are you displaying your text to? the serial console? it takes a long time to write to the console. At 9600 baud it takes ~1ms per character!

humble anchor
#

Even more if you account for stop signal aswel!

patent marsh
#

Okay so I got it working sort of

#

The trick was to first write the image to the flash using atmel studio and a traditional programmer

#

then I connect to the target and the dump_image. I guessed at the size argument and just picked a number I thought would be larger than program and variable space.

#

then I can use flash write_image to write back the bits openocd found

#

Finally I run verify_image dumped.bin to check that all the bits made it there

#

this gives an error at first, error executing cortex_m crc algorithm but will continue on anyway after a little bit and say either something like verified 16777215 bytes in 54.900013s (298.433 KiB/s) or give a long list of sectors that don't match

#

if it says verified, you only have to power cycle the device and then the code from the recorded binary will begin to run.

#

curiously, reset run is not enough and you need a power cycle.

#

It's a clunky workflow and 55s is a long time to wait on programming but it does make remote code deployment without a debugger possible

sturdy bobcat
#

I really think it's a big with the protection bits not being frobned in OpenOCD.

#

Because any dev testing probably used a board that's been programmed a few times using the took

patent marsh
#

but flashing images works

#

I think it's just not handling variable space or other configurations the way atmel studio does

#

but if you read the entire memory space and write it back the same way, of course it will be the same.

#

which is what I'm doing

#

To find out what atmel studio does via their programmer I would probably need to hook up a logic analyzer and actually decode the swd commands. I can do that but it's also a bit lower level / more into weeds than I wanted to go.

#

I have a Saleae Logic 8 so it's not a hardware problem but I'm not very familiar with SWD so I wouldn't know exactly what to look for and I expect the bit stream to be a lot to unpack.

#

Note you do have to issue atsame5 bootloader 0 or programming will fail

sturdy bobcat
#

Sigrok has a protocol decoder for SWD.

#

But, yah, if it works.

patent marsh
#

Logic Pro has the protocol decoder I just don't know what actual words I'd be looking for

mild elk
#

I have ATtiny85 programmed as variable PWM generator with analogRead and analogWrite. But when measuring with my meter it tells me the frequency is only about 500Hz, but I need like 50kHz for my project. Is it possible to speed it up? Or should I stick with descrete logic?

#

I was able to get around 40kHz with descrete logic generator, but as you can probably imagine it's a lot more complex.

north stream
#

You can change the PWM frequency, but I don't know if it will go that high on that CPU.

#

Why do you need 50kHz PWM? Analogue filtering?

mild elk
#

Boost converter

north stream
#

Ah, that makes sense. I haven't tried using a CPU to control a boost converter, but I know it's possible (other people have done it), and I can understand the appeal of not having an additional chip.

burnt island
#

the default PWM is tuned for servos, which want 490Hz IIRC. I know an M0 can do a lot faster, but the attiny85 might be able to do better

random oyster
#

it seems the attiny85 can reach max of CLK_IO/256 for its PWM frequency. I believe clk_io can be the same as the core clock, so e.g. if you're running it at 8MHz, the max PWM frequency would be 8MHz/256 = 31.25 kHz. with this logic, to reach 500 kHz you'd need to run your attiny85 at 1.28 GHz 😄

burnt island
#

From the attiny85 datasheet:
" Table 12-3 on page 88 lists clock selection and
OCR1C values to obtain PWM frequencies from 20 kHz to 250 kHz in 10 kHz steps and from 250 kHz to 500 kHz
in 50 kHz steps. Higher PWM frequencies can be obtained at the expense of resolution"
So it sounds like it's capable of doing what you want, just not with the default ardiuno TC config

#
50 kHz PCK/8 0100 159 7.3```
mild elk
#

Ok, thanks for the info. Also: it's possible gor me to run ATtiny85 with external 16MHz crystal because I'm not using crystal pins.

random oyster
#

ahh, thanks for the correction, lumin! I totally missed that 😅

mild elk
#

So now I have a different problem: I hooked up the discrete logic generator, but I'm not able to get more that 15V on the output. And since I don't have a scope I can't verify what the generated signal looks like. I'm using 100uH coil, 1000uF capacitor, 1N5822 diode and IRF840 transistor.

north stream
#

This is a flyback type power supply? What's the input voltage to the coil? What's the coil resistance? What's the coil's saturation current?

#

Easiest change is to try a smaller capacitor, ideally a film or ceramic one.

#

Also, what's the ATtiny power supply? It takes several volts to turn on an IRF840 fully, and you may also be having issues with stored charge. Flyback power supplies have some fairly intricate requirements.

mild elk
#

Supply voltage is 5V to both generator and the coil. Coil resistance is 0.24 ohms. I don't have the coil's datasheet, so I don't know the saturation current. I don't know how to measure it either, but if you tell me how I might be able to tell.

north stream
#

Easiest check for saturation is if the coil or transistor are getting warm.

#

However, the transistor will also get warm if it's not getting switched quickly (enough gate drive current) and solidly (enough gate drive voltage).

mild elk
#

Neither the coil or the transistor were getting warm, even at 90% duty cycle.

#

It's a regular boost circuit, not flyback converter

north stream
#

I had thought all boost circuits were transformers, voltage multipliers, or flyback inductors, but perhaps I missed something?

mild elk
north stream
#

Not dumb, we all start as beginners. Yeah, that's a basic flyback boost converter (it turns out there are only so many ways to get out more volts than you start with).

mild elk
#

Good to know, hopefully I'll never make such mistake agin.

north stream
#

It looks like a really simple circuit, just 3 parts, but these boost converters turn out to be subtle and complex in operation.

mild elk
#

I built 555 PWM generator and it was able to get to 55V. Transistor got a little warm. It's still not enough though.

north stream
#

How much voltage are you hoping for? The 555 circuits tend to work fairly well, once you've ironed out the basics.

mild elk
#

I wanted to make a power supply for nixie tubes, so something around 180V

north stream
#

Heh, that was my guess. I'm a member of a nixie building mailing list, and we discuss power supplies on a frequent basis. 😃

#

Let me see if I can dig up the 555 one that's pretty solid (there are several 555 designs floating around that don't work well)

mild elk
#

My approach was to get a high voltage mosfet, pwm generator and hope it reaches high enough voltage, but seems like that's not enough.

north stream
#

It can be made to work, but as you've seen, there are several fiddly bits.

mild elk
#

Yeah, exactly
I just don't know what sets the voltage limit
Maybe I should use a mosfet gate driver?

north stream
#

I'm a big fan of gate drivers, especially for higher speed stuff like this.

mild elk
#

Maybe my diode isn't rated for that voltage?

#

Yup, that's correct

north stream
#

Could be. You need a fast, high voltage diode.

mild elk
#

Well, my diode is fast but not exactly high voltage

north stream
mild elk
#

They look really nice, but I was rather looking to build one myself. I know it's just making things harder though

north stream
#

Oh, I totally get that, I've rolled my own as well. It's a great learning experience, but it can be really frustrating. As Nick says on the page I linked above, "for a configuration like this, where the step-up is large, what becomes absolutely critical is component choice and board layout."

#

I had much better luck starting with 12V than 5V.

mild elk
#

I wanted it to be supplied from 5V because all logic runs on 5V and this would eliminate the need for additional regulator. But starting with 12V is probably the right thing to do.
Tomorrow I'm getting a different diode, that should hopefully help with achieving higher output voltage.

#

As for the board layout, the fact that it's built on a breadboard probably doesn't help either. I tried to keep everything as close together as possible.

north stream
#

It's possible to build high boost supplies on breadboards, but it's harder.

mild elk
#

I wanted to stick with breadboard until I get a satisfying voltage out of it

north stream
#

Yeah, debugging is easier/faster with a breadboard, it's just tricky with high voltage/high current/high frequency stuff. Since I'm guessing you're not using feedback, it should be somewhat easier. Sometimes running the high current loop (power supply, inductor, transistor, and back to the supply) separately with short heavy wire can do the trick.

mild elk
#

I'll keep that in mind, thanks

pine bramble
#

Hello.
I am using Adafruit-Fingerprint-Sensor-Library on R307 with ESP32 Arduino.
R307 can save 1000 fingerprint data.
But this library supports (#1-127=)127 data.
How to use 1000 data?

north stream
#

Looks like the slot is a uint8_t which might support up to 255, but presumably to support more, the variable type would have to be changed. It looks like the SEND_CMD_PACKET() method might adjust to that, but you'd have to check the documentation for the sensor to see if it uses a different format/procedure for addressing quantities that don't fit in a byte.

pine bramble
#

sorry, it supports 255 data

#

I know.

#

what can i do?

north stream
#

It depends on how far you care to dig into it.

pine bramble
#

umm...I give up...
I wait for someone to make it.
maybe it is impossible for me.

north kelp
#

@silk scaffold @lethal wigeon Is there a BSP for the Circuit Playground Bluefruit - ALPHA? Can't wait to take it for a spin! Happy to test.

pine bramble
#

@north kelp thx you.
But I decided to put up with 255 data...

rotund dust
#

HELP which board do I use for the new CPX BFE?

#

I've tried Bluefruit Feather nrf52840 Express and CPE. I'm on Win 10 Arduino 1.8.21.0

#

OK Hold on

#

Serial Monitor shows temperature and responds to button pushes using the Feather.

#

So, even though Win 10 just beeps and shows no evidence of the board, it's there

#

Sweet, Light sensor, temperature, x,y, and z slide position. SWEET!

#

Now if I can just remember how to code in Arduino. 🙂

#

Huh? CPLAYBTBOOT just showed up in my Windows Manager

#

That's a good thing. Right?

#

Tried to upload, buncha red text about bootloader not the same. So,..

inland crag
rotund dust
#

Thanks. I was just about to go that route after reading the text file on the CPX. DUmmy me.

rotund dust
#

Time to knock off for tonight. I can't get that board in the Board Manager. Thanks for the help though @inland crag

inland crag
#

yw, I think you can copy the entire nrf52_arduino from github into some magic arduino folder

#

then it should work

rotund dust
#

Humm, I thought of something like that. I'm just not that familiar with drilling around in the github. I thought adding the url would be all it took but all I got was a Nordic nRF52840DK (PCA 10056). All I can get is port busy or not found depending upon if I'm in bootloader or not

inland crag
#

it probably hasn't been released yet or something

rotund dust
#

Well thanks for your time @inland crag , my brain cell is fried so I'm gonna go Watch Big Brother...

inland crag
#

lol

#

yw

inland crag
#

@rotund dust next time you're feeling up for it you should be able to download the github as a zip and extract it here C:\Users\<username>\AppData\Local\Arduino15\packages\adafruit\hardware\nrf52\0.12.0

#

no git skills necessary

shadow bronze
#

can't wait to give QT a try

tidal turret
#

Hi

#

anyone work with NeoPixels strips?

#

i need help f

bleak glacier
#

@tidal turret there is the Adafruit neopixel über guide in the Adafruit learn section on their site for reference. What board are you using and what kind of setup do you have - power and number of pixels? What problems are you having with the neopixels?

errant geode
#

How much current can i deliver to ir diode? For white diode it is about 20mA, but how about ir?

errant geode
#

And another question, how much voltage can generate ir receiever? And what resistor i must ude to connect it?

tidal turret
#

@bleak glacier man i know that allredy, my problem is too slow arduino reaction

#

i need to turn off 150 leds like 1 2 3 4 5 6 7 8 9 and turn off 1 turn on 10 turn off 2 turn on 3

rotund dust
#

Good morning @inland crag , thank you for the Github lesson. I'm getting started on it as we speak it is extracting. Thanks again. New day, blond brain cell is fresh, hoping things go better. 🙂

#

YAY!!! Serial monitor on a CPX BFE at 9600 baud com 10 out of the box!!!!!!!!

#

aaannndddd we're.......BLINKING!

#

Commence happy dance.

#

OK. Now the real work starts. Do something with two of these.

#

Last night I was feeling like I ripped off a real developer by snagging these two.

#

Thank you @inland crag for help and encouragement.

winter furnace
#

@tidal turret how much slower is it than you need?

sly oak
#

@bleak glacier Do you know - are there problems driving NeoPixels from Arduino because of 3.3v vs. 5v?

#

I.e., NeoPixels seem to expect 5v for both power as well as the digital signal. And Arduino boards all seem to maybe produce a 5v power supply, but never 5v digital pin output

pine bramble
#

@sly oak They can run on 3.3v despite what the datasheet says.

#

Ref. D1 and D4.
D1: D8_NEOPIX on package pin 38 (PB23) of ATSAMD21G18. That's a 3.3 v GPIO pin.
D4: D8_NEOPIX - data input to the NeoPixel array on the Circuit Playground Express.
Note that it's 3.3v all around.

#

Almost all of the time, you can get away without the 74AHCT125 line driver, and just use 3.3v throughout. The NeoPixels are fairly reliable when used in this way.
It's quite possible the manufacturer knows of the issue and just goes ahead and makes them (barely) operable at 3.3v - they're fine that way, in practice.

#

The only thing you must not do is mix voltages (do not use 5V NeoPixel supply with a 3.3 v GPIO pin!)

trim bane
#

I have just received my Adafruit Gemma M0 and want to use SoftwareSerial.h however it says no such file or directory. When i compile for my Flora it works, any idea why this library cannot be used with the M0?

pine bramble
#

I think you just Serial1.begin(9600);

trim bane
#

its for a SRF01 and in the documentation it uses: SoftwareSerial srf01 = SoftwareSerial(SRF_TXRX, SRF_TXRX);

pine bramble
#

Do you have a link?

trim bane
pine bramble
#

Yeah that's single pin serial.

trim bane
#

correct, can the M0 only run 2 pin? looks like RX TX runs separate?

pine bramble
#

I think I did a demo once, or at least read up on it enough that I was 'about to'. ;) Pretty sure it can be done.

trim bane
#

ok i really hope so, my flora died so i bought the Gemma hoping i could make prototype a bit smaller 😄

pine bramble
#

The thing is, there's very few pins brought out on Gemma. You may need to prototype on a 'full' M0 board with lots of pins, solve the existing problems, then see if it will go on Gemma (may not).

trim bane
#

yeah so all i need is 1 vibration motor and 1 SRF01, i have everything working on the flora that decided to suicide and didnt research enough on the M0, just saw serial was available and got super excited. its a simple sensor for my friend who is blind.

pine bramble
#

I used half duplex USART SAMD21 in Google as my search terms.

pine bramble
#

The more I remember, the more I think that the first link I gave is where I was going with this.
I don't remember who was working on this (or when). I think we got pretty close, though.

trim bane
#

thanks so much, ill have a read. its looking quite complex i may have to go back to the flora 😛

sly oak
#

thanks @pine bramble!

waxen flare
#

Has anyone effectively used python on arduino? or is it a rarity?

lost nest
#

@waxen flare Which arduino? Circuitpython is a thing, but not for every Arduino. 8-bit microcontrollers are not particularly conducive to more complex interpreted languages.

inland crag
#

there is snek though

waxen flare
#

I am using the arduino uno right now.

#

I have a project in mind, and I'm on the fence if I should just by circuit python or not.

#

My power went out. Thanks for your patiencs

#

patience

wraith current
#

@waxen flare if the libraries you need are available and robust in circuit python then use it if you like it better than Arduino

odd fjord
#

CIrcuitPython cannot run on an Arduino Uno. Not sure if that is what you were asking.

vernal knot
#

away the IDE and installed a fresh copy with the adafruit AVR boards and Arduino AVR boards. I have checked my hardware cables and just can't figure out what is going wrong.

#

Just swapped over to usbtinyisp and checked that programmer, still getting an error about not being able to find a board. Is it probably a hardware issue or is there something wrong with my libraries?

wraith current
#

Windows? Did you install the driver?

vernal knot
#

Mac OSX.

#

Now it's throwing "the selected serial port
does not exist or your board is not connected". I'm gonna try another usb, hopefully that fixes things.

vernal knot
#

Alright I've attempted with 8 different usb cables and I've googled around for a bit. Still can't figure it out. Latest arduino with Adafruit AVR libraries. I'm just wondering if maybe I have a bad board?

rotund dust
#

What editor are you using?

#

Your issue sounds like one I had when I was using an outdated version of Mu.

vernal knot
#

Alright figured out the issue. Red light wasn't flashing, totally sorry haha! Thank you all for the help!

north kelp
#

Does the LED pulse when you plug it into your Mac?
That indicates the bootloader is active and ready for upload. But if you wait too long, it will time out.

vernal knot
#

Yeah that was my issue. I saw the LED come on and then turn off, I didn't realize you had to hold to get the bootloader to kick in

north kelp
vernal knot
#

Awesome. Thank you all so much!

north kelp
vernal knot
#

I did see that, and I've used M0 before. I am working with parts purchased through my university and so I'm glad I figured it out. I will definetley be using the M0 in the future!

pine bramble
#

Hello, I'm Arduino beginner.
It is first touch to C++
I can't understand how to send data (ex. string = hello world) via BLE. (Client[Central] = ESP32, Server[Peripheral] = Another ESP32)
Paring is success.

mild elk
#

🤔 maybe if You are a beginner try doing something simple first to get familliar with C++. Also look for some example sketches on the internet because they might help you.

humble anchor
#

I disagree, you barely need good knowledge of c++ to program Arduino.
For beginners it is usually easier take examples and adept them to your own need

#

Bluetooth can be a bit problematic to work with

#

Maybe don't use string but instead use char* var = 'hello world'

pine bramble
#

Thank you.
I'm so studying now.
I try to search again.

mild elk
#

Yeah, it's true, you don't need much knownledge, but when I do something I always start with the simplest things.

cerulean stratus
#

I thought arduino was C, not c++

humble anchor
#

It is actually a subset of c and c++ @cerulean stratus

cerulean stratus
#

Gotcha

fallen fog
#

Hi

#

i'm having some trouble with my code

#

and was wondering if anyone could help

#

i'm working with a dht11

#

and in my code

#

there is an error that says

#

dht does not have a name type

#

can anyone help

north stream
#

Sounds like a reference to a library class method that doesn't exist?

fallen fog
#

Arduino: 1.8.9 (Mac OS X), Board: "Arduino/Genuino Uno"

sketch_aug28f:9:1: error: 'dht' does not name a type
dht DHT;
^
/Users/visal/Documents/Arduino/sketch_aug28f/sketch_aug28f.ino: In function 'void loop()':
sketch_aug28f:48:6: error: expected unqualified-id before '.' token
DHT.read11(dht_dpin); // Reading data from DHT11
^
sketch_aug28f:52:20: error: expected primary-expression before '.' token
Serial.print(DHT.humidity);
^
sketch_aug28f:55:20: error: expected primary-expression before '.' token
Serial.print(DHT.temperature);
^
sketch_aug28f:61:9: error: expected primary-expression before '.' token
if((DHT.temperature < 26) && (DHT.temperature >= 23.2)) // Writing the LED colour pins HIGH or LOW to set colours
^
sketch_aug28f:61:35: error: expected primary-expression before '.' token
if((DHT.temperature < 26) && (DHT.temperature >= 23.2)) // Writing the LED colour pins HIGH or LOW to set colours
^
sketch_aug28f:71:10: error: expected primary-expression before '.' token
if((DHT.temperature < 23) && (DHT.temperature > 20.2))
^
sketch_aug28f:71:36: error: expected primary-expression before '.' token
if((DHT.temperature < 23) && (DHT.temperature > 20.2))
^
sketch_aug28f:82:9: error: expected primary-expression before '.' token
if((DHT.temperature < 20) && (DHT.temperature > 17.2))
^

#

sketch_aug28f:82:35: error: expected primary-expression before '.' token
if((DHT.temperature < 20) && (DHT.temperature > 17.2))
^
sketch_aug28f:94:9: error: expected primary-expression before '.' token
if(DHT.temperature <= 17)
^
Multiple libraries were found for "DHT.h"
Used: /Users/visal/Documents/Arduino/libraries/DHT_sensor_library-1.3.7
Not used: /Users/visal/Documents/Arduino/libraries/DHT-sensor-library-master
exit status 1
'dht' does not name a type

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

north stream
#

Ah, that's different from not having a name type.

fallen fog
#

im sorry

north stream
#

Looks like a missing instance declaration

fallen fog
#

how would i fix this?

#

i generally dont have much of a clue

north stream
#

It's trying to use dht as a class name, and it isn't defined. I'm guessing either a missing include statement or you need to use a different type name.

fallen fog
#

oh ok

#

thank you

#

i see where that takes me

north stream
#

Where did you find the code you're using?

fallen fog
#

i got this from a website