I read a lot and sometimes I find that I end up reading many books that are quite similar, but sometimes I want to try something new. I could go to a bookstore or library, even look online and try and find something that I wouldn't normally read, but even by doing that I am likely to navigate towards the familiar.
The only way to be sure to try something new would be to put it in somebody else's hands, say a book club with a subscription service. These are great and along with various other box subscription services, new ones come onto the market regularly. The problem with a subscription service is that they assume you will work at their pace, so if you read a book to fast, you are waiting on the next. Alternatively if you have a lot of work on and don't get to finish a book, you start to get an accumulation of them waiting to be read. The solution is for the service to be dynamic to my timings and schedule. I couldn't find something like that, so I have made my own!
Amazon DRS allows you to manage a product like a subscription, when you start to run out you can get more ordered automatically, this is what I'm looking for. However the next problem to occur is that when you setup DRS you choose a product and that same product is then ordered again, this would result in many copies of the same book which is not the solution I'm looking for. I would also need to pick that book myself, which would go back to our first problem. I need something else, so in comes the GoodReads API. Using a small application I can get details of the ISBN number for various books based on some simple search criteria, these can then be applied to DRS. The idea then would be that I would be given options for different genre of book, with a single book for each genre supplied at random by the GoodReads API.
With my randomly selected books in their different slots based on genre within DRS, the next problem is how to manage ordering. Using a Raspberry PI I link to a microswitch with roller that is fixed to a holder for a book. When the holder is down it controls the switch to know that we have a book available, when its removed the switch triggers and a new book is ordered. To give us some more control here I added a button to switch between the active slot to ensure that you can choose between genre for your next book. Also, so as not to order accidentally, the order wont take place until the book has been out of the holder for 30 seconds. Via the magic of the internet and postal service, a new book is then ordered and the device awaits the inserting of a new book before resetting into the state where it can order a new book.
Steps to follow:- Build an application for GoodReads API to get ISBN values for a random book from a list of authors. We will do this for different genres to give us our 4 slots.
- Register a DRS application for our device.
- Setup our user using Login With Amazon.
- Write the code so the book holder will order a new book.
- Build a book holder using Raspberry PI and display screen to detect when a book is removed from the holder.
- Wait patiently for the order to be delivered.
In this section we will look at getting the ISBN values for our books from the GoodReads API and also setting up the device for our user.
The following video looks at the GoodReads API and the code we use to get the book ISBN's. As its related to this area, we will also look at the DRS portal to update the slots with the books chosen by our code. All the code for this is available within the code section of this project.
Part Two: Configuring the DRS portal and SNSI have intentionally avoided covering setting up the DRS device in the portal and setting up the notifications via SNS as there are step by step tutorials by Amazon which will remain upto date. I also wouldn't add much to them by repeating the steps here. My approach to setting these up were to just follow the wizards and steps provided which kept the process quick and easy. Once you have done these, you can use details such as the client_id and client_secret you have created in the main part of the code.
Part Three: Writing the code for the deviceFor this I chose to use a Raspberry Pi running Windows 10 IoT. This choice was primarily down to the fact another project I am working on requires this, but the code is relatively simple and could be migrated to another device such as Arduino.
As with the previous section, I have a video explaining the main aspects of the code and the code files themselves are within the code section.
Part Four: User setupThe user needs to setup their device via a website. I kept this at the simplest process using just a Login With Amazon button. However if going for full certification of the product this would be moved to a teaser page that Amazon provides.
Part Five: Build the hardwareNow for the next fun part! Hardware wise, this is fairly simple. We have a large display as it made the videos easier, a Raspberry Pi 3 and a could of buttons and switches that are assigned to GPIO pins on the Pi.
Just in case it wasn't clear in the video, the Raspberry Pi should look something like this:
So the hardware is working fine, but as it stands my cat would take it apart within a few minutes, so we are just going to neaten things up and put it in a box. My original plan was to have a stand for the book where springs would hold the stand up, but when a book was added it would drop onto the microswitch. Unfortunately the springs I purchased have the strength to hold a car up without moving, so I have gone for a simpler approach of resting the book on the box, with the microswitch sticking up over one end.
From the order made in the hardware demo I got the following notification to confirm my order. It shows the name of our DRS app clearly and that the order was placed via Dash Replenishment.
As I raised in my intro video this is a proof of concept so there are things that I would like to work on going forward and with the idea of creating a viable product. Some of these are just time related, where I could invest more time if it was intended that this was used by more than just a handful of people. Others are waiting on seeing how the DRS API's are improved in the future. For example:
Me: I have only used limited authors at this stage so that the processes could be easily followed on this page, this would be just a case of further time added to include a wider variety of authors.
Me: Specify a quality criteria. My current process only iterates through the various books an author has published, the data returned by the GoodReads API also includes ratings taken from their community, this would allow a quality threshold to be included.
Amazon DRS: There is currently no process to auto update the ASIN's for the different slots, this means that I can not auto update the values when I run the application to identify the next books. This results in a manual task that could be removed in the future.
Amazon DRS: Item to order can not be resolved dynamically. This is really the one major limitation to the current process. If we were able to order dynamically when the DRS service call is made, we could tailor our orders directly to each user. This would ensure that they don't get duplicates of books they have already purchased, can block authors that they don't like or put higher weighting values to the review scores that books have received. This would allow me to create a web portal for users to select these details and provide a real viable service. As DRS auto emails (or sends to your Amazon App) any new orders, users would always have the opportunity to cancel anything if they decided they didn't want to place that order after all, which in my opinion does mitigate much of the risk associated with allowing DRS products to dynamically order.
Comments