element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Upcycle It
  • Challenges & Projects
  • Design Challenges
  • Upcycle It
  • More
  • Cancel
Upcycle It
Blog [Upcycle It] Hermes 3000 - Post #5
  • Blog
  • Forum
  • Documents
  • Polls
  • Files
  • Events
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: jofas
  • Date Created: 22 May 2017 7:41 PM Date Created
  • Views 2429 views
  • Likes 5 likes
  • Comments 16 comments
  • upcycled_hermes3000
  • hermes3000
Related
Recommended

[Upcycle It] Hermes 3000 - Post #5

jofas
jofas
22 May 2017

Hello again! I had to delay this project for a little bit because I had final exams. Now that they're over, I've got some catching up to do. But it has been great to see the progress the other challengers are making!

 

In case you missed my previous posts, you can see them all here.

 

In my previous updates, I have discussed my progress in getting the Edison to recognize which key is being typed. As we have seen, there have been some issues. Remember how each type bar rests on a loop of copper wire to indicate that it is not being pressed? Well there is actually a lot of vibration that occurs when you type and this causes the type bars to momentarily lift off the copper wire, indicating a false positive. This is bad enough by itself, but also sometimes the type bar does not come back down to rest directly on the wire which makes the Edison think that the key is always being pressed. Basically, the Edison keeps reading multiple keys when I only want it to read one. I am going to continue investigating the best way to remedy these issues but it is possible that I will have to abandon this method altogether and try a different approach.

 

In the meantime however, I decided to work on some of the email-sending code for the Edison. I initially tried using python's smtplib to send an email through a gmail account I set up specifically for this project. While I was browsing stackoverflow to see if anyone else had accomplished this, I came across another method of sending an email that was much simpler. It involves using a service called mailgun. Mailgun is a good way of automatically sending emails using HTTP requests and it's free if you're sending under 10,000 emails a month. Below is the python code I used to send a sample email.

 

import requests
import email
def send_email():
    fp = open('sample_email', 'r')
    msg = email.message_from_file(fp)
    fp.close()

    return requests.post("https://api.mailgun.net/v3/MY_DOMAIN_NAME/messages", 
       auth=("api", "MY_API_KEY"), 
       data={"from": "MYEMAIL@EMAIL.COM", "to": msg.get('to'), "subject": msg.get('subject'), "text": msg.get_payload()})

if __name__ == '__main__':
    print send_email()

 

Notice I'm using another library called requests. This gives me an easy way to send HTTP requests and I would definitely recommend it if you're ever using python to communicate via HTTP. The send_email() function returns a Response which is basically just a code that tells me if the request was successful. If I get a response code of 200 then it worked fine.

 

I should also mention that I am using python's email library to turn a file into an email message. This is a little easier than manually parsing the file myself. The sample_email file looks like this:

To: MYEMAIL@EMAIL.COM

Subject: Sample email

This is a sample email to test the email

function of the hermes 3000 project.

 

 

End.

Lastly, I wrote some code that will wait for a button press, then call the send_email() function, then light an LED if I get a response code of 200 (so I know the request went through).

 

import mraa
import time
import send_email

LED_IO = 13
BTN_IO = 12
led = mraa.Gpio(LED_IO)
led.dir(mraa.DIR_OUT)
button = mraa.Gpio(BTN_IO)
button.dir(mraa.DIR_IN)

led.write(0)

while 1:
    if(button.read() == 1):
        time.sleep(0.5)
        r = send_email.send_email()
        if(r.status_code == 200):
            led.write(1)
            time.sleep(1)
            led.write(0)
    else:
        continue

 

 

When I run this code and then push the button, I see the LED light up for a second and then I get this in my email:

 

image

 

So the email sending function works! Here's how it will all go together: the user types an email which will have the same format as the sample email above. These characters will get written to a file as the user types. Then the user will press a button, the send_email() function will be called (but it will create the email from the file the user was modifying - not the sample_email file). The email will be sent off and the file will be erased so the next email can be typed.

 

Now that that's out of the way, I can get back to working on the key-detection mechanism. Once I have that fixed, I will try to incorporate some additional features if time permits. I hope you enjoyed this update, stay tuned for my next post! Let me know if you have any questions, comments, concerns, or criticisms.

  • Sign in to reply

Top Comments

  • mcb1
    mcb1 over 8 years ago in reply to balearicdynamics +2
    the solution can be conductive paint. That was one thought I had, but the paint is usually not flexible enought to last long. In an ideal world, some form of bent contact pin (like a Cat 5 plug) would…
  • mcb1
    mcb1 over 8 years ago in reply to balearicdynamics +2
    just there the vibrations are higher so probably the paint is the only reliable and relatively cheap solution. The issue I see is that the lever part of the type comes down and rests on the conductive…
  • ntewinkel
    ntewinkel over 8 years ago in reply to mcb1 +2
    Surprisingly a fax is considered a legal document and is still useful in some applications. So is paper My contracts are now just emailed PDFs. I used to print, sign, scan - but most recently started just…
Parents
  • mcb1
    mcb1 over 8 years ago

    there is actually a lot of vibration that occurs when you type

    One solution could be the use of conductive rubber, like the internals of keypads.

    Not sure where you'd get them or if you can easily incorporate something small enough along the bar.

     

     

    An interim solution may be to add a small amount of weight to the type bar.

    Personally I'd concentrate on the finish line, and accept there is some fine tuning to be done on the detection system.

     

    It is possibly the hardest part given the mechanical nature of the that typewriter.

     

    Mark

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • balearicdynamics
    balearicdynamics over 8 years ago in reply to mcb1

    The idea of conductive rubber is correct; as it is difficult to find (here for sure) I think that following the same mood the solution can be conductive paint.

     

    Enrico

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • mcb1
    mcb1 over 8 years ago in reply to balearicdynamics

    the solution can be conductive paint.

    That was one thought I had, but the paint is usually not flexible enought to last long.

     

    In an ideal world, some form of bent contact pin (like a Cat 5 plug) would be mounted in a 3D printed plastic piece and fitted to the type bar.

    This would give the contact, with some form of hysterisis and allow the original bar to absorb the forces.

     

    However these are improvements to a design, and I'm not sure I've ever seen anything that worked on the first design, so we should look at this as the prototype.

     

    Mark

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • balearicdynamics
    balearicdynamics over 8 years ago in reply to mcb1

    Where it is expected soo much stress adhesive copper can be used joined with conductive pain. I tested this kind of copper and adhesive is very stable also for long term use. But the real problem is just there the vibrations are higher so probably the paint is the only reliable and relatively cheap solution.

     

    Enrico

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • mcb1
    mcb1 over 8 years ago in reply to balearicdynamics

    just there the vibrations are higher so probably the paint is the only reliable and relatively cheap solution.

    The issue I see is that the lever part of the type comes down and rests on the conductive surface.

    There is an amount of flex as the rubber absorbs the returning lever, which means the exact stopping point varies.

     

    I suspect jofas has discovered that replacing that absorbtion device (ie the rubber) and replacing it with a hard piece of copper, has caused bouncing of the lever.

     

    Imagine if the conductive paint was the surface that the lever came back down upon.

    I think it wouldn't take long for it to start being broken up, which is why I was suggesting conductive rubber as the first thought, but then settled on the pin and 3D holder.

     

     

    Of course had jofas had an electric typewriter on hand, most of this might have been avoided.image

    Not the same steampunk theme, but a typewriter with IoT just the same.image

     

    Mark

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • More
    • Cancel
Comment
  • mcb1
    mcb1 over 8 years ago in reply to balearicdynamics

    just there the vibrations are higher so probably the paint is the only reliable and relatively cheap solution.

    The issue I see is that the lever part of the type comes down and rests on the conductive surface.

    There is an amount of flex as the rubber absorbs the returning lever, which means the exact stopping point varies.

     

    I suspect jofas has discovered that replacing that absorbtion device (ie the rubber) and replacing it with a hard piece of copper, has caused bouncing of the lever.

     

    Imagine if the conductive paint was the surface that the lever came back down upon.

    I think it wouldn't take long for it to start being broken up, which is why I was suggesting conductive rubber as the first thought, but then settled on the pin and 3D holder.

     

     

    Of course had jofas had an electric typewriter on hand, most of this might have been avoided.image

    Not the same steampunk theme, but a typewriter with IoT just the same.image

     

    Mark

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • More
    • Cancel
Children
  • jofas
    jofas over 8 years ago in reply to mcb1

    I definitely agree - If I had used an electric typewriter this project would have been so much easier!

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube