buzzing mindfulness bracelet code plus some new functions

CircuitPython on hardware including Adafruit's boards, and CircuitPython libraries using Blinka on host computers.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
User avatar
adafruit2
 
Posts: 22111
Joined: Fri Mar 11, 2005 7:36 pm

Re: buzzing mindfulness bracelet code plus some new functions

Post by adafruit2 »

correct

User avatar
bozzaglia
 
Posts: 131
Joined: Mon Aug 01, 2022 6:14 am

Re: buzzing mindfulness bracelet code plus some new functions

Post by bozzaglia »

So here is an update: I just got delivery of a Feather nRF52840 express, and I am switching to this board as suggested. I was looking at the pinout to solder my connections and I am in doubt whether to connect the transistor to one of the “A” pins (A0 to A5) or one of the “D” pins (D5 to D13). I am not familiar with this so I get easily confused. On the Gemma I was using a “D” pin, whereas on the QT PY it was an “A” pin... this board seems to have both and to make it more complicated “D” pins are only marked “D” on the diagram but they are just numbers 5 to 13 (without the “D”) on the board... please help!

User avatar
dastels
 
Posts: 15608
Joined: Tue Oct 20, 2015 3:22 pm

Re: buzzing mindfulness bracelet code plus some new functions

Post by dastels »

Generally, any pin can be used as a digital output. A pins can be used as analog inputs (A0 often is a true analog output) but D pins are only digital. It makes some sort of sense IMO to start with the D pins for digital I/O. Dropping the D means pin labels take up less space, aren't as crowded, and thus easier to read. The guide goes over everything in detail. https://learn.adafruit.com/introducing- ... 40-feather.

Dave

User avatar
bozzaglia
 
Posts: 131
Joined: Mon Aug 01, 2022 6:14 am

Re: buzzing mindfulness bracelet code plus some new functions

Post by bozzaglia »

dastels wrote: Wed Sep 28, 2022 1:36 pm No, that part is good. Negate the switch value for remounting:

Code: Select all

storage.remount("/", not switch.value)
Dave
Dave, I have a question regarding your quoted suggestion from a while ago. I just got a new feather nrf52840 express (to replace the last one, which I fried with a wrong polarity battery) and am trying to finish up my project. I am planning to use the on-board button (labeled “switch” in circuitpython) to record my feedback, but I am encountering a potential problem when using that same button to make the file system writable by circuitpython through the boot.py file. That is when I hold down the button while resetting to make the filesystem writable, instead of that I get the preset function of the button, which is to launch the bootloader.
I am thinking to overcome this issue by reversing the logic of the boot.py as you previously explained to me, however I am worried that if I do that I will never be able to reverse it and make it writable by my pc because pushing the button + reset will only launch the bootloader.
And I would really like to avoid installing an external button which would make the whole project bulkier.

Any suggestions?

User avatar
dastels
 
Posts: 15608
Joined: Tue Oct 20, 2015 3:22 pm

Re: buzzing mindfulness bracelet code plus some new functions

Post by dastels »

You are correct. You'll need another button for managing the writability of the filesystem.

A buttonless option is to put headers sticking up on the adjacent GND & A0 and use A0 as a digital input in your boot.py. Ether by using regular header on the top of the board or using long headers (https://www.adafruit.com/product/400) for pins on top & bottom. Then use https://www.adafruit.com/product/3525 to connect them when you want A0 to be LOW when starting up (mounting the filesystem as appropriate).

Dave

User avatar
bozzaglia
 
Posts: 131
Joined: Mon Aug 01, 2022 6:14 am

Re: buzzing mindfulness bracelet code plus some new functions

Post by bozzaglia »

Got it :-( and I’ve already ordered the shunt jumpers.
Unfortunately my board’s GND pad is already occupied by a wire going into the transistor and I need both the wire and the header that I will add to be on the upper side of the board.
Any tips about how to solder them together?
I thought about removing the black plastic spacer from the header and solder the wire to the base of the header. However without the spacer I might get the header sticking out to a different height compared to the one on A0. I might have to cut the tallest so they are both at the same height.
Any better idea?

User avatar
dastels
 
Posts: 15608
Joined: Tue Oct 20, 2015 3:22 pm

Re: buzzing mindfulness bracelet code plus some new functions

Post by dastels »

Remove the wire. Solder in the header so the long part of the pin and the plastic piece is on the top of the board (so soldering on the bottom of the board. Solder the wire on the the bit of pin the protrudes from the bottom of the board.

Dave

User avatar
bozzaglia
 
Posts: 131
Joined: Mon Aug 01, 2022 6:14 am

Re: buzzing mindfulness bracelet code plus some new functions

Post by bozzaglia »

Hi Dave, so it seems that I have everything pretty much working now.
I also installed the Bluefruit Connect App and added the code necessary to connect the board to my iphone.
The only piece still missing is the capability to read (I don't need writing, just reading) the mindfulness_log.txt file stored on CIRCUITPY throught BLE.
I did some research and it seems like something that needs some work to be implemented.
So far I could find this project which might be able to do what I want:
https://github.com/adafruit/Adafruit_Ci ... e_Transfer

for but could you please confirm it would work or suggest a different (easier?) approach?
Thanks!

User avatar
dastels
 
Posts: 15608
Joined: Tue Oct 20, 2015 3:22 pm

Re: buzzing mindfulness bracelet code plus some new functions

Post by dastels »

I can't confirm absolutely, but it looks like it's what you want.

Dave

User avatar
bozzaglia
 
Posts: 131
Joined: Mon Aug 01, 2022 6:14 am

Re: buzzing mindfulness bracelet code plus some new functions

Post by bozzaglia »

Ok! I had a closer look at the instructions to implement the service and there are several things that are obscure to me…

1) there is a paragraph titled “installing from PyPI” (see attached screenshot) but I am not sure which of the cases described, applies to me. Each case shows some code… do I have to paste it into my code.Py file? It says “python3” somewhere and I am unsure if that is circuitpython or python…

2) Am I supposed to paste some other code into my code.py file? The subsequent paragraph has some examples of code but it looks very long and complex and I don’t know if I have to paste it all or just a part (I only need reading from my phone).

I understand you are not intimately familiar with this topic but any suggestion that helps me to understand woul be useful
Attachments
4F9A1BEF-97DC-482D-B594-3F9F75FBC547.png
4F9A1BEF-97DC-482D-B594-3F9F75FBC547.png (982.39 KiB) Viewed 85 times
CFFB44B6-39A3-4A42-9D09-635093039162.png
CFFB44B6-39A3-4A42-9D09-635093039162.png (982.39 KiB) Viewed 85 times

User avatar
dastels
 
Posts: 15608
Joined: Tue Oct 20, 2015 3:22 pm

Re: buzzing mindfulness bracelet code plus some new functions

Post by dastels »

The “installing from PyPI” section is, as the first line states, is for installing on Raspberry Pi (or other Linux systems).

It is long and complex. I suggest starting with the examples and experimenting outside your project until you understand it enough to integrate it into your code.

Dave

User avatar
bozzaglia
 
Posts: 131
Joined: Mon Aug 01, 2022 6:14 am

Re: buzzing mindfulness bracelet code plus some new functions

Post by bozzaglia »

Ok I think you are right. I hope not too long and complex :-(
For now I noticed that the circuitpython BLE library that I loaded on CIRCUITPY (to make the board recognizable by Bluefruit Connect App) has a file called something like “Adafruit_BLE_file_transfer.mpy”, and I found in the GitHub directory (which structure I still have to understand) a file named “adafruit_ble_file_transfer.py”. So I’ll start by pasting the content of this file into my code.Py and see what happens… will keep you updated. Thanks again :-)

User avatar
dastels
 
Posts: 15608
Joined: Tue Oct 20, 2015 3:22 pm

Re: buzzing mindfulness bracelet code plus some new functions

Post by dastels »

OK, but that's kind of a hit & miss approach if you don't understand how it's working.

Dave

User avatar
bozzaglia
 
Posts: 131
Joined: Mon Aug 01, 2022 6:14 am

Re: buzzing mindfulness bracelet code plus some new functions

Post by bozzaglia »

So I got the BLE piece fixed through the File Glider app (thanks @tannewt!).
I thought I was finished but I am still finding little things that need fine tuning.

Is there a way to trigger an alarm with a button double or triple click? I am studying the pin.alarm structure but it seems that it can only be triggered using a pin as an input.
I have only one button and I am already using the single press for something else…

User avatar
bozzaglia
 
Posts: 131
Joined: Mon Aug 01, 2022 6:14 am

Re: buzzing mindfulness bracelet code plus some new functions

Post by bozzaglia »

I tried to have a “short_count == 3” trigger the change of state of a pin and then use that pin to trigger the “pin.alarm”, but it doesn’t work. I think because it generates a conflict by using the pin both as an output and an input…

Locked
Please be positive and constructive with your questions and comments.

Return to “Adafruit CircuitPython”