Alien 13 Posted December 30, 2017 Share Posted December 30, 2017 I was wondering if anyone had tried any Astro/Camera related projects with the Microbit, for me it has some advantages for simple projects in that it has a built in display of sorts and a couple of buttons as well as being easy to power. I have been playing around with the block editor because its easy and avoids typing errors which are the bane of my life. I am trying (stumbling along realy with no programming knowledge) to produce a DSLR lightning detector to interface with the shutter release that I posted here The issues I am facing are that the block editor looks limited and I cant seem to find a way of outputting a single pules rather than a logic 1. any thoughts from the experts would be welcomed. Alan Link to comment Share on other sites More sharing options...
ringz Posted January 1, 2018 Share Posted January 1, 2018 Alan, The average duration of a lightning bolt is 0.2 seconds made up of several flashes of about 30 micro seconds each (according to wikipedia). I think you might be struggling to get things fast enough with the BBC Microbit. I know it's a big step into the dark, but have you thought of trying with an Arduino Nano 3.0? They are very cheap and have all the ports you could want. Here's a similar project using the Arduino: http://www.glacialwanderer.com/hobbyrobotics/?p=16 you could use as a stepping stone. Martyn. Link to comment Share on other sites More sharing options...
Alien 13 Posted January 1, 2018 Author Share Posted January 1, 2018 Thanks Martyn, I do have an Arduino and will most likely switch to it if I cant get any results with the Microbit, I plan to test its function by firing a flash gun to trigger the circuit and look to capture the flash in an image on the DSLR. I have also thought about having dual light sensors (differing types) so that one picks up the ambient light conditions and sets the trig level automatically but that will come later if I can get some initial results. Alan Link to comment Share on other sites More sharing options...
ringz Posted January 1, 2018 Share Posted January 1, 2018 Alan, The other technique is to set the camera shutter to stay open for, say 30 seconds, and hope you catch some flashes/multiple flashes. that would be easier with the Microbit if your camera can do B shutter speed Martyn Link to comment Share on other sites More sharing options...
Alien 13 Posted January 1, 2018 Author Share Posted January 1, 2018 1 minute ago, ringz said: Alan, The other technique is to set the camera shutter to stay open for, say 30 seconds, and hope you catch some flashes/multiple flashes. that would be easier with the Microbit if your camera can do B shutter speed Martyn Martyn, I have done this in the past and it works well if its dark but I suppose I am looking at more flexibility for other applications too, I will probably add a sound trigger at some point if it works. Alan Link to comment Share on other sites More sharing options...
Gina Posted January 1, 2018 Share Posted January 1, 2018 But the thunder always comes after the lightning! Link to comment Share on other sites More sharing options...
Alien 13 Posted January 1, 2018 Author Share Posted January 1, 2018 7 minutes ago, Gina said: But the thunder always comes after the lightning! The sound trigger would be for other stuff like bursting balloons full of water or other items with an air rifle of similar... Alan Link to comment Share on other sites More sharing options...
Gina Posted January 1, 2018 Share Posted January 1, 2018 Ah - that's different... Link to comment Share on other sites More sharing options...
ringz Posted January 3, 2018 Share Posted January 3, 2018 All this talk of lightning, I've just been woken up by intense flashings and booms of a storm. Link to comment Share on other sites More sharing options...
Alien 13 Posted January 21, 2018 Author Share Posted January 21, 2018 I have done some playing around and as predicted the Microbit triggering a DSLR shutter is too slow but has proved the functionality at least in principle. The final software program has been fun developing with me being a complete novice but it basically functions like this: At switch on the microbit will continuously read the ambient light level detected by a photo transistor and display it on its inbuilt LED display as a bar graph...when button A is pressed the same bar graph displays the trigger level currently set and reduces it with every additional press. Button B sets the output trigger pulse on time, the display indicates values between 0-10 which are multipliers of the value set in the program. Pressing buttons A+B together shows A for auto mode which sets the trigger level just above the value of the ambient light reading, the output pulse is then sent to one of the digital output pins for use with the DSLR shutter trigger circuit in mentioned earlier. This is the code used. Although it has problems I like the simple interface so might consider a dedicated high speed trigger circuit and use the microbit to display the status and trig level etc and use its analogue outputs to set the trigger sensitivity etc. Alan Link to comment Share on other sites More sharing options...
happy-kat Posted January 21, 2018 Share Posted January 21, 2018 Looks like you build it by selecting mini modules of code. Link to comment Share on other sites More sharing options...
Alien 13 Posted January 21, 2018 Author Share Posted January 21, 2018 17 minutes ago, happy-kat said: Looks like you build it by selecting mini modules of code. Thats exactly what that it does, you get the option of other coding methods to but for me as a noob it was easy to learn. I have been thinking that the microbit would make a fine semi auto intervalometer, you could program several complex sequences that included integrated mirror lock up and delays between subs related to ambient temperatures and give each sequence a title related to the setup in use, it would then be a single button press to select an option and get it rolling. Alan Link to comment Share on other sites More sharing options...
happy-kat Posted January 21, 2018 Share Posted January 21, 2018 On my old canon with CHDK there's a lightning detection script, the pre cursor to magic lantern. It would be very cool if you can get this lightning trigger to work. If I remember I'll add the script code here it might be useful. It uses the cameras built in focus zones either checking for movement or light change, great for wildlife zapping as well. Link to comment Share on other sites More sharing options...
happy-kat Posted January 21, 2018 Share Posted January 21, 2018 --[[ @title Motion Detect Plus rem Version 0.3.1 - Sept 16, 2012 rem Build 27 rem This file is a CHDK LUA script and should have the name "motionp.lua" rem by Andrew Hazelden rem email: andrewhazelden@gmail.com rem blog: www.andrewhazelden.com rem This script adds a repetitive shot mode and is rem based upon the standard "motion.lua" script rem Make sure to disable Review Mode in the Canon menus. rem Standard sensitivity threshold levels: 12=Sun 24=Cloudy 36=Dawn/Dusk rem If the camera takes photos continuously increase the rem threshold setting level for a reduced motion detection rem responsiveness. rem (a higher motion threshold number = lower responsiveness) rem Version History rem --------------- rem Version 0.3.1 rem Sept 16, 2012 rem Changed the zones variable to avoid a naming conflict. rem Added a "Number of Shots" variable that takes a burst of photos rem during a motion detection event. rem Version 0.3 rem Aug 20, 2012 rem Improved motion threshold settings rem Version 0.2 rem Created June 25, 2012 rem Added a "Motion Threshold" parameter rem Version 0.1 rem Created on Feb 26, 2012 rem Initial Release of Motion Detect Plus @param f Motion Threshold @default f 24 @range f 0 100 rem Script start delay values @param y Start Delay (min) @default y 0 @param z Start Delay (sec) @default z 3 rem default number of shots taken during a motion detection event @param w Number of Shots @default w 1 @param g Draw Grid 0=No 1=Yes @default g 1 @range g 0 1 @param a Grid Columns @param b Grid Rows @default a 3 @default b 3 @param i Region 0=No 1=In 2=Out @default i 0 @range i 0 2 rem Enabled grid cells @param j Start Column @param l End Column @param k Start Row @param m End Row @default j 0 @default k 0 @default l 0 @default m 0 --]] shots=0 -- photos taken counter -- make sure number of shots is positive if w<0 then w=1 end num_shots = w -- make sure the start column is smaller then the end column if j>l then j=l end -- make sure the start row is smaller then the end row if k>m then k=m end --make sure the region number is valid if i>2 then i=0 end -- Motion detection variables -- a=6 -- columns to split picture into -- b=6 -- rows to split picture into c=1 -- measure mode (Y,U,V R,G,B) U=0, Y=1, V=2, R=3, G=4, B=5 d=300000 -- timeout (mSec) e=200 -- comparison interval (msec) - less than 100 will slow down other CHDK functions -- f=5 -- threshold (difference in cell to trigger detection) -- g=1 -- draw grid (0=no, 1=yes) h=0 -- not used in LUA - in uBasic is the variable that gets loaded with the number of cells with motion detected -- i=0 -- region masking mode: 0=no regions, 1=include, 2=exclude -- j=0 -- first column -- k=0 -- first row -- l=0 -- last column -- m=0 -- last row n=0 -- optional parameters (1=shoot immediate) o=2 -- pixel step p=0 -- triggering delay (msec) -- Other variables -- r=get_tick_count() -- beginning of script timer value -- Start the delay timer cls() print("Typical Motion Threshold") print("12=Sun 24=Cloudy 36=Dawn") if y>0 then print( y .. " min " .. z .. " sec to start...") else print( z .. " sec to start...") end sleep( (z*1000)+(y*1000*60) ) -- Start the motion detection loop cls() print("Starting Motion Detection") play_sound(3) --plays the self timer sound effect repeat md_zone = md_detect_motion( a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) cls() --check if the md_zone value is nil due to pausing the script if( md_zone ~= nil) then if( md_zone > 0 ) then --shoot multiple photos in a burst using (Number of Shots) if(num_shots>0) then burst = num_shots repeat shoot() cls() shots=shots+1 -- Increment the shots taken counter burst=burst-1 -- update the photo burst counter until ( burst==0 ) print(shots .. " Shots Taken" ) sleep(250) end end end until ( false ) An lua file I opened it in Wordpad. I was more thinking it might help with some thoughts on your code, not suggesting this code works as written for way older camera. When using on the camera some things were user variable like number of the focus grids used and delay to start etc. Link to comment Share on other sites More sharing options...
happy-kat Posted January 21, 2018 Share Posted January 21, 2018 This is the script used on the camera within CHDK it is much shorter --[[ @title Motion Detect @param f Trigger Threshold @default f 25 @param p Trigger Delay (mSec) @default p 500 ]] a=6 -- columns to split picture into b=6 -- rows to split picture into c=1 -- measure mode (Y,U,V R,G,B) – U=0, Y=1, V=2, R=3, G=4, B=5 d=300000 -- timeout (mSec) e=200 -- comparison interval (msec) - less than 100 will slow down other CHDK functions g=1 -- draw grid (0=no, 1=yes) h=0 -- not used in LUA - in uBasic is the variable that gets loaded with the number of cells with motion detected i=0 -- region masking mode: 0=no regions, 1=include, 2=exclude j=0 -- first column k=0 -- first row l=0 -- last column m=0 -- last row n=0 -- optional parameters (1=shoot immediate) o=2 -- pixel step repeat zones = md_detect_motion( a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) if( zones > 0 ) then shoot() end until (false) Link to comment Share on other sites More sharing options...
wimvb Posted January 21, 2018 Share Posted January 21, 2018 2 hours ago, Alien 13 said: This is the code used Be careful with two infinite loops (forever), you'll never know in which order commands are executed. In your example, you should be able to put the commands of both loops in one. Link to comment Share on other sites More sharing options...
Alien 13 Posted January 21, 2018 Author Share Posted January 21, 2018 13 minutes ago, wimvb said: Be careful with two infinite loops (forever), you'll never know in which order commands are executed. In your example, you should be able to put the commands of both loops in one. Thanks I did wonder, cant you tell that this is my very first go a "writing" code Alan Link to comment Share on other sites More sharing options...
Gina Posted January 21, 2018 Share Posted January 21, 2018 Late start Good luck Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.