Main Restorations Software Audio/Jukebox/MP3 Everything Else Buy/Sell/Trade
Project Announcements Monitor/Video GroovyMAME Merit/JVL Touchscreen Meet Up Retail Vendors
Driving & Racing Woodworking Software Support Forums Consoles Project Arcade Reviews
Automated Projects Artwork Frontend Support Forums Pinball Forum Discussion Old Boards
Raspberry Pi & Dev Board controls.dat Linux Miscellaneous Arcade Wiki Discussion Old Archives
Site News

Unread posts | New Replies | Recent posts | Rules | Chatroom | Wiki | File Repository | RSS | Submit news


  

Author Topic: 1 button turn on bartop  (Read 805 times)

0 Members and 1 Guest are viewing this topic.

chito

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 169
    • forum.arcadecontrols.com/index.php/topic,151843.0.html
1 button turn on bartop
« on: June 21, 2017, 10:57:55 pm »
I'm creating a Bartop power by a Raspberry pi. I'm trying to find a solution where 1 momentary button powers on not just the Pi but the whole cab. Not sure if anyone has a better solution or could help me improve this one.

here is a schematic so far of what I think might work. You can view and edit a public version here



the Cab is powered by 12V DC which, when plugged in, will straight away power on the LCD. Not sure if it auto turns on or off with the pi as in the past some driver boards stay need manual power on and off. If it doesn't ill need to wire it to the relay. I left the screen at a friends workshop which is far far away a can test it lol.

There is a 5V step-down that will connect to a Mausberry Circuit. This circuit is customized (was originally going to be used on another project) to have pin outs instead of a male micro USB output. the pins will connect to GPIO 2 and 6. I've got to double check but I'm sure the Mausberry circuit has protection for over voltage and current spikes. if it doesn't ill get the normal version of the circuit since the PI has it built in on the micro usb power in port.

once the RPi has power it will supply 5V to the Amp for the speakers and power a 5V relay, which will supply 12V to the LED strip in the marquee.

Can anyone shed some ligtht on this, has this been done better? have i missed something?

chito

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 169
    • forum.arcadecontrols.com/index.php/topic,151843.0.html
Re: 1 button turn on bartop
« Reply #1 on: June 22, 2017, 02:10:00 am »
I've just realised I could potentially get rid of the relay if I used a 5V LED strip that is powered via USB. My bartop is a single player with 2nd player via USB so I don't need all the USB ports. I could even power the Fan and speakers this way as well.

There are On/Off solutions out there where powering the Pi while leaving it plugged in will still power the GPIOs so fans and lights powered this way will stay on even if the Pi is off. USB don't stay powered so they would shut off. Mausberry circuit cuts power to the pi when it's off. So in this case powering LEDs and fans via USB or GPIOs makes no difference. but at least I might be able to get rid of the relay. I'm hoping the LCD won't need it
« Last Edit: June 22, 2017, 02:41:56 am by chito »

ark_ader

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 5344
  • Present for you Grandfather...
Re: 1 button turn on bartop
« Reply #2 on: June 22, 2017, 10:08:38 am »
Any reason why you need to turn off the pi?

All mine run around the clock on battery.  Linux does not like being flipped on and off.  I would have thought by now somebody would have figured that part out already?  Besides the pi sips juice..... :dunno

https://www.jeffgeerling.com/blogs/jeff-geerling/raspberry-pi-zero-conserve-energy
« Last Edit: June 22, 2017, 10:10:36 am by ark_ader »
"I really do feel pity for those who go out of their way to perform a personal slight, than taking the effort in joining the conversation and creating some useful dialogue which would benefit the persons' perusal of this topic.  Yet where would we be without the persistant antagonist?"

chito

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 169
    • forum.arcadecontrols.com/index.php/topic,151843.0.html
Re: 1 button turn on bartop
« Reply #3 on: June 22, 2017, 11:12:31 am »
Good point, If I were running it all from a hard drive (not sure if this affects SSD hard drive) this is not a bad idea, but being constantly on will shorten the life span of the SD card

Quote
every electronics degrades while it ages, if connected on some power source. The "problem" lies in electronic characteristics itself. One of the phenomena is called electromigration, where IC (actually whole PCB) degrades under various "nonideal" (i.e. working) conditions: current, time, temperature (which is also consequently caused by resistance properties, when device/IC is attached to power source), etc.

But... those degradations will probably not be felt for the time of your life.

What can be critical is flash memory in SD card. Every read/write cycle will slightly kill cells and you can't do nothing about it. Regarding the endurance (Sandisk SD specs, 1.8 ) :
Quote
SanDisk SD cards have an endurance specification for each sector of 100,000 writes typical (reading a logical sector is unlimited). This far exceeds what is typically required in almost all SD Card applications. Therefore, extremely heavy use of the card in cellular phones, personal communicators, pagers and voice recorders will use only a fraction of the total endurance over the device’s lifetime. For instance—it would take over 10 years to wear out an area on an SD Card based on a file of any size (from 512 bytes to maximum capacity) being rewritten 3 times per hour, 8 hours a day, 365 days per year. With typical applications, the endurance limit is not of any practical concern to the vast majority of users.

But...

If you sudo shutdown the system, the SD will unmount and no I/O activity will be on the SDI line (at least in theory).
https://raspberrypi.stackexchange.com/questions/10168/should-i-leave-the-raspberry-pi-plugged-in-after-shutdown


So if you need to shut it down, what's the point in leaving the power plugged in? you could but the mausberry cuts power anyway. Additionally, I want the marquee, fan and speakers to turn on only when it's in use.

nitrogen_widget

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 759
  • I want to build my own arcade controls!
Re: 1 button turn on bartop
« Reply #4 on: June 23, 2017, 10:05:18 am »
I use one of these for my RPI hot tub controller.
http://www.ebay.com/itm/8-Channel-5V-Relay-Shield-Module-Board-Optocoupler-module-for-Arduino-ARM-AVR-CN-/122258091422?hash=item1c77266d9e:g:rOQAAOSwnHZYR6oA


I have webiopi installed on it and can configure it to trigger all relays low or high depending on how the relay board is triggered if I want.

If you get a big enough relay and secondary power supply you could trigger a power strip to turn on when you power up the pie.


ark_ader

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 5344
  • Present for you Grandfather...
Re: 1 button turn on bartop
« Reply #5 on: June 23, 2017, 03:35:51 pm »
Good point, If I were running it all from a hard drive (not sure if this affects SSD hard drive) this is not a bad idea, but being constantly on will shorten the life span of the SD card

Quote
every electronics degrades while it ages, if connected on some power source. The "problem" lies in electronic characteristics itself. One of the phenomena is called electromigration, where IC (actually whole PCB) degrades under various "nonideal" (i.e. working) conditions: current, time, temperature (which is also consequently caused by resistance properties, when device/IC is attached to power source), etc.

But... those degradations will probably not be felt for the time of your life.

What can be critical is flash memory in SD card. Every read/write cycle will slightly kill cells and you can't do nothing about it. Regarding the endurance (Sandisk SD specs, 1.8 ) :
Quote
SanDisk SD cards have an endurance specification for each sector of 100,000 writes typical (reading a logical sector is unlimited). This far exceeds what is typically required in almost all SD Card applications. Therefore, extremely heavy use of the card in cellular phones, personal communicators, pagers and voice recorders will use only a fraction of the total endurance over the device’s lifetime. For instance—it would take over 10 years to wear out an area on an SD Card based on a file of any size (from 512 bytes to maximum capacity) being rewritten 3 times per hour, 8 hours a day, 365 days per year. With typical applications, the endurance limit is not of any practical concern to the vast majority of users.

But...

If you sudo shutdown the system, the SD will unmount and no I/O activity will be on the SDI line (at least in theory).
https://raspberrypi.stackexchange.com/questions/10168/should-i-leave-the-raspberry-pi-plugged-in-after-shutdown


So if you need to shut it down, what's the point in leaving the power plugged in? you could but the mausberry cuts power anyway. Additionally, I want the marquee, fan and speakers to turn on only when it's in use.

No you miss the point entirely,  Leaving the pi on will lengthen the SD card life.  Turning it on and off shortens the SD card as there are more chances for the card to be corrupted.  Your circuit does not automatically employ a shutdown sequence.  Reducing writes will not only lengthen your pi's SD card but you can have an "always on" arcade system that has no boot time.

You can have the Pi perform other tasks like a file server or a media center.  There was a reason why the developers of the Pi did not add a power off module.  It is not practical.  You might not follow this advice but it is here for the others reading with the same dilemma. 

I have retropie, and when it is not playing my arcade games, it provides a time machine service for all my Macs, a SMB for the media player in another room, a test web server.  All with no performance hits. Keeping it on while sipping power is just brilliant.  It is making my 2012 server obsolete.  ;D  Your external power issue?  Have two switches.  Simples.

http://www.makeuseof.com/tag/extend-life-raspberry-pis-sd-card/
"I really do feel pity for those who go out of their way to perform a personal slight, than taking the effort in joining the conversation and creating some useful dialogue which would benefit the persons' perusal of this topic.  Yet where would we be without the persistant antagonist?"

chito

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 169
    • forum.arcadecontrols.com/index.php/topic,151843.0.html
Re: 1 button turn on bartop
« Reply #6 on: June 23, 2017, 09:23:49 pm »
Your circuit does not automatically employ a shutdown sequence.
The Mausberry circuit initiates the showdown and startup using 2 gpios to do so. it will also cut and supply power to the RPi .

I don't see how leaving the RPi on will lengthen the life of the SD, Is the chance of corruption that hight? sure it won't run startup or shutdown sequences. but while it's off there are no read or writes to it.
Quote
If you sudo shutdown the system, the SD will unmount and no I/O activity will be on the SDI line (at least in theory).
I guess though this would depend on how much use you get from it and how long it's off for. If it's in constant use then leaving it on might be the way to go.

Reading more about the SD card endurance it seems like 5-10 years is good enough to just leave it on anyway. especially if there will be new versions of the pi and software within that time. SO the more I think about it might be okay to leave the RPi on

I just want to clarify something here, by on do you mean always powered even when the RPi is shutdown or that the RPi is always running the OS?
If you mean to keep power, there are on/off solutions that keep the RPi powered when shutdown.
either way, then only the screen and marquee need to turn off/on.

How would you handle the fan, same as the screen and marquee?
can it be regulated based on need with some script maybe?
« Last Edit: June 23, 2017, 09:31:25 pm by chito »

DaOld Man

  • Trade Count: (+4)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 4456
  • I dont get no respect.
    • Skenny's Outpost
Re: 1 button turn on bartop
« Reply #7 on: June 24, 2017, 10:16:37 am »
Interesting.
First, I need to bring to your attention that some of your schematic diagrams are off a bit. For example, the 12 to 5 VDC converter is not drawn like that. What you show is the diagram for a transformer.
Transformers do not work with straight line DC. No big deal, just my OCD showing. LOL

As for controlling the fan, if you want it to run all the time you can simply use a 12 volt one and wire it to the monitor power, as you suggested. I think I would take it off the power from the Pi anyway, no need in sucking more power from the Pi, even though Im sure it would be ok.

But you can also use one of the GPIO pins to turn the fan on and off based on Pi temperature. But if you do this you will definitely need to use a transistor to switch the fan, because the current from a GPIO output is probably not enough to power the fan safely.

Here is a short script I wrote just for that purpose:

Code: [Select]
#!/usr/bin/env python2.7
#This checks temperature on Pi and controls a fan
#KRR 05/03/2016
# All lines with a # in front are ignored by the Pi.
import os, sys, stat
import RPi.GPIO as GPIO
import time

#set path
mypath= os.path.dirname(os.path.abspath(__file__))
if not mypath.endswith('/'):
 mypath= mypath +'/'
 
#Pin that the fan is attached to. (PIN # not GPIO #)
fanpin = 32

polltime = 30

#Turn fan on at degrees (C) (Must be higher than off temp)
ontemp = 41 #Enter fan on temp here, in Celcius

#Turn fan off at degrees (C) (Must be lower than on temp)
offtemp = 40 #Enter fan off temp here, in Celsius

currentemp =0.0

monitor = 'False'

junk=''

#Get settings here.
if os.path.isfile(mypath + 'fantemp_settings.txt'):
 setfile = open(mypath + 'fantemp_settings.txt')
 for line in setfile:
  if line[0:1] == '#': continue
  #print line.rstrip() #use for troubleshooting
  if line[0:7].lower()== 'fanpin=':
   fanpin=int(line[8:].strip())
   continue
  if line[0:12].lower()== 'update time=':
   polltime=int(line[13:].strip())
   continue
  if line[0:7].lower()== 'ontemp=':
   ontemp=int(line[8:].strip())
   continue
  if line[0:8].lower()== 'offtemp=':
   offtemp=int(line[9:].strip())
   continue
 setfile.close 
else:
  #If settings file dont exist, create it
  print 'Setup file not found! Creating it now, and using default settings.'
  setfile = open(mypath + 'fantemp_settings.txt', 'w')
  setfile.write('# FanTemp by Ken Rager 11/17/2016\n')
  setfile.write('\n')
  setfile.write('# This is the settings file for FanTemp.\n' )
  setfile.write('\n')
  setfile.write('# All lines beginning with # are for info only, they are ignored by the program.\n')
  setfile.write('\n')
  setfile.write('# The GPIO pin that the fan connects to. This is pin number and not\n')
  setfile.write('# GPIO number. Pins number from 1-40. Default pin number is 32.\n')
  setfile.write('\n')
  setfile.write('fanpin= 32\n')
  setfile.write('\n')
  setfile.write('# You can set how often FanTemp checks temperature.\n')
  setfile.write('# This is number of seconds to do an update.\n')
  setfile.write('# You can update 1 to 60 seconds. A small number may cause CPU to\n')
  setfile.write('# to work harder. A larger number may allow CPU to heat up more\n')
  setfile.write('# before the fan is turned on. Experiment until you get the right\n')
  setfile.write('# value. 30 is the default, and a good number to start out with.\n')
  setfile.write('\n')
  setfile.write('update time= 30\n')
  setfile.write('\n')
  setfile.write('# You can set the temperture the fan turns on. Degrees in Celius. 20-75. default is 41\n')
  setfile.write('\n')
  setfile.write('ontemp= 41\n')
  setfile.write('\n')
  setfile.write('# You can set the temperture the fan turns off. Degrees in Celius. 20-75. default is 40.\n')
  setfile.write('# Note: offtemp must be lower than ontemp. If not, program will set it one degree lower.\n')
  setfile.write('\n')
  setfile.write('offtemp= 40\n')
  setfile.write('\n')
  setfile.write('# Change the values above to what you desire, then save this settings file.\n')
  setfile.write('# You must restart FanTemp after saving this file.\n')
  setfile.write('# You can run FanTemp in monitor mode to see how it is working.\n')
  setfile.write('# In the terminal prompt, type python fantemp.py monitor\n')
  setfile.write('# That will print out to the screen to allow you to see what is going on.\n')
  setfile.close 
  # change mode of settings file so anyone can read or write to it.
  os.chmod("fantemp_settings.txt", stat.S_IRWXO)

# Check for proper values.
if fanpin < 1 or fanpin > 40: fanpin=32
if polltime < 1 or polltime > 60: polltime = 30
if ontemp < 20 or ontemp > 75: ontemp = 41
if offtemp < 20 or offtemp > 75: offtemp = 40
if offtemp >= ontemp: offtemp = ontemp -1

 
GPIO.setmode(GPIO.BOARD) #This allows me to access the I/O by pin numbers not GPIO ID
GPIO.setwarnings (False)

# Set output
GPIO.setup(fanpin, GPIO.OUT) #Fan control: True= on False= off

#Turn fan on for at startup
GPIO.output(fanpin,True);

def getCPUtemperature():
    #Gets CPU temperature, and cleans up the degrees C at end.
    res = os.popen('vcgencmd measure_temp').readline()
    return(res.replace("temp=","").replace("'C\n",""))
currentemp = float(getCPUtemperature())

def monitormode():
  print '\n Monitor mode! Press CTRL + C to exit'
  print ' GPIO pin that fan circuit is attached to: ' + str(fanpin)
  print ' Sample time = ' + str(polltime) + ' seconds.'
  print ' Temperture to turn fan on: ' + str(ontemp)
  print ' Temperture to turn fan off: ' + str(offtemp)
  #print ' Ontemp = ' + str(ontemp) + '   offtemp= ' + str(offtemp)
  print ' Current temp is ' + str(currentemp)
  if GPIO.input(fanpin):
    print ' fan is on'
  else:
    print ' fan is off' 
  print '  ******'

if sys.argv[1:]== ['monitor']:
  monitor= True
  print '\n  Fantemp by Ken Rager  2016'
 
while True:
  currentemp = float(getCPUtemperature())
  if currentemp <= offtemp: GPIO.output(fanpin,False); # CPU temp is  less than or equal to offtemp so turn fan off. DO NOT COMMENT OUT OR DELETE THIS LINE!
  if currentemp >= ontemp: GPIO.output(fanpin,True); # CPU temp is equal to or higher than ontemp so turn fan on. DO NOT COMMENT OUT OR DELETE THIS LINE!
  if monitor== True: monitormode()
  time.sleep(polltime) # pause time before checking temp

Good luck with your project, I will be checking in to see how its going.

chito

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 169
    • forum.arcadecontrols.com/index.php/topic,151843.0.html
Re: 1 button turn on bartop
« Reply #8 on: June 24, 2017, 09:14:58 pm »
Thanks for your help. That script is sure to come in handy!

yeah, there are many things wrong with the diagram lol (accidentally used pin 8, should've been 6). I was just learning to use that free site and I've just worked out how to added custom components, i made it quickly just to get the concept across. Alos I didn't know what symbol to use lol. I know what a converter symbol (digital/analog, AC/DC) looks like but I don't know what DC voltage converter looks like so I used a step-down transformer.

I'm using a small fan 25mm/30mm directly on the RPi heat sink which is rated at 5v 0.2a... I think that should be ok as the fan is designed for the RPi. I've other builds that use 120mm USB powered (5v) fans

morton

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 169
  • I want to build my own arcade controls!
Re: 1 button turn on bartop
« Reply #9 on: July 07, 2017, 12:23:33 pm »
This all seems so complex. If you run a small PC power supply, you're often provided with more than enough amps, connections for 5 and 12v so you got your Pi, audio amps and cabinet lighting tied to one source. If you LCD uses 12v, then get a PSU that delivers big amps on that 12v line... Your whole cab/bartop powered and you shutdown pi with a momentary button and script. Then switch off main PSU.

If you wanna control individual things like monitor and lights and leave Pi on, you can likely just place a switch inline and place it on a back panel or in service door.

The Mausberry is cool if you don't have much space, but given the limitation of 5v and no 12v, it would seem more flexible and practical to use a low priced computer PSU dollar for dollar (Mausberry+Pi PSU vs CPU PSU) IMO.

Then you don't spend hours beating your head against a post.

barrymossel

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 66
  • RetroPie all the way!
Re: 1 button turn on bartop
« Reply #10 on: July 07, 2017, 01:14:59 pm »
This all seems so complex. If you run a small PC power supply, you're often provided with more than enough amps, connections for 5 and 12v so you got your Pi, audio amps and cabinet lighting tied to one source. If you LCD uses 12v, then get a PSU that delivers big amps on that 12v line... Your whole cab/bartop powered and you shutdown pi with a momentary button and script. Then switch off main PSU.

If you wanna control individual things like monitor and lights and leave Pi on, you can likely just place a switch inline and place it on a back panel or in service door.

The Mausberry is cool if you don't have much space, but given the limitation of 5v and no 12v, it would seem more flexible and practical to use a low priced computer PSU dollar for dollar (Mausberry+Pi PSU vs CPU PSU) IMO.

Then you don't spend hours beating your head against a post.
But then you would have to press two buttonssssssss. And you will have to wait in between. First world problems... :)

morton

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 169
  • I want to build my own arcade controls!
Re: 1 button turn on bartop
« Reply #11 on: July 07, 2017, 05:43:48 pm »
This all seems so complex. If you run a small PC power supply, you're often provided with more than enough amps, connections for 5 and 12v so you got your Pi, audio amps and cabinet lighting tied to one source. If you LCD uses 12v, then get a PSU that delivers big amps on that 12v line... Your whole cab/bartop powered and you shutdown pi with a momentary button and script. Then switch off main PSU.

If you wanna control individual things like monitor and lights and leave Pi on, you can likely just place a switch inline and place it on a back panel or in service door.

The Mausberry is cool if you don't have much space, but given the limitation of 5v and no 12v, it would seem more flexible and practical to use a low priced computer PSU dollar for dollar (Mausberry+Pi PSU vs CPU PSU) IMO.

Then you don't spend hours beating your head against a post.
But then you would have to press two buttonssssssss. And you will have to wait in between. First world problems... :)

... just like a sticky S key?  :dunno

chito

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 169
    • forum.arcadecontrols.com/index.php/topic,151843.0.html
Re: 1 button turn on bartop
« Reply #12 on: July 08, 2017, 02:19:33 am »
ideally, I would have everything work off one button. and maybe a 2nd of the when I need to power off the bartop to move it.

a pc power block is a great solution for most builds. that exactly what I'm using for another build. but the bartop this is going into is really streamlined and there's not enough room for it. it's tight enough with the pi with a fan and a soundcard. I had to get creative with how I was going to mount it

« Last Edit: July 12, 2017, 10:05:12 pm by chito »

barrymossel

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 66
  • RetroPie all the way!
Re: 1 button turn on bartop
« Reply #13 on: July 08, 2017, 02:54:58 am »
ideally i would have everything work off one button. and maybe a 2nd of the when i need to power off the bartop to move it.

a pc powet pack is a great solution for most builds. that exactly what im using for another build. but the bartop this is going into is really streamlined and theres not enough room for it. ill post pics of the inside when i get the chance. but its tight enough with the pi with a fan and a soundcard. i had to get creative with how i was going to mount it
I guess I would go for a common power supply (like a computer power supply - to power anything but the RPi) which gets turned on and off by a relay, which is switched by the 5v from the Raspberry Pi. The RPi in its turn will turn on and off with a Mausberry of PowerBlock.

  
 

Sitemap 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31