author

rgco

171
Inbox View Profile
39Instructables349,553Views216Comments

Tell us about yourself!

Achievements

100+ Comments Earned a bronze medal
10K+ Views Earned a bronze medal
Heart Contest
Contest Winner Runner Up in the Heart Contest
Magnets Challenge
Contest Winner Runner Up in the Magnets Challenge
STEM Contest
Contest Winner Second Prize in the STEM Contest
  • rgco commented on rgco's instructable Arduino Synthesizer With FM
    Arduino Synthesizer With FM

    Sorry I have no experience with making libraries, I even try to avoid using them whenever I can! It's quite involved to make (and maintain!) the code work such that it integrates with other people's code. Here in particular the code is using timed loops to emulate multitasking what normally an operating system would do.

    Nice! beware though that in theory these may work well, in practice an active filter requires on opamp that requires either level-shifting or double (+ and -) power supplies - quite an added complication for this simple circuit. One can also just put 2 RC in series - that's not optimal because of impedance matching, but if I recall well there are fine 2nd order RC filters based on just 2Rs and 2C's.

    View Instructable »
  • rgco commented on rgco's instructable Arduino Synthesizer With FM
    Arduino Synthesizer With FM

    Ah, with a class D amp it may give issues, since it also samples, and the frequency difference may result in the output and be audible; you may need a 2nd order RC filter to get rid of that. Just yesterday I started porting the project to the raspberry pi pico, the higher speed should improve the sound quality to 11 or 12 bits and allow for higher levels of polyphony. Attached is a scope picture of the raw PWM signal in yellow compared to that from an RC filter (R=10kOhm C=4.7nF, but the sampling frequency is 61kHz)

    View Instructable »
  • rgco commented on rgco's instructable Arduino Synthesizer With FM
    Arduino Synthesizer With FM

    Sorry a bit late. What you see is the bare PWM signal. We can't hear frequencies above 20kHz, so they get naturally filtered out. You can also remove them with an RC filter so that the scope image improves, e.g. using R=10k, C=10nF (cut-off 10kHz). But there is no need to filter the sound.

    View Instructable »
  • Measuring the IV Curve of Semiconductors With an Arduino

    Hmm, honestly I have no clue: 1) I do recall that the LED would be on most of the time during a measurement, since even between 2ma and 10mA the difference in brightness is small. But you should see a curve coming up on the screen. 2) I looked at the processing code and have no recollection what these lines are for. I suppose it's something from a piece of example code that I copied, something to initialize the communication? Your project on bandgaps and solar panels looks interesting, but will require quite a bit of development. Note that my Arduino project here is very basic and non-optimal. I do recall seeing much more elaborate projects here on instructables, in particular some that measure the BJT characteristics. Good luck!

    View Instructable »
  • Measuring the IV Curve of Semiconductors With an Arduino

    Did you run the processing code?Honestly, I wrote this 4 years ago, I have not heard much about 'processing' since. Nowadays I would try to do the PC <-> microcontroller communication with python.The Arduino script is short because it doesnt' need to do much...

    View Instructable »
  • Arbitrary Wave Generator With the Raspberry Pi Pico

    Awesome! Thanks for sharing. I ordered some AD8055, it seems a very suitable chip for this.

    View Instructable »
  • rgco commented on rgco's instructable Minimal Arduino Metal Detector
    Minimal Arduino Metal Detector

    Yes, but the code will need many small changes, since the registers and pin numbering differ.

    View Instructable »
  • rgco's instructable Force Between Magnets's weekly stats:
    • Force Between Magnets
      76 views
      1 favorites
      0 comments
  • Arbitrary Wave Generator With the Raspberry Pi Pico

    The R2R used here can have decent performance for 8 or even 10, maybe 12 bits, doing manual selection of values. Step 1 has the schematics. I would think laser-trimmed IC's with R2R exist, but I never even looked for them. Then are 16-bit I2C DACs but that's for low-frequency applications.

    View Instructable »
  • Arbitrary Wave Generator With the Raspberry Pi Pico

    Good suggestions! Thinking aloud, an external trigger is probably possible. Another PIO channel could poll an input pin and reset the DMA counter at rising or falling flank. Seems nontrivial but doable and interesting!Concerning different frequencies, the 8 output pins are combined into a single analog channel, so there is no point in running them at different frequencies. A second output channel could be implemented and I suppose the frequency can be set independently, but it would need its own PIO and DMA. I think that should work, the bus structure is highly parallel.

    View Instructable »
  • rgco commented on rgco's instructable Arduino Waveform Generator
    Arduino Waveform Generator

    It's open source, licence allows copying, sharing, modifying, etc, as long as the result is also open source and as long as it is credited, so please go head! - if you can post a link here once it's ready, that'd be awesome.I've never tried the ESP32, I've understood it's powerful. It was a bit expensive when it came out (better now) and I had no need for Wifi, bluetooth etc. There is a new version however linked at the beginning of this instructable using the very cheap raspberry pi pico, which samples faster by 2 orders of magnitude, but no stand-alone interface or amplifier yet, also slightly less accurate frequency setting.

    View Instructable »
  • Arbitrary Wave Generator With the Raspberry Pi Pico

    Brilliant, and thanks for putting pics! I ordered few of those chips to play with on Aliexpress, I'll see if they're real or not, they're 25 cents a piece. Yes I recall issues with needing to power-cycle more than it should be. I think I just used a dangling jumper cable from GND that I would use to touch the reset. There is nothing else dramatic in the code, it just fills up the (64k) buffer to be streamed with a pattern. There is an attempt to create complicated waves from summing, multiplying and phase-modulating basic shapes.

    Very nice, and impressive soldering job too! please keep us updated about the buffer/amplifier. I was seeing minor transients around the 2^n values, but not sure if these were due to the R2R network or due to pico internals. If SMD resistors resolve that, it would be good news; the sine wave picture you show is definitely very clean. I have some LM7372 (suggested by sdwood68) but didn't have the time yet to try them out.

    View Instructable »
  • rgco commented on rgco's instructable Arduino Waveform Generator
    Arduino Waveform Generator

    Here I used R=10k. With the PICO I used 2R=2k. Since R=1k worked for the PICO, I'd be pretty confident it also works for the Arduino, which is known for it's relatively high output current capabilities. On the other hand there may not be an advantage in going below R=10k if you're below 1MHz and have an amplifier with a high input impedance. Overall I'd stick with 10k unless or whatever you have available in the 1k-20k range. In the instructable for the pico I show a technique to get a matched set of resistors.

    View Instructable »
  • rgco commented on rgco's instructable Arduino Waveform Generator
    Arduino Waveform Generator

    Okay! indeed if 384ksps are sufficient, this may be good solution. Also the limited RAM (and the use of bytes for indexing) limits the complexity of the waveform to 256 samples. ample for sine, triangle etc but very-low duty cycle pulses, or complex shapes won't work. Beware that the NE5332 doesn't do to negative rail. Good luck!

    Sorry, I didn't redo the schematics nor PCB layout of this project. The updated project with the Raspberry pi pico (300x faster) is in KiCad.

    View Instructable »
  • Arbitrary Wave Generator With the Raspberry Pi Pico

    Thanks, I recall a 'logic analyzer' is in fact included as an example with the pico (C) code, so yes, it should work.Somehow, flash-ADCs seem difficult to find and expensive. Moreover, it is hard to compete with commercial oscilloscopes, 250EUR gets you a 2-chan complete 1Gs/ 100MHz scope with good screen, FFT, tens of triggers, sub-mV sensitivity.

    View Instructable »
  • Arbitrary Wave Generator With the Raspberry Pi Pico

    Glad you like it. Indeed the PICO has pretty good PWM support: lots of channels, all with very flexible clock prescaling.

    View Instructable »
  • Multichannel Arduino Oscilloscope

    Sorry I haven't used it for a while, nor have I ever used 'processing' since. Probably 'processing' updated and became incompatible. You may check in the comments below if someone ran into a similar issue.

    View Instructable »
  • Arbitrary Wave Generator With the Raspberry Pi Pico

    Yes. This project is an overkill for what you want to do (arbitrary signals on 8 ouput pins) What you want can be done easier with the PWM (pulse width modulation)

    You could run a square wave at 440Hz and multiply it with a sine wave that has replication of 110,000/440 = 252. With 64k points you should still get a decent sine wave(~25 samples per sine wave).Alternatively, you can set up a single sine wave at 110kHz and then have a timed loop (e.g. with delay, better with timers) switch on and off the DMA (EN=0 in the writing of CRTL0 and CTRL1 should switch off the DMAs)But don't you run the MOSFET in switching mode? In that case you don't need an analog signal but a digital signal no?

    View Instructable »
  • rgco commented on rgco's instructable Arduino Synthesizer With FM
    Arduino Synthesizer With FM

    OK, for pot input, the usual 'AnalogRead' is not good: it starts up the ADC and waits ill its done which takes by default ~0,1ms, which interrupts the waveform production.Check the code from soundlab: (or better start from that)setup has the following lines: //setup the ADC ADCSRA=B11110100; // prescale 16 -> 13 mus per sample, auto trigger ADCSRB=B00000000; // freerun ADMUX =B01100000; // Vcc ref, left-align, ch0This increases the speed by a factor 8 and sets it up to keep running code while performing the ADC conversion.later in the code you'll see //setup one POT ADMUX &=B11111000; ADMUX |= ipot; setPWM(); //#2 //readout one pot byte potval=ADCH;This starts up the ADC, runs one PWM 'tick' -after which the ADC value is ready.Here the 8 pots are being cyclically read t…

    see more »

    OK, for pot input, the usual 'AnalogRead' is not good: it starts up the ADC and waits ill its done which takes by default ~0,1ms, which interrupts the waveform production.Check the code from soundlab: (or better start from that)setup has the following lines: //setup the ADC ADCSRA=B11110100; // prescale 16 -> 13 mus per sample, auto trigger ADCSRB=B00000000; // freerun ADMUX =B01100000; // Vcc ref, left-align, ch0This increases the speed by a factor 8 and sets it up to keep running code while performing the ADC conversion.later in the code you'll see //setup one POT ADMUX &=B11111000; ADMUX |= ipot; setPWM(); //#2 //readout one pot byte potval=ADCH;This starts up the ADC, runs one PWM 'tick' -after which the ADC value is ready.Here the 8 pots are being cyclically read through the 'ipot' variable, but if you have only one 'ipot' can stay at 0.the value of potval can then be used to modify the sound.If you want it to change the frequency, you could do that at the lineinc_base[nextch] = tone_inc[keypressed];and change it for example inc_base[nextch] = tone_inc[keypressed]*exp8[potval]/2048orinc_base[nextch] = tone_inc[keypressed]*exp8[potval/2]/1024orinc_base[nextch] = tone_inc[keypressed]*exp8[potval/4]/512depending on the amount of pitch bending

    View Instructable »
  • rgco commented on rgco's instructable Arduino Synthesizer With FM
    Arduino Synthesizer With FM

    Sure, changing the pitch based on a pot reading should be straightforward! I hope it works!

    View Instructable »
  • Arbitrary Wave Generator With the Raspberry Pi Pico

    The first wave is set in line 165:setupwave(wavbuf[ibuf],freq,wave1); ibuf=(ibuf+1)%2You can take it out of the loop and fill in your values of the wave properties in lines 155-162, then delete all the code below it.Yes, resolution is compromised by doing amplitude and offset in software, and it would be better do offset and amplifictation/reduction at the analog level. It takes some skill in fast analog electronics to do that well. Nevertheless, a software amp/offset remains needed to construct hybrid shapes that are sums, products or phase-modulations.User sdwood68 has been giving some suggestions for a suitable opamp/buffer, I'd be happy to hear some more ideas!

    View Instructable »
  • rgco commented on rgco's instructable Arduino Timers: 8 Projects
    Arduino Timers: 8 Projects

    The Arduino port for the raspberry pi pico just came out. I have not tried it out yet. The easiest way to program the raspberry pi pico is with micropyhon using Thonny. Anyway what you want should be no problem for an Arduino

    OK I saw your questions on other posts, this is about the stroboscobe fountain right? I think it could be done with timers using the examples here: You can combine "LED dimmer" to do PWM for the motor speed based on an 8-bit timer and "sound spectrum" for the stroboscobe, using a 16-bit timer for more precision. In all cases avoid the "delay" statement - it breaks multitasking. "Blink without delay" will also work - you will need two separate sets of "LedStat", "interval" and "previousMillis" variables.Please confirm the frequencies, duty cycle, precision etc that you aim for.

    View Instructable »
  • rgco commented on rgco's instructable Arduino Timers: 8 Projects
    Arduino Timers: 8 Projects

    More likely your lack of coding experience (no offence :-) !If you blink with digitalwrite, you do the switching yourself, so no problem with timer inerference.What exactly are you trying to do? Blink 2 leds at different frequencies? For high frequencies (>30Hz) it can be done directly with timers. Otherwise, I would use a timed loop and switch with phase increments. But that forces the rest of the code to be inside that loop as well. Does it have to be Arduino? I recently tried out the cheap and powerful raspberry pi pico; it has 8 16-bit PWM channels, so 8 channels can be set up to puls independently with their own frequency and duty cycle, and leave both CPU's available for other tasks.

    View Instructable »
  • rgco commented on rgco's instructable Series, Parallel, Kirchhoff
    Series, Parallel, Kirchhoff

    Thanks cpeoples, I think you have a lot more experience on this than me, and your contribution adds value! My main point was to show how to do a hands-on demo or class-room exercise that is easy to prepare, involving for the students, safe and cheap enough that it can be provided out-of-pocket by the teacher.

    View Instructable »
  • Arbitrary Wave Generator With the Raspberry Pi Pico

    Thanks for your input! I've been quite comfortable with C on the Arduino, while micropython on the Pico was not smooth start, despite using python daily on PC's. Overall, I think it's great that both methods are available.

    View Instructable »
  • rgco commented on rgco's instructable Series, Parallel, Kirchhoff
    Series, Parallel, Kirchhoff

    Awesome! I really enjoyed your video and added a link at the end! Indeed, I used symmetry arguments to reduce the number od unknowns and simplify the math. I have a special connection to this circuit: I solved it at a high-school physics olympiad, which helped me get into the national finals. Later, in grad school, the equivalent of a 1xn network came up for a problem of gas distribution in a straw-tube chamber for a neutrino detector. My supervisor assumed that the flow (current) would be equal through all branches but I could show that the flow through the central branches is much less than that of the lateral branches, and we had to redo the design to assure equal flow. Two weeks ago I brought the resistors and a multimeter to a class, since I was annoyed that this circuit was not in t…

    see more »

    Awesome! I really enjoyed your video and added a link at the end! Indeed, I used symmetry arguments to reduce the number od unknowns and simplify the math. I have a special connection to this circuit: I solved it at a high-school physics olympiad, which helped me get into the national finals. Later, in grad school, the equivalent of a 1xn network came up for a problem of gas distribution in a straw-tube chamber for a neutrino detector. My supervisor assumed that the flow (current) would be equal through all branches but I could show that the flow through the central branches is much less than that of the lateral branches, and we had to redo the design to assure equal flow. Two weeks ago I brought the resistors and a multimeter to a class, since I was annoyed that this circuit was not in the student's textbook. I could not make them do it themselves because of limited equipment, limited time and COVID restrictions, but I did a demo projected from a document camera. They seemed to like it, so I figured I might as well put it on the web. Good luck with your channel, I'm following!

    View Instructable »
  • Arbitrary Wave Generator With the Raspberry Pi Pico

    In the code: adjust the python script to set the waveform you want.

    View Instructable »
  • Arbitrary Wave Generator With the Raspberry Pi Pico

    Correct. I use python professionally in science all the time, but having tried it out now for microcontrollers I am not a fan of it. The speed loss is about a factor 100, which doesn't matter on my PC to do some one-time calculation in 10s instead of 0.1s. But 100x slower on a microcontroller does matter.Moreover, the strength of python is the availability and ease of use of sophisticated libraries for complex numerical operations: in my case mostly numpy and ROOT. To fit on a microcontroller, they have stripped down python to a bare minimum, and you have to search on github to download additional libraries for almost anything beyond the bare mininum blink script. There are techniques to speed it up (native, viper) but it becomes a headache to make it work.So, I gave micropython a try, f…

    see more »

    Correct. I use python professionally in science all the time, but having tried it out now for microcontrollers I am not a fan of it. The speed loss is about a factor 100, which doesn't matter on my PC to do some one-time calculation in 10s instead of 0.1s. But 100x slower on a microcontroller does matter.Moreover, the strength of python is the availability and ease of use of sophisticated libraries for complex numerical operations: in my case mostly numpy and ROOT. To fit on a microcontroller, they have stripped down python to a bare minimum, and you have to search on github to download additional libraries for almost anything beyond the bare mininum blink script. There are techniques to speed it up (native, viper) but it becomes a headache to make it work.So, I gave micropython a try, found it to be OK for configuring perepherals, but already got annoyed how slow it is: here, it is preventing the AWG from doing a smooth sweep.Luckily it seems that in the meantime an (unofficial) Arduino port has been set up, so for the next project with a pico I'll try that out.

    View Instructable »
  • Arbitrary Wave Generator With the Raspberry Pi Pico

    There is no display. It is setup (flashed, programmed) with the computer. The wveform images shown are from an oscilloscope.

    View Instructable »
  • Arbitrary Wave Generator With the Raspberry Pi Pico

    Well said. On top of that the TL072 is not so easy to get by. I received 20 from Aliexpress yesterday and they were fakes! feeding a blockwave in follower configuration it could only do 0.4V/microsecond instead of 15. I guess they were relabelled 741's - anyway I complained and got refunded.It just seems weird to pay twice as much for a line driver a for the microcontoller, I had hoped there was some standard chip for 1 or 2 euros around that would fit the purpose.

    View Instructable »
  • Arbitrary Wave Generator With the Raspberry Pi Pico

    OK, same resistor values then. Yes, probe should be 10x and yes I also suspect that the bandwidth can be pushed further with better layout. The pico can handle it: I have overclocked it at 250MHz and made it to toggle a pin at 125MHz, and that came out well visible at a scope.I am asking suggestions indeed for the ouput stage. There is a jungle of dedicated chips that can do it, but to pick the best, most available and affordable takes some research. Otherwise I might try with a TL072 or NE5532 that I have, knowing that it will take a huge hit in bandwidth. Last resort would be to find or design a simple 1-or 2-stage BJT amplifier, even if it may compromise a bit in linearity and be inefficient in power usage.

    View Instructable »
  • Arbitrary Wave Generator With the Raspberry Pi Pico

    Ah, so these plots come from running at 3.2Msps? totally true that layout/strays matter, I was still positively surprised how well the signal came out paying hardly any attention to layout or component types. It looks as if your RC time is larger than mine despite similar components and layout? I used R-2R 1k-2kOhm (but implemented with 2kOhm resistors). Did you use a larger value for R? I am curious since I did not thoroughly evaluate the optimal value of R (it's current draw vs RC time).Ouch, that's an expensive chip at ~10$, and only as SMD. A bit out of range for the average hobbyist. I was hoping to stick with Aliexpress-type components, maybe even discrete BJT's, they have >100MHz GBW after all...

    Sure, square waves are easy, they can be done with PWM. I am not 100% sure on how to fix the phase between two different channels with the built-in PWM.If that would turn out hard, the method in this instructable will also work, simply leave out the R2R and you have 8 outputs to which you can send arbitrary bit patterns.

    View Instructable »
  • Arbitrary Wave Generator With the Raspberry Pi Pico

    Great! Please le us know more, either here or in a new instructable entry! Your scope image does not show a super-clean sine though, you may be running into the monoticity issues mentioned below by Grumpy Mike. In that case there is little gain in going from 8 bit to 12 bit and the extra bits might be of better use for a second channel? What chip or circuit do you use/plan for the output stage? I have heard that an Arduino port is available now and C-code might speed up the editing of the waveforms...

    View Instructable »
  • rgco commented on rgco's instructable Arduino Soundlab
    Arduino Soundlab

    Ah, pullup won't destroy anything, they are pulled up with a high resistance, somewhere in the 20-50kOhm range. Anyway the pullup is done with the PORTD PORTB PORTC writes, whenever a non-zero value is written there, it results in a pull-up, so just write zeros there instead of ones.

    In principle it is a matter of changing the >0 to ==0 and vice versa in these lines:if ( (butstatD1 & (1<<0)) == 0 and (prevbutstatD1 & (1<<0)) >0 ) keypressed=0;if ( (butstatD1 & (1<<0)) >0 and (prevbutstatD1 & (1<<0)) == 0 ) keyreleased =0; However, there are some more complications due to the matrix-setup. It's not obvious that the matrix-scheme will work for these touch-sensors. Basically the buttons are divided in 3 groups of 8, which get activated one after the other. with regular buttons, I had to introduce a delay of 3 microseconds between the reading of one row and the other. Those touch buttons are active components, which might need a lot more time. So to read 24 buttons, which is more than the Arduino has pins, I don't think the…

    see more »

    In principle it is a matter of changing the >0 to ==0 and vice versa in these lines:if ( (butstatD1 & (1<<0)) == 0 and (prevbutstatD1 & (1<<0)) >0 ) keypressed=0;if ( (butstatD1 & (1<<0)) >0 and (prevbutstatD1 & (1<<0)) == 0 ) keyreleased =0; However, there are some more complications due to the matrix-setup. It's not obvious that the matrix-scheme will work for these touch-sensors. Basically the buttons are divided in 3 groups of 8, which get activated one after the other. with regular buttons, I had to introduce a delay of 3 microseconds between the reading of one row and the other. Those touch buttons are active components, which might need a lot more time. So to read 24 buttons, which is more than the Arduino has pins, I don't think the simple matrix methods works. Looks like it would need shift-registers but that's extra hardware.Sorry I can only give some general advice, the coding you'll have to do yourself! Cheers, -Rolf

    View Instructable »
  • rgco commented on rgco's instructable Arduino Soundlab
    Arduino Soundlab

    I never used those but i seems a good idea, since regular buttons click sound is disturbing. Yes, if these are set to active high, you will have to adapt the code to disable pullup and invert the logic (the present logic is for active low)

    View Instructable »
  • Arbitrary Wave Generator With the Raspberry Pi Pico

    Hello Mike, the solution to this is mentioned in step 1:"I numbered all the resistors, measured their values and put them in a spreadsheet. None differed by more than 1% from the nominal value, but by selecting I could reduce the effective spread from 1 percent to 1 per mille. For the ‘2R’ resistors I picked a value near the mean of which there were at least 9, which happened to be the value 2000. Then I picked picked 7 pairs that were equally distant from the value 2000, for example 3 pairs of 1998+2002 Ohm and 4 pairs of 1997+2003 Ohm. In parallel, equal but opposite deviations cancel!"Moreover, you can see from the scope pictures that the waveforms come out pretty well. If you look very closely, there may be some effect at the 0.5Vcc threshold and smaller ones at the 0.25, 0.…

    see more »

    Hello Mike, the solution to this is mentioned in step 1:"I numbered all the resistors, measured their values and put them in a spreadsheet. None differed by more than 1% from the nominal value, but by selecting I could reduce the effective spread from 1 percent to 1 per mille. For the ‘2R’ resistors I picked a value near the mean of which there were at least 9, which happened to be the value 2000. Then I picked picked 7 pairs that were equally distant from the value 2000, for example 3 pairs of 1998+2002 Ohm and 4 pairs of 1997+2003 Ohm. In parallel, equal but opposite deviations cancel!"Moreover, you can see from the scope pictures that the waveforms come out pretty well. If you look very closely, there may be some effect at the 0.5Vcc threshold and smaller ones at the 0.25, 0.75 boundaries. I have not investigated them in detail, they seem to be transient effects that may have origin inside the pico or be due to parasitic inductance in the resistors.

    View Instructable »
  • Arbitrary Wave Generator With the Raspberry Pi Pico

    Nice picture! and glad you're rewriting - I made a particular application that I was interested in, a large-buffer AWG - 125msp (or 250 at overclocking) has many other applications indeed.Yes I also needed to reboot the pico every time after running the code - I did it with machine.reset() to avoid plugging/unplugging. I don't know why it is. The frequency can be changed on the fly inside the script - it is done in the demo.The way it's set up here, the lookup tables are recalculated every time a change is made even a frequency change; that allows for the most precise frequencies and the largest range of frequencies, but it may take several seconds to fill the buffer in micropython.I see two ways to speed up: for a fixed waveform, the frequency can be changed with a single write to the cl…

    see more »

    Nice picture! and glad you're rewriting - I made a particular application that I was interested in, a large-buffer AWG - 125msp (or 250 at overclocking) has many other applications indeed.Yes I also needed to reboot the pico every time after running the code - I did it with machine.reset() to avoid plugging/unplugging. I don't know why it is. The frequency can be changed on the fly inside the script - it is done in the demo.The way it's set up here, the lookup tables are recalculated every time a change is made even a frequency change; that allows for the most precise frequencies and the largest range of frequencies, but it may take several seconds to fill the buffer in micropython.I see two ways to speed up: for a fixed waveform, the frequency can be changed with a single write to the clock divider of the PIO. So sweeps and FM signals can be generated that way. The PIO clock divider has a 24-bit precision. In C code it should be possible to modulate at audio frequencies or higher from file, or from the ADCs - maybe even directly using DMA.The other way is to rewrite in C - it should speed up the calculations by a factor ~100. That could allow for smooth sweeps if the buffer is not too large. Any application where he waveforms need to be varied continuously would benefit a lot from C.

    View Instructable »
  • Arbitrary Wave Generator With the Raspberry Pi Pico

    I never used SPI, but I suppose it would be slower by several orders of magnitude, but probably have a better precision?

    View Instructable »
  • rgco commented on rgco's instructable Arduino Soundlab
    Arduino Soundlab

    Glad i works now! Yes, these pitches seem right, I called hem C4-B5 instead of C0-B1, referencing always to the A4 being 440Hz. Rerunning setup() is not a good idea: it does some low-level things that you don't want to doing running and there is the filling of the sine and exp lookup tables.For shifting octave, I would expand the number of notes in settones() to 36 or 48 or 60 or 72. Then some button, switch or pot could add 12,24,36 or 48 to the value of keypressed and keyreleased.

    View Instructable »
  • rgco commented on rgco's instructable Arduino Soundlab
    Arduino Soundlab

    Hard to judge from what you're writing. I suggest you keep adding buttons. In the code it is trivial to change the note assignment to each button. The notes run 0-23 which have been set up to correspond to C4-B5. If it sounds weird or out of order with all buttons in place, you can fix it in either hardware or software.NB. I have started with a new budget microcontroller, the raspberry pi pico, it has more pins, more memory and higher speed. It should be able to do more octaves, higher polyphony and fancier sounds. I'm sure it won't take long someone does it (sorry my interests are moving more towards instrumentation for citizen science)

    View Instructable »
  • rgco commented on rgco's instructable Arduino Soundlab
    Arduino Soundlab

    Sorry to hear your struggles! difficult to judge from a distance. There are many wires. I would debug in pieces. hack the code such that the values from the pots are fixed to central values. Play a single button. Activate the serial print and see if the buttons are being pressed. Note that I have posted 2 simpler versions of this project:https://www.instructables.com/Arduino-Synthesizer-...https://www.instructables.com/Arduino-Chrismas-Tun...The latter is good in particular to test the speaker

    View Instructable »
  • rgco commented on rgco's instructable Minimal Arduino Metal Detector
    Minimal Arduino Metal Detector

    The .ino file is a text file, just download it from the link at step 2:https://content.instructables.com/ORIG/F46/5QCV/KGGJSZHG/F465QCVKGGJSZHG.ino

    View Instructable »
  • rgco commented on rgco's instructable Minimal Arduino Metal Detector
    Minimal Arduino Metal Detector

    OK, It's a good idea. If it works you should write it up and submit it to the microcontroller contest!

    View Instructable »
  • Arbitrary Wave Generator With the Raspberry Pi Pico

    Thanks! Actually a logic analyser example code is already provided as an example:https://github.com/raspberrypi/pico-examples/blob/...I have not tried it out since it's in C and I'm trying out the micropython interface for now.It says "1 to 32 pins can be captured, at a sample rate no greater than system clock" so it seems it should be able to get to 125Msps as well (or more when overclocking)

    View Instructable »
  • rgco commented on rgco's instructable Minimal Arduino Metal Detector
    Minimal Arduino Metal Detector

    You could try make the coil bigger. The maximum detection distance is circa the coil diameter. A car is a huge metal object, so even with a large coil it should be detectable. Just like those induction loops under the asphalt, they are big too. Think ~1m loop. It does not need to be circular. Reduce the number of turns, to keep the inductance similar. I would try 1m diameter, 10 loops. Good luck!

    View Instructable »
  • rgco commented on rgco's instructable Simple Arduino Metal Detector
    Simple Arduino Metal Detector

    It's in step 4. Divided in two pictures.Check also the updated version, which is even simpler: https://www.instructables.com/Minimal-Arduino-Meta...

    View Instructable »
  • rgco commented on rgco's instructable Simple Arduino Metal Detector
    Simple Arduino Metal Detector

    muH stands for microHenries. Usually the greek letter 'mu' is used as a prefix indicating 10^-6, mu. Actually I think I can change it, I'll give it a try. By the way, I made an upgraded version, seehttps://www.instructables.com/Minimal-Arduino-Metal-Detector/

    View Instructable »
  • Strong and Stable Magnetic Levitation

    You may have a wrong polarity of either the electromagnet or the permanent magnet.First thing: get the hall sensor out of the electromagnet and make sure that the power to the electromagnet is on when there is no magnet near and goes off when you approach the magnet.Then make sure that the electromagnet ATTRACTS the permanent magnet when it is powered. Sure you can send pictures, though it's hard to find issues like polarity that way.

    View Instructable »
  • rgco commented on rgco's instructable Minimal Arduino Metal Detector
    Minimal Arduino Metal Detector

    That looks like a 100nF capacitor to me (104=10x10^4pF=10^5pF=100nF). The sound will be very weak if you use that. But if you use headphones instead of speakers it might be OK.But you may want to get a selection of basic components if you want to make more electronic projects. Aliexpress and Ebay have kits with lots of values for 2-5EUR. Good luck!

    View Instructable »
  • DIY Simple Sensitive Arduino Metal Detector

    TL081 according to the comments on the youtube video.

    Compliments, this is one of the simplest designs of a true pulse induction detector. For serious projects like this I recommend to do schematics on KiCad or similar, it'll take a day or two to get used to, but your project will be much more clear!

    View Instructable »
  • rgco commented on rgco's instructable Simple Arduino Metal Detector
    Simple Arduino Metal Detector

    Always a pleasure! The code is not written well (it was 4 years ago, I did not have much experience with microcontrollers) - there is a drift correction sometimes going beserk. Also, I am not convinced about the ferrous/non-ferrous discrimination. I tried to address all these issues in the new design https://www.instructables.com/Minimal-Arduino-Metal-Detector/ which is also simpler to build.

    View Instructable »
  • rgco commented on rgco's instructable Simple Arduino Metal Detector
    Simple Arduino Metal Detector

    Great you got your kid involved! You can increase the sensitivity by using a coil with a smaller diameter. This detector is sensitive to objects that are at least ~20% of the coil diameter, so a 3 or 4 inch coil can detect coins, a 6 inch coil struggles. I also recommend to try the latest version https://www.instructables.com/Minimal-Arduino-Meta... which is even simpler, no capacitor or diode, and is more robust, although not more sensitive.To get significantly higher sensitivity you need to move to pulse-induction, but that requires also a MOSFET an opamp and a handful of other components. I'm making one now, I hope to write it up soon.

    View Instructable »
  • rgco commented on rgco's instructable Arduino Waveform Generator
    Arduino Waveform Generator

    It's in step 3. Sorry these are poor Fritzing 'schematics'. I'm learning KiCad now ;-)

    Sorry not step 3, they are in step 1, anyway here are explicit links:https://content.instructables.com/ORIG/F4X/N6E7/JN...https://content.instructables.com/ORIG/FCX/6Q5E/JN...https://content.instructables.com/ORIG/F2B/XUAM/JP...

    By the way, there are things I would do differently now: Fist of all, the LM358 opamp is inadequate: it is way too slow. A faster NE5532 would be much better. To get to rail it can be given a negative voltage using a charge pump driven from the Arduino itself (see https://www.instructables.com/Arduino-Timers-8-Pro...I would try to add an output stage with more power. The software could be modified to allow more flexibility on the waveforms.

    View Instructable »
  • rgco commented on rgco's instructable Arduino Soundlab
    Arduino Soundlab

    The next key will have to be on a new 'row' of 8 keys connected to D12 or D13.The code uses direct port access to be fast, but it does not help readability indeed.Basically all the lines and blocks relating to butstatD1 butstatD2 butstatD3 will need an extra entry for butstatD4

    View Instructable »
  • rgco commented on rgco's instructable Arduino Christmas Tunes
    Arduino Christmas Tunes

    Glad you like it and yes an amplifier is needed for louder sounds, though I was surprised how much volume is produced with a speaker off an Arduino pin.Thanks for the code correction, when I have time I'll check and update the code.

    View Instructable »
  • Strong and Stable Magnetic Levitation

    Maybe. You'd have to power it wirelessly, which kind-of comes for free since there is a varying magnetic field. It might be possible to absorb power with a secondary coil in the levitating object.

    View Instructable »
  • rgco commented on rgco's instructable Arduino Christmas Tunes
    Arduino Christmas Tunes

    Glad you like it! Feel free to play around with the code to try new tunes or instruments.

    View Instructable »
  • rgco commented on rgco's instructable Arduino Soundlab
    Arduino Soundlab

    That's looking pretty! Going to 40 keys is almost trivial, pin D12 and D13 can be used to add two more rows of 8 keys each. Surely two independent systems can have independent 4-fold polyphony for each half.The potentiometers can be shared and the output can be mixed (summed) with the opamp. Using a faster microcontroller and getting native 8-fold polyphony would be more natural.

    View Instructable »
  • Strong and Stable Magnetic Levitation

    Anything in the range 5-10 Ohm is fine.

    View Instructable »
  • Strong and Stable Magnetic Levitation

    It's cheap (~5EUR) component tester, named ESR-T4, really useful. Sold on ebay, amazon, aliexpress etc, for example aliexpress.com/item/32797743484.html.Every year or so they come up with an update, so there may be a better version around now.

    View Instructable »
  • rgco commented on rgco's instructable Sweet Math Quiz
    Sweet Math Quiz

    Oh no, it's LEGO after all!, so you spend a good afternoon sorting 10000-ish lego bricks, this can be put together in less than 30 mins ;-)

    View Instructable »
  • rgco's instructable Sweet Math Quiz's weekly stats:
    • Sweet Math Quiz
      203 views
      2 favorites
      1 comments
  • rgco commented on rgco's instructable Arduino Soundlab
    Arduino Soundlab

    Thanks for the feedback! Indeed the buttons are bad. MIDI is beyond my skills. I did implement a (much simpler!) RTTTL interface, see https://www.instructables.com/Arduino-Chrismas-Tun...

    I see only now, awesome!

    View Instructable »
    • Battery-powered Irrigation for Balcony Plants
      715 views
      5 favorites
      0 comments
  • rgco commented on rgco's instructable Minimal Arduino Metal Detector
    Minimal Arduino Metal Detector

    The Arduino does indeed have an internal 1.1V reference, and it can be used for the ADC or for the comparator. Also the input capture can be guided through the analog input pins to compare to 1.1V, but I 'misused' a digital input as comparator.

    View Instructable »
  • rgco's instructable Minimal Arduino Metal Detector's weekly stats:
    • Minimal Arduino Metal Detector
      3,072 views
      31 favorites
      11 comments
  • rgco commented on rgco's instructable Minimal Arduino Metal Detector
    Minimal Arduino Metal Detector

    You looked seriously into it! Why 1.1V? The Arduino switches between HIGH and LOW at Vcc/2. I did a dedicated check with a potentiometer and it really switches over at 2.5V, with a small hysteresis of ~10mV. So the multiplicative factor of 1.44 is really dividing by ln(2).

    Thanks for sharing! How did you determine L and R of the coil? the values seem rather high (especially R- unless the wire is very thin, but it doesn't look so from the picture).

    View Instructable »
  • rgco followed mircemk
      • DIY Arduino Retro Look FM Radio With Linear Scale
      • DIY Arduino Pin Pointer Metal Detector
      • Extremly Simple Tesla Coil With Only 3 Passive Components (8+ Cm Spark)
  • rgco commented on rgco's instructable Minimal Arduino Metal Detector
    Minimal Arduino Metal Detector

    No, you will need insulated electric wire made of a copper or aluminium. It can be bought or recovered from discarded electrical equipment. My favorite resource are the correction coils found in discarded CRT TV's, they often contain 100 or 200m of pristine enameled copper wire.

    The capacitor blocks the DC current through the buzzer. The value is not critical. It will work fine with 100muF, probably also with 1muF.

    View Instructable »