dogman dan said:
Well, I gave you an answer for the need you asked for,, switching to charge at 12v. Is this 12v charging happening while you ride?
If so, then what you need is not switching, but a voltage converter. or 36v charge controller, or both.
Charging will happen when i ride pedal only, like for descents and flat pedaling, like if i want to get to the next town from me, it's a 25 mile descent with about 5 miles of flat. For that section i'll be in charging mode. On the way back, most of the climb is pretty shallow across the valley, so i'd use mostly pedal power, occasionally switching to power to rest momentarily, or assist with the trailer load over short rises near bridges and culverts and then back to solar till i reach the 5 or so mile climb over about 2000' that gets me back.
Like i said, i need to switch on the fly so i can turn on pedal assist momentarily when needed for climbing and then going back to pedal and charging for flat pedaling and long(10-50 mile) descents.
Amberwolf, do you already have midi gear? From there it's basically just controlling the channels using a small python script utilizing the CV2 computer vision and PyGame libraries. Do you do python already? If so this should be simple, import your libs, initialize the camera, make a main loop, and with in it just capture a camera frame, push it into a 'face and eye' HAAR cascadce,(Haar cascades are like spreadsheet graphs that contain probabilities of what a face could look like) and assign it an ROI, or region of interest. Here you can also assign a ROI for the eyes and use math to compare the rate of change of the outer roi and the two inner eye roi to figure parallax which gives you depth from a 2d camera. The rest of the routine is easier than depth, just take the variable that contains the top left corner of the ROI value and add the ROI x and y size values divided by 2 to the ROI corner value and feed this variable to a midi channel or as a virtual joystick and calibrate the values as needed.
Google "python face detection tutorial" and check out the code examples and such, it's really basic beginner level code to do the whole loop, you can even copy and paste most of it. Beyond that, it's not too much harder to just use what's there by using the data from the variables that the ROI uses to control things. Just choose a variable like X axis pixel position, do whatever conversion math is needed (convert pixels to inches of screen, or multiply by some factor to adjust sensitivity), store the result in a new variable, and use that variable as a level for a midi channel or an analog joystick position (which most midi/synth software will accept as a channel). To get a faster response, lower the resolution of the camera, it doesn't affect accuracy but it sure does speed it up. That's how i get it to run Fallout 3 on Linux while simultaneously running my webcam capture and a joystick hardware emulator, on an obsolete laptop.
Also, if you want to do stuff like this, use linux. Forget windows, when i try to do these kinds of things in win the API chokes and it just goes into the usual windows kernel panic. Linux can handle the multithreading better and manage instructions properly.