Mercedes AMG Power Wheeler: Difference between revisions

From B-Wiki
Jump to navigation Jump to search
 
(4 intermediate revisions by the same user not shown)
Line 4: Line 4:


{{Component| URUAV 550 12V Electric Reducer Gear Case with Motor for Kids Children Ride On Car}}
{{Component| URUAV 550 12V Electric Reducer Gear Case with Motor for Kids Children Ride On Car}}
* https://www.thingiverse.com/thing:3001523


* Current consumtion nominal: 2A
* Current consumtion nominal: 2A
Line 19: Line 21:
[[File:Tacho-wave.png|thumb|Downloaded from banggood|center]]
[[File:Tacho-wave.png|thumb|Downloaded from banggood|center]]


=== Code ===
=== Code new ===
-- relay 1 input
-- relay 1 input
gpio.mode(6, gpio.INPUT, gpio.PULLUP )
  gpio.mode(6, gpio.INPUT, gpio.PULLUP )
-- relay 2 input
  -- relay 2 input
gpio.mode(7, gpio.INPUT, gpio.PULLUP )
  gpio.mode(7, gpio.INPUT, gpio.PULLUP )
-- power switch control output
  -- power switch control output
gpio.mode(1, gpio.OUTPUT )
  gpio.mode(5, gpio.OUTPUT )
-- relay 1 ouput
  -- relay 1 ouput
gpio.mode(2, gpio.OUTPUT )
  gpio.mode(2, gpio.OUTPUT )
-- relay 2 ouput
  -- relay 2 ouput
gpio.mode(5, gpio.OUTPUT )
  gpio.mode(1, gpio.OUTPUT )
 
  relay1 = 0
  relay2 = 0
 
  function toggle_output_pwm()
      gpio.write(1, gpio.HIGH)
      tmr.delay(10000)
      gpio.write(1, gpio.LOW)
  end
 
  function deactivate_pwm_output()
      gpio.write(5, gpio.LOW)
      tmr.delay(10000)
  end
 
  function activate_pwm_output()
      gpio.write(5, gpio.HIGH)
      tmr.delay(10000)
  end
 
  function on_success_callback()
      val = adc.read(0)
      if val < 10 then
              print("System voltage low (mV):", val)
      else
              print("System voltage high (mv):", val)
      end
  end
 
  function check_relay1_input()
      relay1_input = gpio.read(6) -- gpio12
      relay2_input = gpio.read(7) -- gpio13
      print("Status relay 1:", relay1_input)
      print("Status relay 2:", relay2_input)
      if relay1_input == 0 then
          -- trigger output low
          if relay1 == 0 then
              deactivate_pwm_output()
          end 
          -- activate relay 1
          relay1 = 1
          gpio.write(2, gpio.HIGH)
          activate_pwm_output()
      elseif relay2_input == 0 then
          -- trigger output low
          if relay2 == 0 then
              deactivate_pwm_output()
          end
          -- activate relay 1
          relay2 = 1
          gpio.write(5, gpio.HIGH)
          activate_pwm_output()
      else
          -- trigger output low
          print("Deactivate outputs")
          deactivate_pwm_output()
          -- activate relay 1
          relay1 = 0
          relay2 = 0
          gpio.write(2, gpio.LOW)
          gpio.write(5, gpio.LOW)
      end
  end
 
  function check_relay2_input()
 
  end
 
  -- if the output is active deactivate it
  val = adc.read(0)
  if val > 10 then
          print("Output is active:", val)
          toggle_output_pwm()
          val = adc.read(0)
          print("Output is deactivated:", val)
  end
 
  mytimer = tmr.create()
  mytimer:register(10000, tmr.ALARM_AUTO, on_success_callback)
  mytimer:interval(100) -- actually, 500 mseconds is better!
  mytimer:start()
 
  mytimer1 = tmr.create()
  mytimer1:register(10000, tmr.ALARM_AUTO, check_relay1_input)
  mytimer1:interval(100) -- actually, 500 mseconds is better!
  mytimer1:start()
 
  mytimer2 = tmr.create()
  mytimer2:register(10000, tmr.ALARM_AUTO, check_relay2_input)
  mytimer2:interval(500) -- actually, 500 mseconds is better!
  mytimer2:start()


relay1 = 0
=== Code old ===
relay2 = 0


function toggle_output_pwm()
    -- relay 1 input
    gpio.write(1, gpio.HIGH)
    gpio.mode(6, gpio.INPUT, gpio.PULLUP )
    tmr.delay(10000)
    -- relay 2 input
     gpio.write(1, gpio.LOW)
    gpio.mode(7, gpio.INPUT, gpio.PULLUP )
end
    -- power switch control output
 
    gpio.mode(1, gpio.OUTPUT )
function deactivate_pwm_output()
    -- relay 1 ouput
    gpio.mode(2, gpio.OUTPUT )
    -- relay 2 ouput
    gpio.mode(5, gpio.OUTPUT )
   
    relay1 = 0
    relay2 = 0
   
    function toggle_output_pwm()
        gpio.write(1, gpio.HIGH)
        tmr.delay(10000)
        gpio.write(1, gpio.LOW)
    end
   
    function deactivate_pwm_output()
        val = adc.read(0)
        if val > 10 then
              print("Output is active:", val)
              toggle_output_pwm()
              val = adc.read(0)
              print("Output is deactivated:", val)
        end
     end
   
    function activate_pwm_output()
        val = adc.read(0)
        if val < 10 then
              print("Output is deactivated:", val)
              toggle_output_pwm()
              val = adc.read(0)
              print("Output is activated:", val)
        end
    end
   
    function on_success_callback()
        val = adc.read(0)
        if val < 10 then
              print("System voltage low (mV):", val)
        else
              print("System voltage high (mv):", val)
        end
    end
   
    function check_relay1_input()
        relay1_input = gpio.read(6) -- gpio12
        relay2_input = gpio.read(7) -- gpio13
        print("Status relay 1:", relay1_input)
        print("Status relay 2:", relay2_input)
        if relay1_input == 0 then
            -- trigger output low
            if relay1 == 0 then
                deactivate_pwm_output()
            end 
            -- activate relay 1
            relay1 = 1
            gpio.write(2, gpio.HIGH)
            activate_pwm_output()
      elseif relay2_input == 0 then
            -- trigger output low
            if relay2 == 0 then
                deactivate_pwm_output()
            end
            -- activate relay 1
            relay2 = 1
            gpio.write(5, gpio.HIGH)
            activate_pwm_output()
      else
            -- trigger output low
            deactivate_pwm_output()
            -- activate relay 1
            relay1 = 0
            relay2 = 0
            gpio.write(2, gpio.LOW)
            gpio.write(5, gpio.LOW)
      end
    end
   
    function check_relay2_input()
   
    end
   
    -- if the output is active deactivate it
     val = adc.read(0)
     val = adc.read(0)
     if val > 10 then
     if val > 10 then
Line 48: Line 221:
           print("Output is deactivated:", val)
           print("Output is deactivated:", val)
     end
     end
end
      
 
     mytimer = tmr.create()
function activate_pwm_output()
    mytimer:register(10000, tmr.ALARM_AUTO, on_success_callback)
     val = adc.read(0)
    mytimer:interval(500) -- actually, 500 mseconds is better!
     if val < 10 then
    mytimer:start()
          print("Output is deactivated:", val)
   
          toggle_output_pwm()
    mytimer1 = tmr.create()
          val = adc.read(0)
    mytimer1:register(10000, tmr.ALARM_AUTO, check_relay1_input)
          print("Output is activated:", val)
    mytimer1:interval(500) -- actually, 500 mseconds is better!
    end
    mytimer1:start()
end
   
 
    mytimer2 = tmr.create()
function on_success_callback()
    mytimer2:register(10000, tmr.ALARM_AUTO, check_relay2_input)
    val = adc.read(0)
    mytimer2:interval(500) -- actually, 500 mseconds is better!
    if val < 10 then
    mytimer2:start()
          print("System voltage low (mV):", val)
    else
          print("System voltage high (mv):", val)
    end
end
 
function check_relay1_input()
    relay1_input = gpio.read(6) -- gpio12
    relay2_input = gpio.read(7) -- gpio13
    print("Status relay 1:", relay1_input)
    print("Status relay 2:", relay2_input)
    if relay1_input == 0 then
        -- trigger output low
        if relay1 == 0 then
            deactivate_pwm_output()
        end 
        -- activate relay 1
        relay1 = 1
        gpio.write(2, gpio.HIGH)
        activate_pwm_output()
  elseif relay2_input == 0 then
        -- trigger output low
        if relay2 == 0 then
            deactivate_pwm_output()
        end
        -- activate relay 1
        relay2 = 1
        gpio.write(5, gpio.HIGH)
        activate_pwm_output()
  else
        -- trigger output low
        deactivate_pwm_output()
        -- activate relay 1
        relay1 = 0
        relay2 = 0
        gpio.write(2, gpio.LOW)
        gpio.write(5, gpio.LOW)
  end
end
 
function check_relay2_input()
end
 
-- if the output is active deactivate it
val = adc.read(0)
if val > 10 then
      print("Output is active:", val)
      toggle_output_pwm()
      val = adc.read(0)
      print("Output is deactivated:", val)
end
 
mytimer = tmr.create()
mytimer:register(10000, tmr.ALARM_AUTO, on_success_callback)
mytimer:interval(500) -- actually, 500 mseconds is better!
mytimer:start()
 
mytimer1 = tmr.create()
mytimer1:register(10000, tmr.ALARM_AUTO, check_relay1_input)
mytimer1:interval(500) -- actually, 500 mseconds is better!
mytimer1:start()
 
mytimer2 = tmr.create()
mytimer2:register(10000, tmr.ALARM_AUTO, check_relay2_input)
mytimer2:interval(500) -- actually, 500 mseconds is better!
mytimer2:start()





Latest revision as of 11:40, 6 June 2021

Mercedes AMG Power Wheeler

https://bogza.ro/index.php/Mercedes_AMG_Power_Wheeler
Mercedes AMG Power Wheeler
Mercedes AMG Power Wheeler
Mercedes AMG Power Wheeler

Power upgrade =

  • URUAV 550 12V Electric Reducer Gear Case with Motor for Kids Children Ride On Car
    • Current consumtion nominal: 2A

    Controller upgrade

    Tachometer install

    • red - 12V
    • green signal wire 3000rpm = 6.23Hz 10V offset 5V duty 20% range = 3.9Hz - 6.7hz
    • black - gnd
    • yellow - 12v
    Downloaded from banggood

    Code new

    -- relay 1 input
      gpio.mode(6, gpio.INPUT, gpio.PULLUP )
      -- relay 2 input
      gpio.mode(7, gpio.INPUT, gpio.PULLUP )
      -- power switch control output
      gpio.mode(5, gpio.OUTPUT )
      -- relay 1 ouput
      gpio.mode(2, gpio.OUTPUT )
      -- relay 2 ouput
      gpio.mode(1, gpio.OUTPUT )
      
      relay1 = 0
      relay2 = 0
      
      function toggle_output_pwm()
          gpio.write(1, gpio.HIGH)
          tmr.delay(10000)
          gpio.write(1, gpio.LOW)
      end
      
      function deactivate_pwm_output()
          gpio.write(5, gpio.LOW)
          tmr.delay(10000)
      end
      
      function activate_pwm_output()
          gpio.write(5, gpio.HIGH)
          tmr.delay(10000)
      end
      
      function on_success_callback()
          val = adc.read(0)
          if val < 10 then
                 print("System voltage low (mV):", val)
          else
                 print("System voltage high (mv):", val)
          end
      end
      
      function check_relay1_input()
          relay1_input = gpio.read(6) -- gpio12
          relay2_input = gpio.read(7) -- gpio13
          print("Status relay 1:", relay1_input)
          print("Status relay 2:", relay2_input)
          if relay1_input == 0 then
              -- trigger output low
              if relay1 == 0 then
                  deactivate_pwm_output()
              end   
              -- activate relay 1
              relay1 = 1
              gpio.write(2, gpio.HIGH)
              activate_pwm_output()
         elseif relay2_input == 0 then
              -- trigger output low
              if relay2 == 0 then
                  deactivate_pwm_output()
              end
              -- activate relay 1
              relay2 = 1
              gpio.write(5, gpio.HIGH)
              activate_pwm_output()
         else
              -- trigger output low
              print("Deactivate outputs")
              deactivate_pwm_output()
              -- activate relay 1
              relay1 = 0
              relay2 = 0
              gpio.write(2, gpio.LOW)
              gpio.write(5, gpio.LOW)
         end
      end
      
      function check_relay2_input()
      
      end
      
      -- if the output is active deactivate it
      val = adc.read(0)
      if val > 10 then
             print("Output is active:", val)
             toggle_output_pwm()
             val = adc.read(0)
             print("Output is deactivated:", val)
      end
      
      mytimer = tmr.create()
      mytimer:register(10000, tmr.ALARM_AUTO, on_success_callback)
      mytimer:interval(100) -- actually, 500 mseconds is better!
      mytimer:start()
      
      mytimer1 = tmr.create()
      mytimer1:register(10000, tmr.ALARM_AUTO, check_relay1_input)
      mytimer1:interval(100) -- actually, 500 mseconds is better!
      mytimer1:start()
      
      mytimer2 = tmr.create()
      mytimer2:register(10000, tmr.ALARM_AUTO, check_relay2_input)
      mytimer2:interval(500) -- actually, 500 mseconds is better!
      mytimer2:start()
    

    Code old

       -- relay 1 input
       gpio.mode(6, gpio.INPUT, gpio.PULLUP )
       -- relay 2 input
       gpio.mode(7, gpio.INPUT, gpio.PULLUP )
       -- power switch control output
       gpio.mode(1, gpio.OUTPUT )
       -- relay 1 ouput
       gpio.mode(2, gpio.OUTPUT )
       -- relay 2 ouput
       gpio.mode(5, gpio.OUTPUT )
       
       relay1 = 0
       relay2 = 0
       
       function toggle_output_pwm()
           gpio.write(1, gpio.HIGH)
           tmr.delay(10000)
           gpio.write(1, gpio.LOW)
       end
       
       function deactivate_pwm_output()
           val = adc.read(0)
           if val > 10 then
                  print("Output is active:", val)
                  toggle_output_pwm()
                  val = adc.read(0)
                  print("Output is deactivated:", val)
           end
       end
       
       function activate_pwm_output()
           val = adc.read(0)
           if val < 10 then
                  print("Output is deactivated:", val)
                  toggle_output_pwm()
                  val = adc.read(0)
                  print("Output is activated:", val)
           end
       end
       
       function on_success_callback()
           val = adc.read(0)
           if val < 10 then
                  print("System voltage low (mV):", val)
           else
                  print("System voltage high (mv):", val)
           end
       end
       
       function check_relay1_input()
           relay1_input = gpio.read(6) -- gpio12
           relay2_input = gpio.read(7) -- gpio13
           print("Status relay 1:", relay1_input)
           print("Status relay 2:", relay2_input)
           if relay1_input == 0 then
               -- trigger output low
               if relay1 == 0 then
                   deactivate_pwm_output()
               end   
               -- activate relay 1
               relay1 = 1
               gpio.write(2, gpio.HIGH)
               activate_pwm_output()
          elseif relay2_input == 0 then
               -- trigger output low
               if relay2 == 0 then
                   deactivate_pwm_output()
               end
               -- activate relay 1
               relay2 = 1
               gpio.write(5, gpio.HIGH)
               activate_pwm_output()
          else
               -- trigger output low
               deactivate_pwm_output()
               -- activate relay 1
               relay1 = 0
               relay2 = 0
               gpio.write(2, gpio.LOW)
               gpio.write(5, gpio.LOW)
          end
       end
       
       function check_relay2_input()
       
       end
       
       -- if the output is active deactivate it
       val = adc.read(0)
       if val > 10 then
              print("Output is active:", val)
              toggle_output_pwm()
              val = adc.read(0)
              print("Output is deactivated:", val)
       end
       
       mytimer = tmr.create()
       mytimer:register(10000, tmr.ALARM_AUTO, on_success_callback)
       mytimer:interval(500) -- actually, 500 mseconds is better!
       mytimer:start()
       
       mytimer1 = tmr.create()
       mytimer1:register(10000, tmr.ALARM_AUTO, check_relay1_input)
       mytimer1:interval(500) -- actually, 500 mseconds is better!
       mytimer1:start()
       
       mytimer2 = tmr.create()
       mytimer2:register(10000, tmr.ALARM_AUTO, check_relay2_input)
       mytimer2:interval(500) -- actually, 500 mseconds is better!
       mytimer2:start()
    


    DR01 V2.6 power schematic
    Power schematic DR01 V2.6
    Component Current part Data sheet Replacement power part Comments Color
    Power mosfet NCE30H10K <pdf>File:NCE30H10K-NCEPowerSemiconductor.pdf</pdf>
  • MOSFET High Power Heated Bed Expansion Power Module
  • yellow
    Power relays SANYOU SARM-S112D4 <pdf>File:SANYOU_SARM-S112D4.pdf</pdf>
  • 12V Relay 20A auto
  • black

    Speed control