Nuiteblaster fail
I aligned the mirrors and powered up the draft hardware for the Nuiteblaster, and it didn’t work. This kind of fails to surprise me, as I changed a lot of stuff in the design. I think my speakers are good, but that using MOSFETs was an error. I used MOSFETs because they have a very low resistance when turned on, so they don’t waste energy as heat.
However, the MOSFETs in the design are switching 12V, and are getting a base drive of 5V. This means the voltage from the gate to the grounded source (Vgs) is at most 5V, because that’s what the Arduino can source, voltage-wise. The voltage from the drain to the source (Vds) is 12V. Since Vgs is > Vth (the point at which the MOSFET turns on), but nowhere near 12V, the MOSFETs are probably not getting driven into saturation, even when the outputs are fully on. This is compounded by the fact that since the code runs the PWM of the Arduino very fast, it is unlikely that that gate capacitance gets fully charged, and so the MOSFETs probably see a much lower average voltage at the gate, and so are probably operating in ohmic mode most of the time.
Whatever the cause, the speaker motion was quite small, and the MOSFETs got so hot that when I licked my finger and touched one of them, it sizzled.
I’m contemplating two possible fixes for this. The first is to replace the MOSFETs with the TIP120 power darlingtons that the schematic calls for. The second is to build my own power darlington transistor out of a 2n2222 switching the gate of the MOSFET to the full 12V of the beefy power supply that I’m driving the whole thing with. This would almost certainly drive the MOSFET into saturation, and hopefully get me the gain that my current rig lacks.
The speakers might also not be the best speakers for the job, but they are the ones I have. If I can’t get the system to work by changing the electronics, I’ll try new speakers next.
FFMPEG recipes
ffmpeg -y -i video.avi -vframes 1 -ss 00:00:10 -an -vcodec png -f rawvideo -s 320×240 frame.png
Extract the frame at 10 seconds into the video file video.avi, resize it to 320×240, and save it to frame.png.
Coloring cells based on cell value in OpenOffice
OpenOffice (probably LibreOffice too) has limited functionality for setting the background color of a cell. I wrote a little macro that colors each cell blue, with saturation depending on the range of the value. This is in OOBasic, but it demonstrates the general idea, and the proper way of setting cell background colors.
Sub Main End Sub sub ColorCells dim ii dim jj dim r dim g dim b dim doc as object dim sheet as object dim cell as object doc = ThisComponent sheet = doc.Sheets.getByName("Sheet1") for ii = 0 to 5 for jj = 0 to 626 cell = sheet.getCellByPosition(ii, jj) r = 255 - (cell.Value * 255)65536 g = 255 - (cell.Value * 255)65536 b = 255 cell.CellBackColor = RGB(r,g,b) next jj next ii end sub
Again with the lasers
There is an Instructable up on using speakers as galvanometers for a laser projector. This looks just about optimal for the Nuiteblaster, as it provides readable text without defocusing or otherwise spreading the laser beam.
I’ve started building one, with a couple of modifications. Instead of resistors, I’m using diodes to snub the back-EMF from the speakers. I’m also using MOSFETS instead of transistors to switch the power to the speakers. MOSFETS have lower on-resistance than transistors, and so transfer more power and waste less energy as heat. They also have VERY low gate current (low enough to treat as non-existent for my purposes), so there’s no need for current-limiting resistors on the gates, although a resistor might be good to limit any ringing that might happen from slamming 5V into it. Since I’m driving it directly from a 5V microcontroller, gate drive and switching time hopefully won’t be a concern.
CSS: Turing complete?
“The simple selector matches if all of its components match. ” according to the W3.org page on selectors. That sounds to me like an AND gate, in that something is selected if the logical AND of its components match.
Combine that with logical inversion, provided by the not selector, and it seems to me that you get NAND, which is a universal gate. Any boolean function can be composed of NAND gates, so it is in theory possible to compose an entire CPU out of NAND gates.
This makes it seem to me like you could write a processor simulation in CSS.
The main thing that I wonder about is how browsers evaluate CSS, because if it is not re-evaluated until nothing happens (e.g. nothing gets its attributes changed) then the CPU wouldn’t work because the “output” of a selection would not be able to be used as input into more selections (e.g. by changing their classes). Heck, I’m not sure you can even have CSS change the classes of an element on the fly.
But if you can…
Nuiteblaster Redux
Every year, in early October, there is an arts festival in Toronto, called Nuite Blanche. The real title is “Scotiabank Nuite Blanche”, after a surprisingly large bankcorp that apparently decided that giving an arts event a bunch of money was a good move. Whether this makes for a bunch of overly bland corporate art is a question for people who spend more time thinking about that sort of thing, but I will note that the independent/outsider art pieces that were allowed to participate were in a parking lot in the distant reaches of bumblefuck nowhwere.
BORING.
Also, at least in 2010, a lot of the pieces could be summed up as “Revenge of the Son of the Guy with a 20k Lumen Projector”. There were a lot of illuminated rectangles of shifting colors or scrolling text messages projected on the flat sides of buildings. That’s not how you do engagement with the urban space. Really, they could have at least done projection mapping on interesting buildings, or responded to the historical and geographical placement of the building. That’s also not how you do engagement with the audience. Any pinhead with $200 to rub together can have “LOL DONGS :-P” in fifteen foot high letters on the side of a building. They don’t really need an an artist with a SMS-to-projector gateway to set it up.
The cumulative effect of both the administrative actions (street closings, businesses staying open later) and the placement of the art seems to say that art is still a one-way channel from the artist to the spectator, but also a transient thing that doesn’t leave a permanent change in the urban environment. Art is something other people make for you to watch at special times, not something for you to do whenever you want.
WEAK.
So I’m restarting my project to build the NUITEBLASTER. It’s a portable projector that people can use to project responses (critical or otherwise) directly onto the art at Nuite Blanche. The heart of the projector will probably end up based on this laser projector, using a 200mW laser shining through a tiny LCD. Laser-based projectors have a couple of unique advantages over white-light projectors, not the least of which is that they are in focus at all distances. By choosing an output lens with minimal enlargement, I can probably throw a readable image quite a long way. The whole device will be lightweight and small.
For the display and input, I may end up using a combination of an LCD from one of my old wearable computer monocular displays and a BOB-II video overlay board that I have sitting around. I may also just skip the video overlay board entirely and have a laptop with S-video or composite out generate the video signal directly. Either way, people will be able to put the generated video stream up on the sides of buildings. I’ll let members of the public put whatever they want up, right next to (or over) the approved artists.
Eclipse Unresolved Imports with ROS on Ubuntu
I use Eclipse as an IDE. I do this to get code completion and syntax highlighting, as it does those pretty well for C/C++. Recently, I was trying to write a ROS plugin, and Eclipse couldn’t find the ros.h header file, which I had included with the line #include "ros/ros.h"
. Because of this, it marked every line where there was any use of anything from that header as an error, and gave a warning on the include line. They were not errors, and the code still built fine, but the IDE displayed it wrong. To fix this, I tried the normal solution, which is:
Click Project -> Properties -> C/C++ General -> Paths and Symbols -> Includes -> GNU C++ and then use the Add button to add the path to the include file. After that, reindex the project by right-clicking on the project, clicking Index -> Rebuild, and the include should be resolved.
Unfortunately, it wasn’t. Restarting Eclipse didn’t pick it up.
These instructions suggested that it might be something wrong with my language settings, but that doesn’t work either.
This is the proper way of doing it, and it actually works.
Now my tools are out of the way and I can start work. At 5:00PM on Friday.
LabVIEW is awful
This is really just a rant, I’ll have neat and useful information in my next post, I swear.
Everything that this guy lists that I have had the displeasure to run into is correct, and worse than he makes it sound.
LabView is a graphical environment for creating processes to manage a flow of data, usually acquiring it from some device, performing some processing on it, and displaying or recording the data. To create a process in LabView, you drag and drop little boxes which do things to the data, and then point and click to draw wires between the boxes, which show how the data should flow. This is kind of a problem, for a number of reasons.
Imagine if you are trying to get the 1st through the 50th elements of an array. Near as I can tell, in LabView, you use an “Index Array” block, wired to fifty integer constant blocks (each containing a digit in 0..49) with 50 wires. The “Array Subset” block sounds promising, but actually gets you an array, not the elements. If you want to expand this to, say, 100 elements, you need to add 50 more constants, and 50 more wires. This gets tedious very fast, but I guess it’s not so bad, if you otherwise can’t program, and so don’t know that real programming languages will just let you operate on members of an array without pulling them out first, using syntax that takes more time to describe than it does to type.
See, if I wanted to get the fifth element of an array of integers in LabVIEW, multiply it by 10, and put it back, I’d have to use an “Index Array” block, an “Integer Constant” block with the value 4 (zero-based array indexing) to get the value, a “Multiply” block and an “Integer Constant” block with the value 12 to do the multiplication, and a “Replace Array Subset” block using the first “Integer Constant” block to put the value back. This would also require at least 8 wires. I would have to put all of those things in place, and then wire them up using the mouse.
Or I could type “arrayName[4] = arrayName[4] * 10;”, assuming I was working in C, C++, or Java. For Python and Perl, leave off the semicolon. Oh hey. See what I did there? The same operation, only mine is good for 5 languages, takes around 33 characters (so seconds to type), and is all done without a single mouse click or paying thousands of dollars for a license. If that were the only problem with LabVIEW, it would be enough to exclude it from me ever considering using it for anything. Since I don’t get to make that choice at work, I just spent the better part of three days trying to get it to format some data and send that data over the network. For those playing along at home, slinging some data across the network is maybe a 20 minute “problem” in any other language that real humans use (brainfuck, befunge, etc. don’t count, and assembly is a corner case).
The miserable interface doesn’t just make it slow to create anything in LabVIEW. It also makes it easy to get wrong in annoying ways. The analog of a typo in Labview is connecting things wrong. Given that you are aiming for a ~10 pixel target with no space between it and and the equally connectable, but incorrect, targets on either side of it, the quality of your code depends on the resolution of your mouse and your visual acuity. That’s right. Not your ability to break down a problem into its component parts and determine what algorithms solve those parts. Your mousing skills are what determines if you got your “code” right. This also means that if you are hooking up 60 connections, and you accidentally skip one, you have to move a bunch of the other connections to get the one that you skipped back into place. God help you if you don’t catch it, as the data will be ok, but one element of it will be out of order.
My new favorite way of commenting out code blocks
/* Debugging, print out the array for (int ii = 0; ii < sizeof(data); ii++) { if ((ii % 8) == 0) { cout << endl; } printf("%02X ", ((unsigned char *) data)[ii]); } cout << endl; //*/
That last line is a single line comment that closes a multi-line comment. By adding or removing "*/" to the comment that describes the block, I can comment out the entire block. No more hunting for the proper point to close it at, just adding or removing the comment closure to the top line.
Of course, this doesn't work if there's a multi-line comment inside the code block.
Welding
I’m trying to build a tricycle tallbike, because nothing says “overconfidence” like having your first welding project be something that drops you into traffic if the welds break.
It will have two front wheels and one rear wheel. The rear wheel will provide power, and the two front wheels will provide steering. I’ll post photos as soon as I have any of it together.
Recent Comments