I've written a program which implements the functionality for a buzzer round of a quiz game. This is suitable for two, three or four teams to have a common button (or buttons wired in parallel). The program performs a power-up test of lights and buzzer before entering the main loop. When a member of one team presses the team's button, a buzzer sounds for one second and the team's light stays locked on until the quizmaster hits a reset button.
It requires an Arduino compatible micro-controller configurable as five digital inputs (button1, button2, button3, button4, reset) and five digital outputs (light1, light2, light3, light4, bell). The first team has a very small advantage which can be measured in millionths of a second. Making a completely equally weighted input is left as an exercise. Keeping score is a more difficult exercise because it requires a routine to compensate for switch bounce.
begin 644 buzzer.ino.gz
M'XL(`#P`AUD"`WV26T^#,!B&[_D57^(-6]1!6]V,V<W,/"33>6#9-9%N:X(M
MEJ+9S/Z[I3`$I+N#]^G[G0=]F&2['95P*R2\9&P'=^$'3:$_<`9]<&]ZR/.'
M$&PHW`B>"JE8]G&>TQSGS!MY(Y#T+%6A5`>0)O2=K;:0,)["2D=F/,E4"B&/
M0&0J_S9!3B*Z8IS"[.'N/O`!-04$N"E@($V!P$4E3*:S&5S^_2Z"8/[DP["E
M(!BU%`Q7+86`[U72R^OT;1J`[SO.EV`11(RO7<85Q#WX<4#_KYD*XZ5DBKKQ
MZ;VNJW?=UO/B:HC&X=;U/<^SO)S-EX9(JC+)KYW](;?0N3O2%O.K;/\9.L+P
M$49*=BC@\SMDJMF]KB@V[N\-BZE;QGBE8>06H^N-QWD0^-GG[TT')J"^$YEQ
M$/R=FF,P"5+=<5*VJ*_G4415=_-%\+P(3*H&05:"K81T$3/Z+KTXI=.'IVZ"
MK`1;">D@Q;AJP`RWZ+[X+X=7)\A*L)60%JF=6;D421,:*AK%V[_5Q$(<-L-6
LC3V7`]*+-B=NGD!Y*[7R]S8GLCO1<2>V._%Q)[$[2>6L#>87E=OD@RH%````
`
end
(This is the 37th of many promised articles which explain an idea in isolation. It is hoped that ideas may be adapted, linked together and implemented.)
I'm working on a 3D surround sound speaker array as part of a larger project. I'm working through a list of tasks. One particular sticking point has been to deploy code on a micro-controller. This has been a limitation since at least Apr 2015 and has been complicated by trying to use a clone of the least supported Arduino on a poorly supported host without using the supplied idiot interface. Regardless, I report success if using a large number of third-party binaries count as success.
The first complication is that Arduino is open source and the schematics are freely available. Therefore, anyone who is time rich and cash poor may purchase a clone of the official Arduino boards. I purchased a board which was approximately 1/2 of the official price and I'm told that it was possible to purchase similar for 1/3 of the official price. So far, I've not encountered any incompatibility but I'm told that clones may omit ground-planes to reduce cost and therefore I/O may fail to work at full rated speeds. This is quite pausible. I understand that the processor on the first Raspberry Pi was only intended for use with eight layer boards and that the choice to use a six layer board limited storage card communication to a maximum of 15Mb/s and even this is optimistic.
The second complication is compiling ARM Cortex M3 code for no operating system when the host is ARMv6. This involves installing a random set of binaries on Raspbian using apt-get and then using /usr/bin/arm-none-eabi-gcc which may or may not have been present when I started.
The third complication is deployment of code to a Atmel ARM SAM via BOSSA. Each manufacturer has its own method of programming a micro-controller and this particularly true for ARM. So, one protocol is used for Atmel AVR chips, a different protocol is used for Atmel ARM chips and different protocols are used for ARM chips from other manufacturers. To further complicate matters, there are two (or more?) implementations of BOSSA programmer. The official one from Atmel works on Windows and Linux. An open source re-implementation uses wxWidgets and works on more platforms. From the dependancies installed via apt-get, it would appear that Raspbian uses the implementation which uses wxWidgets.
The fourth complication is that installation of arduino, arduino-core, bossa and bossa-core fails to provide any ARM firmware under /usr/share/arduino/hardware/arduino or suchlike. Indeed, the Arduino IDE 1.8.0, 1.8.1, 1.8.2 and 1.8.3 has no support for ARM. This would be particularly problematic if downloading the software recommended via Arduino's online shop. Ignore the official recommendations. Use 1.6.8 or 1.6.13 rather than the latest and greatest version.
The fifth complication is to avoid the IDE. This can be achieved by hacking up some random Makefile to use $(HOME)/Arduino-1.6.13/hardware/arduino/sam, /usr/bin/arm-none-eabi-gcc and /dev/ttyACM0. You may also want to use suitable flags to reduce compilation time, compilation size and execution time. Unfortunately, this will not increase security because there is no support for stack protection when using Arduino's BLOBs.
After working through these problems, compilation and deployment of a blink light worked first time. After a quick play with LED PWM, I devised a library so that it is possible to divine more than one bit of state when an error occurs on a micro-controller. Indeed, this will blink up to four hexadecimal digits and also blink an arbitrary error string in Morse code:-
begin 644 error.c.gz
M'XL(`"K3AED"`Y68;6_:,!#'W_,I/"J50"$8VK6LK)TZ^L36EJZCZQXU&6+`
M(R29$TK9Q'>?0R`%#+E=D%"P[WX^W_WMF!1SY$1:0^&XY$Q*5Y*::W%R)5J2
MR3')%5/%'#%JV3(M'9!FCZMNQW=E((8#,^P-N]O,M@D/G0WZ5"KO[N73Z2SI
M*!9W+)O[/K%=UR-NAPR8['-)F&,12W1%X)NS$181^?2U\F%=;L*4:U?Z/`XD
M#))6:(7X`9/!O'7H<V+Q#AO:03Q5X5BBS0(%]X1#ALZ4[P8]+D="F?L>;XN.
MX-84O24ZC@*0^LUIO7;2;-S]O*W?I+94DW#X<BLI[::V5+RBDTH]NL**YO2S
M90NG;P@G("P??K>RY&^*1#E@]H,4`3>6./G+^L5EMAK:<)N-#1;=;[:_:CPL
MF+>F]Y('0^E44Y.E6+K,,V;#3VWW*4VPMMQ@9KTXDS*E^7*R'_-[:QSW04=/
M>--$69&S+[H.MTB[QR2Q:>BF%&'8](A6;?K:L+;ITWE6W>[L1/9D,>[0?!)'
M,)WXYH$'H92,<*`<\<>#"!=&XL7#>N&PJN^;1W]4O84Q_9$(VCUCUC5O)4K6
M2DP9,W,8MVCQ15=+<M:?_YPL>1?6>4^S"[C/-*][QXG8Z#Q!)"ZJ5CY*G):V
M44_8W"@='97F65$+[EIM,2OZ;=PW;^^;LZ@6%5,*M5:924:1.U'-J6J))_:L
M'.OXN%2>F4Y6'#;85]:;;[#>6VN]P9@N&<<*TO43*VA%/W,-D"4-D"7%IDEZ
MH9@KY7Q6PQSU(@E5,-6G@.)]SR0!%:U0,%'`[62>:>)P!C!?9'19$(=+'TWD
MA1<*5P*+@<*5$W$F%K>;C,-*;P_`(4OQ$L+AE+*?K!0L[B!9*%A<!=`=$O<*
MDC$.9P)[`':5Y:'D(957!&J+G.X;:)DAJW&2.5QI8<D)1='?:O06)'44OZ;Q
MV]`S"\4_U?@6$#\*?Z;A>6+R4?!S#=X!M(/C7VC\+K!T4/A+#=^#-ET4OZ[Q
M13(?17^GT7]!CUL4_[W&[P/"1^&O-+P-';50_&N-/TC6#HI^H]&=Y.2@Z`V-
M[@)/-!3^5L-[@')PX7_0^+^!98N+_T[C2T`Z*/Q'#>\#VP(*W]3P06)V4/![
M#3X$=F04_I.&?X0.T2C^@\8?`<I$X3]K^"?HZ(3B?]'X8^@/&HK_5>/_@8Z2
;_\E?\W9FP_N9C9#E=S4++V?^`7A,_//4%0``
`
end
Model says she was freed after 'deep web' kidnapping in Italy: Police
The alleged abductors used encrypted accounts to ask the model’s agent for $300,000 to stop the auction from taking place, claiming to work on behalf of something called the "Black Death Group," which operates within the so-called deep web, police said.
The deep web, or "dark web," is a network of websites that cannot typically be found by search engines, and are often protected through encryption. Billions of dollars in drugs, weapons and other items have been illegally traded on the sites.
Investigators discovered evidence that the suspect, Herba, may have previously organized several online auctions of abducted women, through ads he allegedly described the women and set starting prices. Police said it is unclear whether he actually abducted the women or whether they had ever really been for sale.
Italian police described Herba as a "dangerous subject with aspects of mythomania," which is a pathological inclination to exaggerate.
"It is unclear ... whether the young people were really kidnapped or whether the man invented everything," Deputy Prosecutor Paolo Storari said at a press conference. "The man also presented himself as a professional killer."
Mythomania, they say.
Update: Milan kidnap case: Chloe Ayling 'held to pay for cancer treatment'
So far I don't see why it's any better than Objective-C. Perhaps I'll find that out later.
I just resumed iOS App development after quite a long hiatus. My iPhone was stolen and my MacBook Pro dropped dead just a couple weeks after AppleCare expired.
Now I have a Mac Mini and an iPhone 7. (The 7 Plus is too large to hold comfortably.)
I've been working on Warp Life since time began.
Some of the APIs I use have been deprecated. I'm unfamiliar with their replacements, and have found that all the tutorials are in Swift.
My current job is a consulting contract. While my clients and I really like each other, when I finished all their projects I'll be out of work again.
I hope to get a job as an iOS App Developer. Just to be considered for that role, one has to have published at least one App in the App Store. Having a stellar resume doesn't help one bit - you need that one published App, even if it's totally braindead.
I've got at least six months before I have to look for a new client.
Is There a Giant Planet Lurking Beyond Pluto?
Not much new here, but this looks promising:
Michael Medford and Danny Goldstein, graduate students at the University of California, Berkeley, think they have a solution to that problem. Drawing on hundreds of thousands of images covering the search area for Planet Nine—all shot from 2009 to 2016 using a 1.2-meter telescope in the mountains north of San Diego—their system will combine multiple images in an ingenious way that should brighten the faint flickers of light from Planet Nine enough to distinguish them from background noise.
“Because the planet is moving with respect to the background stars, you can’t just add overlapping images together,” Medford points out. Instead, their software selects each of the many distinct plausible orbits for Planet Nine, projects the planet’s movement onto the relevant patch of sky, and then offsets successive images to superimpose—and brighten—any pixels corresponding to the planet. A pipeline of software written with Peter Nugent, their faculty advisor, performs the overlapping and subtracts known objects such as stars.
The computational task is enormous because the planet’s orbit is still so uncertain. To do a 98 percent complete search, Medford estimates, they will need to perform 10 billion image comparisons. Fortunately, Nugent has time allocated on the Cori supercomputer, a new Cray XC40 system that recently ranked as the fifth most powerful in the world.
False positives are unavoidable. “Even if we get only one false hit for every million searches, we’ll still get 10,000 fake planets,” Goldstein says. “So we will be passing all detections through a machine-learning system trained to catch and reject artifacts: satellite trails, hot pixels, cosmic rays, and other spurious sources.”
With the data already in hand, the two expect the system, running in parallel on hundreds of Cori’s CPU nodes and 278 hyperthreads per node, to finish the work in just a few days when they flip the switch in August. “We’ll be sitting on the edge of our seats,” Goldstein says. “And whether we find P9 or not, this method can be used to detect other TNOs.”
Motor control using audio amplifiers tenuously overlaps with speaker arrays. It uses some of the same amplifier chips and some of the same code to process WAV files. In particular:-
begin 644 audio-for-motor.c.gz
M'XL(`*-T@UD"`[57;4_;2!#^SJ]84D%MXR1KQZ1<P4B4HRU26ZI`#U5<%)ED
MDUC:[%KV&D(/_OO-OMBQ0Q*H3H>0UYZ9W7EF=M[2=M`/$=-8/*`KCCX11M)(
M$'22CV*.KJ,[\I&GLPS!$WWE`IZGG(F44^2TM]H.LDYM'WOOT-642$[&4Q'G
MLY;D2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shell> cc audio-for-motor.c -o audio-for-motor
shell> audio-for-motor -t 60
This will generate 113 audio files - a useful subset of 9^4 (6561) possible permutations. The format for the audio files is four digits where:-
and:-
So, 8-8-4-4.wav means full speed forward. 8-0-4-4.wav means left forward, right backward. (Turn clockwise on spot?) 8-8-3-3.wav means full speed with slight negative trim.
This works with a PAM8403 amplifier board and a compact cassette tape pinch motor powered at 3.3 Volts. It is quite fun to click on the icon of an audio file and then see a motor change speed and/or direction. However, the speeds are not monotonic and I suspect the effect may be influenced by vibration in the motor induced by the low frequency signal. Also, the efficiency is worse than expected - even after several modifications to the wave generation algorithm. As a fallback case, diodes may be used. This may improve efficiency. It also doubles the number of motors which can be controlled (at the expense of bi-directional motion).
(This is the 36th of many promised articles which explain an idea in isolation. It is hoped that ideas may be adapted, linked together and implemented.)
I've been off-line doing various tasks. During this period, I've researched Arduino library code. One particularly dumbed-down snippet has appalled several members of my local makerspace. From /usr/share/arduino/libraries/Robot_Control/examples/learn/LineFollowWithPause/LineFollowWithPause.ino:-
Robot.setMode(MODE_LINE_FOLLOW);
Yep. The Arduino library has functionality to abstract away the feedback algorithm required to make a line-following robot. It also has:-
Robot.pauseMode(true);
presumably so a robot can dance, stab someone over the Internet and then continue following a line.
Something I find quite bizarre about the Arduino libraries is the mix of software licences. Are they even compatible? The bootloader is LGPL. Most of the libraries are GPL or MIT licence. Documentation is Creative Commons. I have no idea why documentation would be under a different licence to all of the code.
Most of my time has been spent writing software to process or generate audio signals. I started with a utility to upscale monophonic or stereophonic audio to Ambisonic WXYZ format. It occurs to me that I have to extend the functionality of the sound processor for the speaker array to handle A-Format and B-Format. This optionally requires a 4×4 matrix multiplication prior to the main signal processing. However, the contents of the matrix depends upon the orientation of the original recording. A-Format is typically four directional microphones in a tetrahedral arrangement. Most obviously, one would be "up" while three others would have 120° spacing and a downward incline. This can be converted into the directionally neutral B-Format which is more suitable for mixing and soundstage rotation. Or A-Format could be played directly. However, any use of A-Format assumes one orientation or that some meta-data is present which specifies a known orientation and/or arbitrary inclines.
Anyhow, converting monophonic or stereophonic audio incurs a pivot and one bit loss of audio quality described in Meridian Audio's documentation for Meridian Lossless Packing. Specifically, W=(L+R)/2 and X=(L-R)/2. It was this expected pivot operation which led me to consider A-Format to B-Format processing. Presumably, W=(P+Q+R+S)/4 and the remainder depend upon microphone orientation.
After writing a program to read a one or two channel WAV and write a four channel WAV, it was trivial to re-purpose this into a program which only writes a two channel WAV. This outputs variants of sine waves for line-following robots, quadcopters and suchlike. Code to follow.
Battle of the racial alternate reality fiction concepts:
Amazon's Making Its Own Post-Civil War Series Called 'Black America'
A couple weeks ago, HBO announced that the guys behind Game of Thrones—no, not George R. R. Martin, but showrunners David Benioff and D.B. Weiss—are working on a new series about an alternate history where the Confederate South won the Civil War and seceded from the union. The show, titled Confederate, caused a big stir online from people who thought that, well, maybe a pair of white dudes best known for making a fantasy show about dragons and zombies and incest aren't the best people to tactfully address modern-day slavery.
In the wake of the controversy, Amazon took the opportunity to announce that it had also been working on a similar alternate history show over the past year—but with a few key differences, Deadline reports.
First, Amazon's show, called Black America, will be the brainchild of Boondocks genius Aaron McGruder and producer Will Packer, who did Straight Outta Compton and, more recently, Girls Trip. Also, instead of Confederate's faux-history about a split United States where slavery still lives on, Black America is set in a world where freed African Americans were given a trio of Southern states after the Civil War as reparations. Louisiana, Mississippi, and Alabama are fused to form a new nation, called New Colonia, and the series tackles its tenuous relationship with the original US of A.
Confederate reminds me of the fun but low-budget mockumentary C.S.A.: The Confederate States of America. Black America reminds me of Ta-Nehisi Coates' article The Case for Reparations. He is also involved in entertainment; he wrote the new Black Panther comics for Marvel last year, which have been cited as an influence for the upcoming movie.
Amid HBO’s “Confederate” fallout, Amazon introduces alt-history show “Black America”
The African-American community has long made the case for reparations from the United States government. Ta-Nehisi Coates convincingly argued in 2014 that the freedom given to slaves after the Civil War was not enough — that black people in America had suffered through institutionalized racism long after slavery had been abolished.
Packer told Deadline that the controversy surrounding “Confederate” pressured him to divulge the upcoming project. The show itself is not a reaction to “Confederate,” as reports say it has been in development for over a year.