User avatar
cowpat
Posts: 90
Joined: Sat Apr 14, 2012 12:13 pm
Location: London
Contact: Website

DS1307 with Arduino and RPi

Wed Aug 07, 2013 9:40 pm

Hello, just after some ideas really while I mull something over....

Here's the background to my mullage; (scroll down for the fairly succinct question!)

I'm building an intervalometer for timelapse photography with infrared LEDs, I'm also logging temp and rel. humidity using the SHT75. Previously I have been using Arduino (really it's a bare 328 on my own board) and a GoPro camera to do this.

I want to try replacing the GoPro with a Raspberry Pi model A and an IR modded camera.

I only record at night, and the RPi can't sleep - so it would seem like a good idea to keep the Arduino to turn the RPi on and off.. (and probably do the data logging too - although I might just use a button logger.)

So what I have in mind is a board I can plug onto the RPi GPIO header that powers it via the header and facilitates the IR led by means of a MOSFET. Naturally there will also need to be a 328 and a RTC to schedule the RPi. However, the RPi will also need a RTC to accurately timestamp the images. (no network coverage there).

Here's the question; IF the Arduino is running at 3.3v - then presumably I can 'share' the DS1307 on the I2C bus.

However, If my daughter board is making 5v to power the RPi - the 3.3v on the GPIO port won't be there until I power the RPi - So i either need;

a) two DS1307's (seems a bit daft)
b) a 3.3v regulator in addition to the 5v reg. (more expensive)
c) level shifting to the Arduino (most elegant, but based on the assumption that it would work)


So the question is A,B or C... any thoughts or elaborating welcome.

Many thanks to anyone who has the time to consider this.


Michael.

fuffkin
Posts: 92
Joined: Thu Mar 07, 2013 10:50 pm
Location: United Kingdom
Contact: Website

Re: DS1307 with Arduino and RPi

Fri Aug 09, 2013 7:25 pm

Michael

I have a board that I think would do exactly what you're after: the Sleepy Pi.

It has an on-board RTC and Arduino with breakout area and connections, so you could control your mosfet and IR-LED. The Arduino controls the power to the RPi and this can be under the direction of the RTC. Handshake lines between the RPi and Arduino ensure an orderly shutdown.

Head over to http://spellfoundry.com for more information. We're currently doing beta testing of the board and hopefully production units shortly.

Jon
Sleepy Pi - Extend RPi battery life with a plugin Power Management & Arduino I/O board
http://www.spellfoundry.com

User avatar
cowpat
Posts: 90
Joined: Sat Apr 14, 2012 12:13 pm
Location: London
Contact: Website

Re: DS1307 with Arduino and RPi

Sun Aug 18, 2013 8:09 pm

Hi Jon,

Thanks for your reply, that looks interesting and could be more cost effective that re-inventing a wheel of my own.
I look forward to reading more documentation when it becomes available on the website, meanwhile...

Looking at your block diagram I take it you're using two regulators - driving the ATMEGA328 and the RTC at 3.3v and switching 5v to the RPi?

I assume that both the RPi and the ATMEGA328 can access the RTC on your board?

BJNZ
Posts: 11
Joined: Fri Nov 30, 2012 4:37 am

Re: DS1307 with Arduino and RPi

Mon Aug 19, 2013 10:44 am

Michael

What is the power system you are using to power the PI, mains or battery power.

If you are using mains power then I can think of simpler ways then having to have two RTC and an Arduino to do what you want.
You can put a RTC on the PI and set the PI on start up to read the time from the RTC.

I would use a mains timer to turn the power to the Pi on at night and off in the morning.
You can set the PI to shutdown safely at a specified time from the RTC.
Then the timer turns the power on again at night.

I have a PI playing videos in a museum setting and I just rely on a mains timer to turn it on and off.
In over 6 months it has only failed to reboot three times and this is without using an RTC to perform a controlled shutdown.

In your case you would need an ordered shutdown to make sure that the data is written to the memory card. You could use a USB stick for the photos and a log.

Here's an example of an RTC designed for the Pi.
https://www.modmypi.com/rasclock-raspbe ... ock-module

It looks like you can get at the I2c pins for connecting your sensor.

Just a few ideas I thought I would throw out there.

Brent

fuffkin
Posts: 92
Joined: Thu Mar 07, 2013 10:50 pm
Location: United Kingdom
Contact: Website

Re: DS1307 with Arduino and RPi

Mon Aug 19, 2013 10:59 am

Micheal,

Looking at your block diagram I take it you're using two regulators - driving the ATMEGA328 and the RTC at 3.3v and switching 5v to the RPi?

I assume that both the RPi and the ATMEGA328 can access the RTC on your board?
Yes there is a regulator powering the arduino and then a switcher powering the RaspPi. Both the Arduino and the RaspPi can access the RTC.

Brent
I would use a mains timer to turn the power to the Pi on at night and off in the morning.
You can set the PI to shutdown safely at a specified time from the RTC.
Then the timer turns the power on again at night.
That's quite a neat solution.

Jon
Sleepy Pi - Extend RPi battery life with a plugin Power Management & Arduino I/O board
http://www.spellfoundry.com

User avatar
cowpat
Posts: 90
Joined: Sat Apr 14, 2012 12:13 pm
Location: London
Contact: Website

Re: DS1307 with Arduino and RPi

Mon Aug 19, 2013 7:39 pm

I'm using lithium batteries Brent... if I had access to mains power a lot of my problems would go away!

Thanks for the update Jon. That sounds great. For now I'll try two regulators and one RTC method on the bread board- but rather than any sophisticated handshakes i'll just have the RPi shutdown earlier than the power as per Brent's suggestion. Once I've proven the point I'll have a look at the cost of your boards v doing it myself.

The data logging side of the operation currently runs 24/7... so that would need to be handled by the atmega328P, which is what it does at the moment. Alternatively it might be simpler to use a 1wire button logger (DS1923?) and download the data at the end of the survey.

Return to “Interfacing (DSI, CSI, I2C, etc.)”