Sunrise and sunset camera controller

ahull
Sat Jun 27, 2015 11:26 pm
In order to give me some incentive to play with the low power modes, I’ve re-written the sketch originally used here

Image

The code is on Github here…

I’ll keep everyone posted with progress.


ahull
Sun Jun 28, 2015 8:20 pm
I updated the (messy) code, and it works (for small values of the variable “works” :D ).

Image

Things that *don’t* yet work…

Sleeping till sunrise/sunset.
Setting the time/date/location using the touchscreen.
Switching something on at sunrise/sunset.

However its a start, and the sunrise/sunset times appear to agree with Google’s thoughts on the subject, within one minute, so not a bad start.


Rick Kimball
Sun Jun 28, 2015 10:13 pm
ahull wrote:[img]…[/img]

ahull
Sun Jun 28, 2015 10:31 pm
Rick Kimball wrote:ahull wrote:[img]…[/img]

ahull
Mon Jun 29, 2015 4:06 pm
I changed the display a bit, no good reason, I just wanted to play with the GFX library.

Image


ahull
Sun Jul 05, 2015 11:25 am
Well sunrise and sunset was too easy, I think I’ll add moon rise and moon set and moon phase next, since my 3V relay module hasn’t arrived on the slow boat yet, so I can’t actually build the camera battery control circuit yet.

Watch this space for further enlightenment. :D

For the record, the camera battery is going to be controlled with one of these… I was going to use a transistor and a 3V relay with a diode, but the pre-built board is around the same price as the components, and looks much neater (and has on opto-coupler thrown in for free).


ahull
Tue Jul 28, 2015 9:22 pm
Slow boat arrived, and with it 2 x 3v relay boards…. I also got my first bug report from a hackaday.io user, who pointed out that using an int for localOffset doesn’t work in India where the offset may include a half hour. Github code updated localOffset is now a float.

Now all I need is a bit of spare time to code the sleep and wake on alarm interrupt routines and play with the relay. I think I’ll use the “Ugly board” for the finished project.


RogerClark
Tue Jul 28, 2015 10:20 pm
The half hour offset will also be needed in South Australia ;-)
(Seems crazy to me that some places have this.. In fact i heard on the radio the other day that some people want to put South Australia on the same time zone as Sydney and Melbourne, but i doubt it will happen)

Oscar43
Thu Oct 08, 2015 8:54 am
Awesome effects!! I am so pleased to know how we can use sunrise and sunset effects just as professionals. I have so much interest in photography so I am thinking to get training from the Port Macquarie Photographer.

ahull
Thu Oct 08, 2015 11:08 am
Oscar43 wrote:Awesome effects!! I am so pleased to know how we can use sunrise and sunset effects just as professionals. I have so much interest in photography so I am thinking to get training from the Port Macquarie Photographer.

martinayotte
Thu Oct 08, 2015 2:19 pm
@Any, your image links are broken again … :(

ahull
Thu Oct 08, 2015 7:29 pm
martinayotte wrote:@Any, your image links are broken again … :(

ahull
Thu Oct 08, 2015 10:11 pm
Or perhaps this one.
Image

zmemw16
Thu Oct 08, 2015 10:41 pm
8:30 static, image moved when ‘view image’d in iceweasel/linux

nice arc of lights center and high-lighted tower/saturn 5 to right:-)

11:00 static either way, nice green though

now i actually know what big dipper looks like

your dog is moving though:-)

stephen


Oscar43
Fri Oct 09, 2015 5:24 am
Ohh its great and clips are amazing, I will surely click nature inspired images after my training.

ahull
Sat Oct 17, 2015 10:38 pm
Ooops… I broke it.. :( (and fixed it too :D ).

It seems that I have a near infinite capacity from breaking these little boards. I cant even blame electrical interference from the Aurora as it hasn’t shown up tonight. I was attempting to play with low power mode, and alarms as part of my research for this project. To cut a long story short I flashed my latest masterpiece to the board and apparently killed it stone dead. Either the USB would fail to connect as if the board was toast, or dmesg would show it had done *something* with…. usb 1-1-port2: unable to enumerate USB device , but would claim the board had zero K of flash… when I attempted to program it… not good.

Even attempting to flash with the reset button down failed to get the thing out of sulk mode, so I resorted to the big guns.

The big gun in question of course being openocd, the sonic screwdriver of the microcontroller world. Since I managed to revive the pesky little bleeder I thought I would share my work flow.

First of all you will need openocd and an ST-Link V2 device (genuine or clone).

Next I recommend you read my Wiki article here…

Work your way through to the point where you connect with telnet localhost 4444

Next hold down the RESET button on the board and with it held down, issue a

> reset halt

The board will probably not actually halt at this point, until you release the reset button.
If all goes well you will see..

target state: halted
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x08000c60 msp: 0x20005000

These numbers may be slightly different on different processors.

Now we need to try to erase the existing garbage in the flash and replace it with something that works.

Fire up the arduino IDE and compile something for the board that you know will work (a blink sketch or whatever). I used the 6502 emulator because I had that open in a different window.

Look in the IDE compiler window for the objcopy line near the end, something like this..

……arm-none-eabi-objcopy -O binary /tmp/build8185549224902354832.tmp/arduino_6502.cpp.elf /tmp/build8185549224902354832.tmp/arduino_6502.cpp.bin

.. there you will see the temporary .bin file created by the compiler. This is what we need to flash to the STM32F103 as a test.
Next, in the openocd window type in the instruction to flash this file to the device.

> flash write_image erase /tmp/build8185549224902354832.tmp/arduino_6502.cpp.bin 0x08000000

This will auto erase the flash (even , it seems despite the board claiming it had none) and should put your compiled sketch on the device at 0x08000000

You should see something like..

wrote 29696 bytes from file /tmp/build8185549224902354832.tmp/arduino_6502.cpp.bin in 1.674014s (17.324 KiB/s)

If so, the thing is back in the land of the living (sans bootloader of course). Now restart it.

> reset run

.. and it should re-enumerate on the USB bus. If it doesn’t appear within a few seconds, power it off and back on. Hopefully at this point, your board will be none the worse for its ordeal. :D


darth_llamah
Sat Nov 28, 2015 10:05 pm
Congrats ahull, you got featured on Hackaday.com :)

ahull
Sat Nov 28, 2015 10:15 pm
I got an email the other day to say they were going to feature one of my projects, I thought it would be the recent one… https://hackaday.io/project/8485-magic- … ttery-pack turns out I was wrong. :D

RogerClark
Sun Nov 29, 2015 12:58 am
Hi Andy,

I noticed your name on Hackaday as I’m on their mailing list, but I realised it was not your STM32 camera timer :-(
Which is a shame…


ahull
Sun Nov 29, 2015 1:20 am
RogerClark wrote:Hi Andy,

I noticed your name on Hackaday as I’m on their mailing list, but I realised it was not your STM32 camera timer :-(
Which is a shame…


RogerClark
Sun Nov 29, 2015 7:11 am
Cool

Thanks Andy.

I wonder if we will get in influx of new STM32 users ;-)


ahull
Sun Nov 29, 2015 11:29 am
RogerClark wrote:Cool

Thanks Andy.

I wonder if we will get in influx of new STM32 users ;-)


zmemw16
Sun Nov 29, 2015 2:40 pm
@ahull
I did post a comment to that effect, and linked back to here in the comments, but my comment has not been approved yet. maybe they are have all gone home at HAD towers. If you look closely at the picture, you will see it is an STM board (one of these), not a pro mini. I also have the software running on a BluePill from which I have removed the power LED to save a few mA.

couldn’t see enough in first picture, second – you just made my day, really messed up pinouts though

stephen


ahull
Sun Nov 29, 2015 2:49 pm
zmemw16 wrote:@ahull
… couldn’t see enough in first picture, second – you just made my day, really messed up pinouts though
stephen

RogerClark
Sun Nov 29, 2015 6:53 pm
Hi Andy

An Esp8266 based version would be useful, and possibly a BLE version would be interesting.


zmemw16
Sun Dec 06, 2015 1:34 am
andy,
you might want to look at Linux Journal this months issue. p34

article on bird cam, some interesting bits

stephen


ahull
Sun Dec 06, 2015 11:52 am
zmemw16 wrote:andy,
you might want to look at Linux Journal this months issue. p34

article on bird cam, some interesting bits

stephen


ahull
Sun Dec 06, 2015 2:17 pm
Here’s the view from one of the locations I hope to place a sunrise camera… Its a little wet round here are the moment as you can see. Those lakes are new.

Image

Normally this is open countryside, green from here to the horizon.
HINT: Right click>View Image> Zoom in for more detail.


zmemw16
Sun Dec 06, 2015 2:26 pm
andy,
i assume the male is purple in some way :D

best birds, a blue jay when way younger and in 2011 a buzzard telegraph pole hopping (6 of them honestly) as i pedalled along
a lane in Wales, couple of seagulls having a go at a buzzard until it banked and dropped its talons down.

those eggs are a really nice shade of blue. my mother was a painter, all types and knew colours.
me, just straight lines, vertical, horizontal, hence the mech eng bsc; but i do wish i could draw/sketch.

what flagged the article was the polar tilt and sunrise/sunset aspects

stephen


ahull
Sun Dec 06, 2015 10:42 pm
zmemw16 wrote:andy,
i assume the male is purple in some way :D

martinayotte
Sun Dec 06, 2015 11:21 pm
Wow ! Nice picture !

ahull
Sun Dec 06, 2015 11:43 pm
martinayotte wrote:Wow ! Nice picture !

martinayotte
Mon Dec 07, 2015 12:00 am
Ah Ah ! so, you are not only carry a camera with you, but also some bags of friandises … :D

ahull
Mon Dec 07, 2015 12:03 am
martinayotte wrote:Ah Ah ! so, you are not only carry a camera with you, but also some bags of friandises … :D

Leave a Reply

Your email address will not be published. Required fields are marked *