Page 5 of 20
Re: FOC-Stim: a new approach to DIY stim hardware.
Posted: Sat Jan 11, 2025 2:47 pm
by bobsynol
edger477 wrote: Sat Jan 11, 2025 2:39 pm
Have you found that new default for volume in volume tab is 10%?
No haven't seen that, didn't update in a while must have missed that in the changelogs

Re: FOC-Stim: a new approach to DIY stim hardware.
Posted: Sat Jan 11, 2025 3:32 pm
by Afapp
Hello,
I’m a long time stereostim builder and user :). Congratulations on making a whole new design and concept. It looks like safety and reliability in our hobby is going to take a big leap forward. I have a few questions before I jump in.
Can you post the wiring of the inputs of the board. You have nice details on the board outputs, but I’m unclear on the inputs. Are any switches needed or desired to change the signal or is this done entirely in the restim software?
The FOC hardware sounds like it’s an easy build. But is this the ideal configuration of inductor, transformer, and capacitor? Should I wait for more testing by you guys before jumping into the FOC pool? Has anyone desoldered the on board pot? If so is a linear or log pot the one to use as a box front replacement. I’m also a little confused about the usb connection for restim control of the board. Can you post a diagram or photo of this? My prostate trode is a bipolar estim systems with a mono 3.5mm plug. What should I do to connect this to the FOC, build a 2 banana plug wire with a 3.5mm socket? This only leaves me with 1 output to my front bits. Or build a 3 wire harness with common to … head, base, sphincter, or prostate?
And finally about the restim software. It doesn’t use my computer’s sound hardware, right? So watching videos and using restim simultaneously won’t send the video signal to the FOC box? I don’t need a second sound hardware for the windows 11 computer, do I?
Again thanks for sharing and developing this. We have come a long way from TENS stimming.
Re: FOC-Stim: a new approach to DIY stim hardware.
Posted: Sat Jan 11, 2025 6:33 pm
by diglet
Afapp wrote: Sat Jan 11, 2025 3:32 pm
Hello,
I have a clear picture of the board connections here:
viewtopic.php?p=371716#p371716
The board is powered with a DC barrel jack via a simple power switch (optional), there is also an USB extension cable (USB micro-B panel mount). Upon connecting the USB port to your computer with a normal USB to USB micro-B cable, it shows up as an USB-serial device, which is how Restim communicates with the board. You do not need a separate audio card, the FOC-Stim software does not support audio playback and it's unlikely I will add it in the near future.
I went through a few minor hardware revisions before posting the build here, there is very little room for further improvements. If there are any improvements they will be minor, such as slightly higher max power with a 12v power supply and/or slightly higher maximum carrier frequency.
All control happens in the software, the pot is optional. If you want to breakout the pot to the front of your box, you need a 10k linear pot. Several people on discord have de-soldered their pot and put one on the front panel.
My preference is to have 3 banana connectors on the box, I then solder my own cables to connect the electrodes. You can create a 2-banana to 3.5mm female cable to connect your bipolar plug. But feel free to use different connectors on the box if that suits your needs better.
Re: FOC-Stim: a new approach to DIY stim hardware.
Posted: Sun Jan 12, 2025 2:03 pm
by Afapp
Thanks for the reply,
I didn’t see the usb port on the board for some reason. How does this BOM look.

- IMG_0820.png (382.52 KiB) Viewed 6335 times
Re: FOC-Stim: a new approach to DIY stim hardware.
Posted: Sun Jan 12, 2025 4:50 pm
by darthjj
Assembled all the parts, hooked it up to a simple test rig (just a few resistors to simulate a human + my old oscilloscope) and played around with it for a bit. The DIY PCB, discovery kit, power jack, etc. are currently taped to a wooden board :D Going to print the case, to be really sure that nothing moves and gets short-circuited, before I try it on myself, but so far everything looks like it's working.
Didn't immediately realize it, but the common calibration in Restim should use 0 as a starting point, right? I mean unlike a stereostim where it's more likely to be around -5dB. Think I'll need to keep two instances of Restim with different settings, since I don't plan to retire the stereostim yet.
Btw. it is possible to get undefined behaviour by sending commands with values larger than int max, e.g. V02147483648. The platformio implementation does the most sensible thing and parses anything larger as 2147483647, which will still turn out wrong but at least the end result will stay within the expected [0,1) range. Running the same code on Linux gives -2147483648.
Re: FOC-Stim: a new approach to DIY stim hardware.
Posted: Sun Jan 12, 2025 6:02 pm
by diglet
Afapp wrote: Sun Jan 12, 2025 2:03 pm
Thanks for the reply,
I didn’t see the usb port on the board for some reason. How does this BOM look.
Components look good.
darthjj wrote: Sun Jan 12, 2025 4:50 pm
Didn't immediately realize it, but the common calibration in Restim should use 0 as a starting point, right? I mean unlike a stereostim where it's more likely to be around -5dB. Think I'll need to keep two instances of Restim with different settings, since I don't plan to retire the stereostim yet.
Yes. I used -5 to -6 with my stereostim rig, and -1.3 with FOC-Stim. I believe this is mostly caused by the 3-transformer configuration.
darthjj wrote: Sun Jan 12, 2025 4:50 pm
Btw. it is possible to get undefined behaviour by sending commands with values larger than int max, e.g. V02147483648. The platformio implementation does the most sensible thing and parses anything larger as 2147483647, which will still turn out wrong but at least the end result will stay within the expected [0,1) range. Running the same code on Linux gives -2147483648.
You are probably right, I didn't do a very thorough job testing the protocol for robustness.
Re: FOC-Stim: a new approach to DIY stim hardware.
Posted: Mon Jan 13, 2025 2:43 pm
by bobsynol
Tested it again, much better with the right setting. Tried it with Warp Zone 2 and it was amazing. Looking forward to play some other CH again with the FOC Stim so I can compare it to a Stereo Stim.
Re: FOC-Stim: a new approach to DIY stim hardware.
Posted: Wed Jan 15, 2025 5:38 pm
by Pinco
Hi all,
I started looking at this new box that seems better than my old DIY box.
I have two points/questions, please clarify.
I do not see any pot in the schematic and I would like to manage the volume by hw and not just with sw.
I am not familiar at all with VSC platformio but I know a little of Arduino Eclipse IDE named Sloeber that I used for some simple projects. Do you think I can program with that ?
thanks
Re: FOC-Stim: a new approach to DIY stim hardware.
Posted: Wed Jan 15, 2025 6:57 pm
by diglet
Pinco wrote: Wed Jan 15, 2025 5:38 pm
Hi all,
I started looking at this new box that seems better than my old DIY box.
I have two points/questions, please clarify.
I do not see any pot in the schematic and I would like to manage the volume by hw and not just with sw.
I am not familiar at all with VSC platformio but I know a little of Arduino Eclipse IDE named Sloeber that I used for some simple projects. Do you think I can program with that ?
thanks
You can desolder the onboard pot, this leaves 3 pads which can be used to connect an external pot.
I have no experience with sloeber / eclipse. If you can install platformio in it, you should be able to compile and upload the code.
Re: FOC-Stim: a new approach to DIY stim hardware.
Posted: Thu Jan 16, 2025 1:06 pm
by Pinco
diglet wrote: Wed Jan 15, 2025 6:57 pm
Pinco wrote: Wed Jan 15, 2025 5:38 pm
Hi all,
I started looking at this new box that seems better than my old DIY box.
I have two points/questions, please clarify.
I do not see any pot in the schematic and I would like to manage the volume by hw and not just with sw.
I am not familiar at all with VSC platformio but I know a little of Arduino Eclipse IDE named Sloeber that I used for some simple projects. Do you think I can program with that ?
thanks
You can desolder the onboard pot, this leaves 3 pads which can be used to connect an external pot.
I have no experience with sloeber / eclipse. If you can install platformio in it, you should be able to compile and upload the code.
hi diglet,
You can desolder the onboard pot, this leaves 3 pads which can be used to connect an external pot.
Yes, I noticed that you mentioned it a few times... How do you manage the volume in sw? I used windows controls for that but here the only way I see is through restim that it is not very practical
I have no experience with sloeber / eclipse. If you can install platformio in it, you should be able to compile and upload the code.
never mind, I did some research, you have to load on sloeber/eclipse ST32 platforms/boards but it seems there are many issues. So I installed VSC platformio. I guess I will ask for your help regarding the config.h file.
Thanks for now
Re: FOC-Stim: a new approach to DIY stim hardware.
Posted: Thu Jan 16, 2025 4:07 pm
by diglet
You're right, managing the volume in software is a bit clumsy

. I keep the volume control in focus and then use pgup/pgdn to increase or decrease the volume. I want to improve this, but I have trouble imagining what the ideal user interface would look like.
Re: FOC-Stim: a new approach to DIY stim hardware.
Posted: Thu Jan 16, 2025 4:31 pm
by edger477
I use restim-controller to have volume controls for both instances of restim on my phone.
Re: FOC-Stim: a new approach to DIY stim hardware.
Posted: Thu Jan 16, 2025 8:34 pm
by Afapp
Is the firmware update important for the B-G431B-ESC1 board? Does the
https://www.st.com/en/development-tools ... eprog.html
STM cube programmer do it automatically or do I have to write this myself?
Re: FOC-Stim: a new approach to DIY stim hardware.
Posted: Thu Jan 16, 2025 8:43 pm
by edger477
I did firmware update and that resolved issue where boards were resetting and losing connection (it was actually the development part of board that had some bug, the diglet's firmware ran fine and output serial comms to pin but the development daughterboard was switching to wrong mode).
Re: FOC-Stim: a new approach to DIY stim hardware.
Posted: Thu Jan 16, 2025 9:19 pm
by diglet
There is a button on the right-hand side of the Stm32CubeProgrammer windows with "firmware update". Click that and then a window will pop up that allows you to update the firmware.
Without the new firmware, the rx part of the virtual serial port randomly stop working. It only happens on some computers, mine seems unaffected.