tag:blogger.com,1999:blog-6227791252039855587.comments2024-03-14T10:52:09.729-05:00Lucid MeshSam Koblenskihttp://www.blogger.com/profile/16088649179174139591noreply@blogger.comBlogger25125tag:blogger.com,1999:blog-6227791252039855587.post-77675776302863085542023-12-29T09:13:21.431-06:002023-12-29T09:13:21.431-06:00thank you for writing this. it helped clarify whic...thank you for writing this. it helped clarify which book I wanted to buyAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-6227791252039855587.post-31090252062522888982023-07-01T17:24:05.797-05:002023-07-01T17:24:05.797-05:00Not sure if you will see this but I want to thank ...Not sure if you will see this but I want to thank you for writing this! I am a programmer and picked up juggling some time ago. You put some of my exact thoughts into words here. Best wishesAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-6227791252039855587.post-62201811690139367732022-12-20T17:37:49.093-06:002022-12-20T17:37:49.093-06:00Thanks, it made me decide to focus efforts on SICP...Thanks, it made me decide to focus efforts on SICPAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-6227791252039855587.post-54313746557643785042021-05-12T02:49:37.143-05:002021-05-12T02:49:37.143-05:00Thanks so much. I am doing the online course on Co...Thanks so much. I am doing the online course on Codecademy and I know the course only touch the fundamental part of Python. I was hesitating whether I should buy both books and you answered my question. Samanthahttps://www.blogger.com/profile/09042114787498873122noreply@blogger.comtag:blogger.com,1999:blog-6227791252039855587.post-500405749964365662021-02-26T05:04:22.312-06:002021-02-26T05:04:22.312-06:00Thanks! A very nice write-up!
I was just in the h...Thanks! A very nice write-up!<br /><br />I was just in the hard decision process of choosing between the two books, and have read this rationale for HtDP and became more inclined toward the HtDP:<br /><br />https://cs.brown.edu/~sk/Publications/Papers/Published/fffk-htdp-vs-sicp/paper.pdf<br /><br />However, after reading your post, I'm now convinced that SICP suits me better! I don't want to waste much time on rudimentary stuff, or even learning Scheme as my first Lisp; because I'm already well-versed in Clojure, and familiar with a lot of programming paradigms. Rather, I want to gain the insights people get from reading the Wizard Book ;)<br /><br />Thanks again!Saeid Akbarihttps://www.blogger.com/profile/03995705250843159106noreply@blogger.comtag:blogger.com,1999:blog-6227791252039855587.post-3477649130262790292020-10-14T10:33:36.136-05:002020-10-14T10:33:36.136-05:00Only after posting this did I realise a couple of ...Only after posting this did I realise a couple of my 'magic number' #defines are wrong:<br />MEASURE_MAX_ADC_VALUE // should be 4095u for a 12 bit ADC<br />MEASURE_MEDIAN_ADC_VALUE // should be 2047u for a 12 bit ADC<br />Anonymoushttps://www.blogger.com/profile/16183636019528150340noreply@blogger.comtag:blogger.com,1999:blog-6227791252039855587.post-54608444911188032782020-10-14T05:55:27.822-05:002020-10-14T05:55:27.822-05:00Hi There
Thanks for this really useful post. It sa...Hi There<br />Thanks for this really useful post. It saved me some time in getting to my solution.<br />As a payback, I've pasted my implementation in 'C' in the hope that it may be useful to others who visit.<br />Best wishes.<br />Gerry Murray<br /><br />/***************************************************************************<br />Description: Calculate the fraction between two floating point numbers.<br /> Used for linear interpolation<br /><br />Parameters: float y1 The firat number<br /> float y2 The second number<br /><br />Returns: none<br /><br />Notes:<br /><br />***************************************************************************/<br />static float InterpolateZero(float y1, float y2) <br />{<br /> return -y1 / (y2 - y1);<br />}<br /><br />/***************************************************************************<br />Description: Establish the farctional number of samples between two zero<br /> crossings of the array passed.<br /><br />Parameters: uint16_t * samples The sample array.<br /> uint16_t numSamples The number of samples to be examined<br /> This may be less than the size of the array<br /><br />Returns: float The fractional number of samples between the first two<br /> zero crossings.<br /><br />Notes:<br /><br />***************************************************************************/<br />static float ZeroCrossingPeriod(uint16_t * samples, uint16_t numSamples)<br />{<br /> uint16_t count = 0;<br /> float zeros[10] = {0.00f};<br /> float fraction = 0.00f;<br /> uint16_t i = 1u;<br /> uint16_t lACMeanValue = 0u;<br /> uint16_t lMaxValue = 0u;<br /> uint16_t lMinValue = MEASURE_MAX_ADC_VALUE; // 12bit ADC so max is 2047<br /> float lResult = 0.00f;<br /> <br /> <br /> // Get the median value of the array<br /> for (i = 0; i < numSamples; i++)<br /> {<br /> if(samples[i] > lMaxValue)<br /> {<br /> lMaxValue = samples[i];<br /> }<br /> if(samples[i] < lMinValue)<br /> {<br /> lMinValue = samples[i];<br /> }<br /> }<br /> if (lMinValue < lMaxValue)<br /> { <br /> lACMeanValue = lMinValue + ((lMaxValue - lMinValue)/2);<br /> }<br /> else<br /> {<br /> lACMeanValue = MEASURE_MEDIAN_ADC_VALUE; // 12bit ADC so median is 1023<br /> }<br /> <br /> for ( i = 1; i < numSamples; i++) <br /> {<br /> if (samples[i-1] <= lACMeanValue && samples[i] > lACMeanValue)<br /> {<br /> fraction = InterpolateZero((float) samples[i-1] - (float) lACMeanValue, (float) samples[i] - (float) lACMeanValue);<br /> zeros[count] = ((float) i + fraction);<br /> count++;<br /> }<br /> }<br /> if (count > 1)<br /> {<br /> lResult = zeros[1] - zeros[0];<br /> }<br /> else<br /> {<br /> lResult = 0.00f;<br /> }<br /> <br /> return lResult;<br />}<br />Anonymoushttps://www.blogger.com/profile/16183636019528150340noreply@blogger.comtag:blogger.com,1999:blog-6227791252039855587.post-4189517386339756872020-08-31T22:33:02.277-05:002020-08-31T22:33:02.277-05:00Hi Ivan,
Thanks, I ended up using Pixi.js for the...Hi Ivan,<br /><br />Thanks, I ended up using Pixi.js for the graphs, and I wrote up a post on that as well: https://sam-koblenski.blogspot.com/2015/08/a-barely-adequate-guide-to-javascript.html.<br /><br />As for your clap detector, I would start experimenting with the signal envelope and setting a threshold for the spike in the signal from the clap. The spike should be pretty high and narrow, so calculating the duration, like I do in this post, and setting a fairly short duration threshold should work. Your dsPIC should be able to handle those fairly simple calculations, and the algorithm lends itself well to doing the calculations as the samples come in realtime.Sam Koblenskihttps://www.blogger.com/profile/16088649179174139591noreply@blogger.comtag:blogger.com,1999:blog-6227791252039855587.post-53287220015488804922020-08-31T13:47:14.911-05:002020-08-31T13:47:14.911-05:00Sam, I am amazed by the beauty of the posts (how d...Sam, I am amazed by the beauty of the posts (how did you do the graphs??). I learned a lot from these visuals.<br /><br />I am working on a project, where i read signal from digital microphone (via I2S data comes as 2's complement 18-bit). Since I am using dsPIC 16-bit processor, I chop of two (highest) bits to convert it to 16-bits.<br /><br />My question is how would you approach with such a small processor a request to recognize the sound of hand-clapping and blink a LED only to that sound?<br /><br />Would the learning/teaching be useful - recording let's say 10 envelopes and later comparing them? A big issue is the LED must blink as soon as possible after the clapping.<br /><br />Thank you so much!<br />Ivan Kotzig<br />EmbeddedGuyhttps://www.blogger.com/profile/00268603254773879337noreply@blogger.comtag:blogger.com,1999:blog-6227791252039855587.post-3890618183136246682020-07-05T08:30:03.745-05:002020-07-05T08:30:03.745-05:00Thanks; something like this should be added to the...Thanks; something like this should be added to the chess.js readme.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-6227791252039855587.post-91895960178073238402020-05-01T09:08:18.539-05:002020-05-01T09:08:18.539-05:00you helped me to understand a few things that I wa...you helped me to understand a few things that I was confused about. All clear now, big thanks!Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-6227791252039855587.post-69527637818204022772019-12-09T08:50:28.707-06:002019-12-09T08:50:28.707-06:00Yes, that's correct, at least it's not acc...Yes, that's correct, at least it's not accurate in relation to how many kWh were consumed from your wall outlet. It may be an accurate measure of how much energy was taken from the battery to travel those miles, but that doesn't account for some of the losses upstream.<br /><br />I did use a Kill-A-Watt meter in between the outlet and the Leaf's charging equipment for a while, but after frying two of the meters and risking something worse, I can't recommend that approach. There are probably more robust meters out there for the high current draw that the Leaf has, but they're much more expensive and I stopped caring so much about the measurements.Sam Koblenskihttps://www.blogger.com/profile/16088649179174139591noreply@blogger.comtag:blogger.com,1999:blog-6227791252039855587.post-87587899084094471242019-12-08T22:44:05.734-06:002019-12-08T22:44:05.734-06:00Hi Sam,
I recently purchased a 2012 Nissan leaf a...Hi Sam,<br /><br />I recently purchased a 2012 Nissan leaf and I wanted to confirm what you're saying here. Are you saying that the energy efficiency meter cannot be relied upon as a means to determine how many kilowatt hours I've used on the road? Is there an easy way to calculate the kwh I've used?Joe Hubrishttps://www.blogger.com/profile/07260770756762495151noreply@blogger.comtag:blogger.com,1999:blog-6227791252039855587.post-74532843769002609832019-11-26T12:01:39.852-06:002019-11-26T12:01:39.852-06:00Thanks, Henrik. Glad you're finding it useful....Thanks, Henrik. Glad you're finding it useful. Also, thanks for the recommendations. I'll have to check them out!Sam Koblenskihttps://www.blogger.com/profile/16088649179174139591noreply@blogger.comtag:blogger.com,1999:blog-6227791252039855587.post-63083612566165542682019-11-26T03:28:55.850-06:002019-11-26T03:28:55.850-06:00Thanks for all the book reviews - I really enjoy r...Thanks for all the book reviews - I really enjoy reading them! And a list like this is very valuable - I've added several of the books on it to my "to read"-list.<br /><br />Have you read Designing Data-Intensive Application by Martin Kleppmann? It's a comprehensive look at databases and distributed systems, and I really enjoyed it (I wrote about it here: https://henrikwarne.com/2019/07/27/book-review-designing-data-intensive-applications/)<br /><br />Other less well-known books I have enjoyed include Exercises in Programming Style by Cristina Videira Lopes, The Effective Engineer by Edmond Lau, and Classic Computer Science Problems in Python by David Kopec (I've written about these on my blog as well).Henrik Warnehttps://www.blogger.com/profile/16665425210341064948noreply@blogger.comtag:blogger.com,1999:blog-6227791252039855587.post-24976702721694598342019-09-24T11:25:21.224-05:002019-09-24T11:25:21.224-05:00If all you need to do is remove DC from your signa...If all you need to do is remove DC from your signal and the DC component is fixed, (instead of being a very low-frequency signal like in my example) then the method of subtracting the average may work better. If you can tolerate some distortion at the beginning during a warm-up period, then using an accumulating average may work best. The average will be way off when it starts, but it will approach the correct DC value fairly quickly. One issue with this accumulating average is overflow, so you may want to use an exponential average with a really long time constant instead.Sam Koblenskihttps://www.blogger.com/profile/16088649179174139591noreply@blogger.comtag:blogger.com,1999:blog-6227791252039855587.post-81448415099086095712019-09-24T10:33:30.746-05:002019-09-24T10:33:30.746-05:00Hi sam, I am really not sure if you are gonna ever...Hi sam, I am really not sure if you are gonna ever read this, but first I found your posts really interesting, they have help me a lot. Second I have a question, I have been stocked in a project for weeks, and the thing is that I am doing a Digital PI control, and I have to kill DC coming from the ADC signal (reading through SPI). And I have used this filter that you are describing. Problem is that the Phase and attenuation are to big! this is because I am using an Fs of 180KHz and my signal to process has 50Hz. So no metter if I use Alpha=0.995 for the filter, attenuation and Phase will distort my signal. do you have any recommendations for filtering DC in a 50 - 60 Hz signals that are being sampled with a high frequency (180KHz in my case).<br />Best regards!<br />and again, really good posts!<br />Max<br />Anonymoushttps://www.blogger.com/profile/03429761416769869237noreply@blogger.comtag:blogger.com,1999:blog-6227791252039855587.post-65444147282007429142019-09-24T07:56:14.024-05:002019-09-24T07:56:14.024-05:00Thanks for this post! I was doing a similar thing ...Thanks for this post! I was doing a similar thing integrating the chessboardjs (and chess.js) libraries into a site running on WordPress. I had the same issues as you did with the pieces not showing correctly or not showing up at all due to the 404 you mentioned. This helped me from any further headscratching. :)apresthushttps://www.blogger.com/profile/17452891440753896678noreply@blogger.comtag:blogger.com,1999:blog-6227791252039855587.post-38684795022430164512019-08-27T03:02:51.338-05:002019-08-27T03:02:51.338-05:00I concur with your conclusions. There is a tendenc...I concur with your conclusions. There is a tendency to over-abstract.<br /><br />Great article!Henrikhttps://www.blogger.com/profile/14637077837221235203noreply@blogger.comtag:blogger.com,1999:blog-6227791252039855587.post-40593536105991478432019-07-24T02:30:48.914-05:002019-07-24T02:30:48.914-05:00I've partly read the Elixir book you discuss t...I've partly read the Elixir book you discuss too. I have found the official online introductory lessons to be sufficient in teaching the syntax and as an introduction to functional programming.<br /><br />I'm now reading Elixir in Action published my Manning. If you'd like to learn what Erlang makes so good (i.e. concurrency, high-availability, etc.), then I highly recommend it.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-6227791252039855587.post-92100964144192044062019-06-07T21:26:58.352-05:002019-06-07T21:26:58.352-05:00Sorry, no, I've never heard of that before. Ha...Sorry, no, I've never heard of that before. Have you taken it in to a dealership to see if there's a problem with the battery or the inverter?Sam Koblenskihttps://www.blogger.com/profile/16088649179174139591noreply@blogger.comtag:blogger.com,1999:blog-6227791252039855587.post-63210014670196474002019-06-07T15:06:05.931-05:002019-06-07T15:06:05.931-05:00I have noticed that my 2013 Leaf charges fully m i...I have noticed that my 2013 Leaf charges fully m in the winter but in the summer months the charging process keeps spontaneously shutting down. So I have to keep the charger on a timer that stops and starts all night long to get the car to build up a decent charge. Do you have any idea why this is?tomalehttps://www.blogger.com/profile/06401702849752301619noreply@blogger.comtag:blogger.com,1999:blog-6227791252039855587.post-4071597822238530872019-05-21T21:52:24.631-05:002019-05-21T21:52:24.631-05:00The signal is actually generated in realtime, and ...The signal is actually generated in realtime, and it's somewhat random. The steps happen randomly at intervals of t=10 with random noise added on top of the steps.<br /><br />The software is just embedded JavaScript in an HTML canvas and using Pixi.js. I go through the basics of how I did it here: https://sam-koblenski.blogspot.com/2015/08/a-barely-adequate-guide-to-javascript.html.Sam Koblenskihttps://www.blogger.com/profile/16088649179174139591noreply@blogger.comtag:blogger.com,1999:blog-6227791252039855587.post-1205623439459575632019-05-21T18:06:14.519-05:002019-05-21T18:06:14.519-05:00Hello, nice explanation.
Can you share the signal ...Hello, nice explanation.<br />Can you share the signal that you used in this tutorial?<br />What's the software that you used to plot in this exemples?<br /><br />Thanks!Anonymoushttps://www.blogger.com/profile/07127500563837311915noreply@blogger.comtag:blogger.com,1999:blog-6227791252039855587.post-40060378385827388572019-02-27T11:14:31.638-06:002019-02-27T11:14:31.638-06:00Nice to read a post from yours again!
I had the sa...Nice to read a post from yours again!<br />I had the same impression about McKinney's book and don't plan to read it again.<br />Another advantage I see about explaining the 'why' is that, some years from now, the Pandas API (function names, etc.) most probably will be very different, and so the first book will be yet more useless. On the other hand, the fundamental concepts probably won't change that much. And so reading the second book (or the second *kind* of book) is overall a much smarter investment of personal time and money.Helton Moraeshttps://www.blogger.com/profile/07379130483212866818noreply@blogger.com