I'm about to start a new LinuxChix course:
Beginning Programming in Python.
It will be held on the
Linuxchix
Courses mailing list:
to follow the course, subscribe to the list.
Lessons will be posted weekly, on Fridays, with the
first lesson starting tomorrow, Friday, June 17.
This is intended a short course, probably only 4-5 weeks to start with,
aimed mostly at people who are new to programming. Though of course
anyone is welcome, even if you've programmed before. And experienced
programmers are welcome to hang out, lurk and help answer questions.
I might extended the course if people are still interested and
having fun.
The course is free (just subscribe to the mailing list)
and open to both women and men. Standard LinuxChix rules apply:
Be polite, be helpful. And do the homework. :-)
Tags: python, programming, education
[
09:51 Jun 16, 2011
More education |
permalink to this entry |
]
Every now and then I think it might be handy to have some sort of
display on the Arduino ... something a little more detailed than
an LED that either blinks or doesn't.
Adafruit's 2-line LCD text display comes with a great
Character LCD
tutorial, but it's quite heavy, and includes a backlight I
don't need. I wanted something more minimal.
The local surplus store always has
lots of cheap LCDs, but they unfortunately tend to be unlabeled, so
you can't tell which pin is which.
But the other day I spied a very lightweight little display for $2.95
that actually had a label on it, so I grabbed it, figuring I'd be able
to get the pinout from google. It said:
DENSITRON 2
617ASNG0441
0201 TAIWAN
Alas, googling produced no useful information for any of those numbers.
Foiled again! It might as well have been unlabeled!
Wait -- let's not give up quite so quickly.
Adafruit's LCD
Shield tutorial says most parallel displays have either 14 or 16 pins,
while this one has 15. That's close, at least ... but comparing the
two Ada tutorials, I could see that the pin assignments for the two
displays were completely different even though both were 16-pin.
I wasn't going to get pin assignments there.
Searching for just densitron 15-pin lcd
found
lots of displays that clearly weren't this one. But apparently a lot of
them were similar to a display called an LM50. Perhaps mine used that
pinout too.
So I tried it, and it worked with only a little experimentation.
Here's the pinout:
LCD pin | Function | Arduino pin
|
1 | Gnd | Gnd
|
2 | +5 V | +5 V
|
3 | Contrast | pot
|
4 | RS | 7
|
5 | RW | Gnd
|
6 | EN | 8
|
7 | D0 |
|
8 | D1 |
|
9 | D2 |
|
10 | D3 |
|
11 | D4 | 9
|
12 | D5 | 10
|
13 | D6 | 11
|
14 | D7 | 12
|
15 | (nonexistent backlight)
|
Or I can use the nice cable with the 8x2 connector that came with the
display, which maps to these functions:
1 = Gnd | Contrast | RW | D0 | D2 | D4 | D6 |
|
+5V | RS | EN | D1 | D3 | D5 | D7 |
|
The Arduino LiquidCrystal library works just fine with it, using
this initialization:
LiquidCrystal lcd(7, 8, 9, 10, 11, 12);
in the
Liquid Crystal
Arduino sketch.
Works great! I went back and grabbed another $3 display.
So the moral is, even a complete hardware klutz shouldn't give up too easily:
with the right web search terms and a little fiddling, you might just
get it to work after all.
Update: apparently something has changed in the LiquidCrystal library,
and you now need a trick to get this to work. Specifically, to see
the rightmost 8 characters, you need to call
lcd.setCursor(40, 0)
. See this discussion:
16x1 LCD
showing only first 8 characters (lcd.setCursor(0,1) not working).
Tags: arduino, hardware, electronics, maker
[
20:25 Jun 11, 2011
More hardware |
permalink to this entry |
]
My SJAA Ephemeris planetary
astronomy column for next month will discuss Saturn, among other topics,
since Saturn is the main planet visible in the evening sky right now.
Saturn has some storms visible right now in the north polar and
equatorial bands, and a great way to focus your attention to see
more detail through a telescope, especially on subtle details like
Saturnian storms, is to take pencil and paper and sketch what you see.
I've recommended sketching in my column many times before, but don't
talk about it on the blog very often.
When sketching Saturn, it helps to start with a template, so you can
concentrate on the interesting details of the rings and bands rather
than fussing over trying to get the exact width of the rings right.
Saturn's tilt changes with time -- right now it's tilted at 8°
to observers here on Earth -- so sometimes the rings are open wide,
sometimes they're narrow, and sometimes (as last year) they're edge-on
and invisible to us. That's a hassle to try to get right in a sketch,
when you'd rather be focusing on the gaps in the rings and the
pastel colors of the cloud bands on the planet.
ALPO, the Association of Lunar
and Planetary Observers, makes templates for sketching Saturn;
but I had trouble finding any online that showed a tilt appropriate
for this month's Saturn. You can get observing materials by joining
ALPO, but sheesh! you shouldn't have to join an organization just to
get a simple sketching template. And I wanted one for my column.
Besides, the ALPO templates fill in too much detail -- they don't
really give you a chance to do your own ring sketch.
So here's an easy way to make a Saturn sketching template with GIMP.
Start with an image
You can calculate the aspect ratio you need for the planet from the
ring tilt, but why go to all that trouble? I started with an image
of Saturn I got by running
XEphem.
Call up View->Saturn, then make the window as big as you can.
Of course, you may substitute any planetarium program of your choosing,
as long as it shows Saturn with the right ring tilt.
I used GIMP's screenshot facility to open this as an image:
File->Create->Screenshot..., then
Select a region to grab.
You can also use a recent photo of Saturn. The point here is to get
something that's the right shape: it doesn't matter if it's beautiful
or large.
Fix the rotation and size
You want the rings horizontal, if they're not already. Use GIMP's Free
Rotate tool to do that. You can eyeball it to make it approximately right,
or if you want to be more accurate, use the Measure tool (the icon looks
like a drawing compass) to measure from one edge of the rings to the
other and note the angle in the status bar at the bottom of the window.
Then when you use Free Rotate, type in the number you measured.
You'll be printing this out on sketching paper, so if the original
image is small, use Image->Scale to expand it. Remember, you
won't be looking at this original image -- it's just for tracing --
so don't worry if the image comes out fuzzy after you scale it up.
I made mine about 1000 pixels wide.
Make a white background layer
Layer->New Layer... to make a new layer; check "white"
in the dialog. Then click the eyeball icon next to it in the Layers
dialog to make it invisible. You'll want it later.
Outline the planet on its own layer
Layer->New Layer... to make a new layer; this time make
it transparent, not white.
I named mine "planet", since this is where I'll draw the ellipse
for the planet. (Yes, Saturn is an ellipse, not a sphere. So is
the Earth, for that matter, but Saturn is a lot less spherical
than Earth is.)
Choose the ellipse selection tool and drag out a selection that matches
the outer edges of the planet. Use the resize handles to adjust the
selection until it fits as closely as you can manage.
In the Toolbox or the Brushes dialog, choose the smallest hard brush,
"Circle (01)".
Then Edit->Stroke Selection.... Click "Stroke with a paint
tool", and click Stroke.
Tip: You may notice my template ended up with very jaggy lines.
That's a common artifact of GIMP's Stroke Selection.
I'm not worried about it for a sketching template, but if the jaggies
bother you, you can get a much smoother line by converting the
selection to a path and stroking the path instead of the selection.
Preview your work so far
Go back to the Layers dialog and make that white layer visible again,
so you can see the outline you just made. You may want to do
Select->None and click on some tool other than ellipse
select, so the selection outline disappears and you can see the line better.
If you're not happy with your planet outline, Edit->Undo and
repeat with a different selection, a thicker line or whatever.
Outline the rings on their own layer
Repeat what you just did for the planet, this time for the rings.
I recommend using a new layer for just the rings (you'll see why in
the next step).
I outlined just the outside of the rings, so the sketch can show the
ring thickness. ALPO's templates don't do this, but how much
ring you can see can vary based on seeing conditions. If you want the
inner edge of the ring on your template, add it now.
Erase the hidden parts of the ring and planet outlines
You can't see the rings where they go behind the planet, or the part
of the planet hidden by the rings. And you don't want your template
lines spoiling your sketch in those regions. So use GIMP's eraser tool
and a large brush to erase the appropriate parts.
This is a little easier if you used separate layers for the rings and
planet: you won't have to be as careful with the eraser. But it's not
a big deal: this is a template, not a finished artwork, and you're
going to be drawing over it anyway. So don't sweat it too much.
Optionally, make the lines fainter
I made the template lines fainter using the Opacity slider in
the Layers dialog on the planet and ring layers. Of course, you can
just draw in grey in the first place, but I like being able to decide
afterward what color I want, or change it later.
Label the template
Trust me, you'll be really annoyed if you decide in 2026 that you want
to make another Saturn sketch, find your old template but can't remember
what ring tilt it's for. So use the Text tool to label either the current
date or the approximate ring tilt. Or put that information in an image
comment under Image->Image Properties..., or in the filename.
Save your template as XCF.gz, save a copy in some other format like
jpg, png or gif, and you're ready to print templates on paper.
Then go out and sketch Saturn!
Tags: astronomy, sketching, gimp
[
15:13 Jun 07, 2011
More science/astro |
permalink to this entry |
]